Fix: error with linked element
This commit is contained in:
parent
38701cda84
commit
85d7bf3d2b
@ -77,6 +77,9 @@ class Commande extends CommonObject
|
|||||||
var $info_bits;
|
var $info_bits;
|
||||||
var $source; // Origin of order
|
var $source; // Origin of order
|
||||||
|
|
||||||
|
var $origin;
|
||||||
|
var $origin_id;
|
||||||
|
|
||||||
var $user_author_id;
|
var $user_author_id;
|
||||||
|
|
||||||
var $lines = array();
|
var $lines = array();
|
||||||
@ -665,20 +668,20 @@ class Commande extends CommonObject
|
|||||||
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
|
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id;
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
if ($this->id && $this->propale_id)
|
if ($this->id)
|
||||||
|
{
|
||||||
|
// Add linked object
|
||||||
|
if ($this->origin && $this->origin_id)
|
||||||
{
|
{
|
||||||
// Add proposal link
|
|
||||||
// TODO normaliser ?
|
|
||||||
$this->origin_id = $this->propale_id;
|
|
||||||
$this->origin = "propal";
|
|
||||||
$ret = $this->add_object_linked();
|
$ret = $this->add_object_linked();
|
||||||
if (! $ret)
|
if (! $ret) dol_print_error($this->db);
|
||||||
{
|
|
||||||
dol_print_error($this->db);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO mutualiser
|
||||||
|
if ($this->origin == 'propal' && $this->origin_id)
|
||||||
|
{
|
||||||
// On recupere les differents contact interne et externe
|
// On recupere les differents contact interne et externe
|
||||||
$prop = New Propal($this->db, $this->socid, $this->propale_id);
|
$prop = New Propal($this->db, $this->socid, $this->origin_id);
|
||||||
|
|
||||||
// On recupere le commercial suivi propale
|
// On recupere le commercial suivi propale
|
||||||
$this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL');
|
$this->userid = $prop->getIdcontact('internal', 'SALESREPFOLL');
|
||||||
@ -698,6 +701,7 @@ class Commande extends CommonObject
|
|||||||
$this->add_contact($this->contactid[0], 'CUSTOMER', 'external');
|
$this->add_contact($this->contactid[0], 'CUSTOMER', 'external');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user