2
0
forked from Wavyzz/dolibarr

Ajout: si il y a des contacts "commercial suivi propale" et "contact client suivi propale" slectionn

dans une propale il seront slectionn dans la commande aprs clture de cette dernire.
This commit is contained in:
Regis Houssin
2006-06-30 15:17:59 +00:00
parent ce37ea8d9b
commit c1231d322d

View File

@@ -391,9 +391,9 @@ class Commande extends CommonObject
*/
for ($i = 0 ; $i < sizeof($this->lines) ; $i++)
{
// on r<>cup<75>re le subprice de la propale
if ($this->propale_id)
{
// On r<>cup<75>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<75>re les diff<66>rents contact interne et externe
$prop = New Propal($this->db, $this->socidp, $this->propale_id);
// On r<>cup<75>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<75>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