Fix: missing contacts with order to invoice
This commit is contained in:
parent
a5482c56ab
commit
19d4147fcd
@ -700,35 +700,35 @@ class Commande extends CommonObject
|
||||
{
|
||||
$this->ref="(PROV".$this->id.")";
|
||||
|
||||
// Add linked object
|
||||
// Add linked object and contacts
|
||||
if ($this->origin && $this->origin_id)
|
||||
{
|
||||
$ret = $this->add_object_linked();
|
||||
if (! $ret) dol_print_error($this->db);
|
||||
}
|
||||
|
||||
// TODO mutualiser
|
||||
if ($this->origin == 'propal' && $this->origin_id)
|
||||
{
|
||||
// On recupere les differents contact interne et externe
|
||||
$prop = new Propal($this->db, $this->socid, $this->origin_id);
|
||||
|
||||
// On recupere 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 recupere 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');
|
||||
|
||||
// TODO mutualiser
|
||||
if ($this->origin == 'propal')
|
||||
{
|
||||
// On recupere les differents contact interne et externe
|
||||
$prop = new Propal($this->db, $this->socid, $this->origin_id);
|
||||
|
||||
// On recupere 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 recupere 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');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,6 +275,31 @@ class Facture extends CommonObject
|
||||
dol_print_error($this->db);
|
||||
$error++;
|
||||
}
|
||||
|
||||
// TODO mutualiser
|
||||
if ($this->origin == 'commande')
|
||||
{
|
||||
// On recupere les differents contact interne et externe
|
||||
$order = new Commande($this->db, $this->socid, $this->origin_id);
|
||||
|
||||
// On recupere le commercial suivi propale
|
||||
$this->userid = $order->getIdcontact('internal', 'SALESREPFOLL');
|
||||
|
||||
if ($this->userid)
|
||||
{
|
||||
//On passe le commercial suivi commande en commercial suivi paiement
|
||||
$this->add_contact($this->userid[0], 'SALESREPFOLL', 'internal');
|
||||
}
|
||||
|
||||
// On recupere le contact client facturation commande
|
||||
$this->contactid = $order->getIdcontact('external', 'BILLING');
|
||||
|
||||
if ($this->contactid)
|
||||
{
|
||||
//On passe le contact client facturation commande en contact client facturation
|
||||
$this->add_contact($this->contactid[0], 'BILLING', 'external');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user