From 2a37a9a2fade5716de977db9aae8817876e0ed25 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 30 Apr 2010 06:57:28 +0000 Subject: [PATCH] Fix: error with linked element --- htdocs/comm/propal/class/propal.class.php | 2 -- htdocs/commande/class/commande.class.php | 5 ++++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 730a92fd04b..e7268f0c47e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1241,7 +1241,6 @@ class Propal extends CommonObject // Propale signee include_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php"); - // TODO move in triggers $result=$this->create_commande($user); if ($result >= 0) @@ -1314,7 +1313,6 @@ class Propal extends CommonObject * \brief Cree une commande a partir de la proposition commerciale * \param user Utilisateur * \return int <0 si ko, >=0 si ok - * TODO move in triggers */ function create_commande($user) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 5fcd63c23db..8e1d3555f83 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -112,6 +112,7 @@ class Commande extends CommonObject * \brief Cree la commande depuis une propale existante * \param user Utilisateur qui cree * \param propale_id id de la propale qui sert de modele + * TODO move in trigger */ function create_from_propale($user, $propale_id) { @@ -158,7 +159,9 @@ class Commande extends CommonObject $soc = new Societe($this->db); $soc->id = $this->socid; $soc->set_as_client(); - $this->propale_id = $propal->id; + + $this->origin = $propal->element; + $this->origin_id = $propal->id; return $this->create($user); }