diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index c5c6571c3518699b9a9ff5d433931d09dd28c338..5289521295b086a67b0e86091e3093fd90b7c3f7 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -2004,6 +2004,7 @@ else } -$db->close(); +// End of page llxFooter(); +$db->close(); ?> diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index d11ab2b1cebf569858073d2d750bebdee90453d5..2a188fa044e7e75d7577a16c3442cb7cfabd0d77 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -868,6 +868,7 @@ class Commande extends CommonObject function createFromProposal($object) { global $conf,$user,$langs; + global $hookmanager; $error=0; @@ -915,16 +916,26 @@ class Commande extends CommonObject $this->note = $object->note; $this->note_public = $object->note_public; - $this->origin = $object->element; - $this->origin_id = $object->id; + $this->origin = $object->element; + $this->origin_id = $object->id; + + // Possibility to add external linked objects with hooks + $this->linked_objects[$this->origin] = $this->origin_id; + if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects)) + { + $this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects); + } $ret = $this->create($user); if ($ret > 0) { // Actions hooked (by external module) - include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'); - $hookmanager=new HookManager($this->db); + if (! is_object($hookmanager)) + { + include_once(DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'); + $hookmanager=new HookManager($this->db); + } $hookmanager->initHooks(array('orderdao')); $parameters=array('objFrom'=>$object); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index dad4757f61d75b410c31be7d5b934c88246a603a..f0af7b909b9f784ba2f5f93ca2172aaf2a129bb8 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -669,8 +669,15 @@ class Facture extends CommonObject $this->note = $object->note; $this->note_public = $object->note_public; - $this->origin = $object->element; - $this->origin_id = $object->id; + $this->origin = $object->element; + $this->origin_id = $object->id; + + // Possibility to add external linked objects with hooks + $this->linked_objects[$this->origin] = $this->origin_id; + if (is_array($object->other_linked_objects) && ! empty($object->other_linked_objects)) + { + $this->linked_objects = array_merge($this->linked_objects, $object->other_linked_objects); + } $ret = $this->create($user);