Skip to content

Commit

Permalink
Fix: missing linked objects
Browse files Browse the repository at this point in the history
  • Loading branch information
hregis committed Mar 15, 2012
1 parent 942b1f2 commit e86fed0
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
3 changes: 2 additions & 1 deletion htdocs/comm/propal.php
Expand Up @@ -2004,6 +2004,7 @@
}


$db->close();
// End of page
llxFooter();
$db->close();
?>
19 changes: 15 additions & 4 deletions htdocs/commande/class/commande.class.php
Expand Up @@ -868,6 +868,7 @@ function createFromClone($socid=0,$hookmanager=false)
function createFromProposal($object)
{
global $conf,$user,$langs;
global $hookmanager;

$error=0;

Expand Down Expand Up @@ -915,16 +916,26 @@ function createFromProposal($object)
$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);
Expand Down
11 changes: 9 additions & 2 deletions htdocs/compta/facture/class/facture.class.php
Expand Up @@ -669,8 +669,15 @@ function createFromOrder($object)
$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);

Expand Down

0 comments on commit e86fed0

Please sign in to comment.