From c1231d322da02aa0dfb0b1de10b4c8fc6292c4ba Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 30 Jun 2006 15:17:59 +0000 Subject: [PATCH] =?UTF-8?q?Ajout:=20si=20il=20y=20a=20des=20contacts=20"co?= =?UTF-8?q?mmercial=20suivi=20propale"=20et=20"contact=20client=20suivi=20?= =?UTF-8?q?propale"=20s=E9lectionn=E9=20=20dans=20une=20propale=20il=20ser?= =?UTF-8?q?ont=20s=E9lectionn=E9=20dans=20la=20commande=20apr=E8s=20cl=F4t?= =?UTF-8?q?ure=20de=20cette=20derni=E8re.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/commande/commande.class.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index 447ecc79686..9f4b385c8d7 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -391,9 +391,9 @@ class Commande extends CommonObject */ for ($i = 0 ; $i < sizeof($this->lines) ; $i++) { - // on récupère le subprice de la propale if ($this->propale_id) { + // On récupère le subprice de la propale $this->lines[$i]->price = $this->lines[$i]->subprice; } @@ -424,9 +424,30 @@ class Commande extends CommonObject { $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'co_pr (fk_commande, fk_propale) VALUES ('.$this->id.','.$this->propale_id.')'; $this->db->query($sql); + + // On récupère les différents contact interne et externe + $prop = New Propal($this->db, $this->socidp, $this->propale_id); + + // On récupère le commercial suivi propale + $this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL'); + + if ($this->userid) + { + //On passe le commercial suivi propale en commercial suivi commande + $this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal'); + } + + // On récupère le contact client suivi propale + $this->contactid = $prop->getIdcontact('external', 'CUSTOMER'); + + if ($this->contactid) + { + //On passe le contact client suivi propale en contact client suivi commande + $this->add_contact($this->contactid[0], 'CUSTOMER', 'external'); + } } - $this->db->commit(); + $this->db->commit(); return $this->id; } else