From 59ab52c7182654ef9ea94ecf3fed6af4db3a0a27 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 11 Sep 2017 13:39:03 +0200 Subject: [PATCH] FIX hidden option MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN --- htdocs/commande/card.php | 3 ++- htdocs/commande/class/commande.class.php | 3 ++- htdocs/compta/facture/card.php | 3 ++- htdocs/compta/facture/class/facture.class.php | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 6d62f6c129a..03c91b69710 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -398,6 +398,7 @@ if (empty($reshook)) } // Now we create same links to contact than the ones found on origin object + /* Useless, already into the create if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) { $originforcontact = $object->origin; @@ -420,7 +421,7 @@ if (empty($reshook)) } } else dol_print_error($resqlcontact); - } + }*/ // Hooks $parameters = array('objFrom' => $srcobject); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3262a563f4c..5785e73bac4 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -920,7 +920,8 @@ class Commande extends CommonOrder foreach ($exp->linkedObjectsIds['commande'] as $key => $value) { $originforcontact = 'commande'; - $originidforcontact = $value->id; + if (is_object($value)) $originidforcontact = $value->id; + else $originidforcontact = $value; break; // We take first one } } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 23b310fd9f7..248bc31737d 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1299,6 +1299,7 @@ if (empty($reshook)) } // Now we create same links to contact than the ones found on origin object + /* Useless, already into the create if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) { $originforcontact = $object->origin; @@ -1321,7 +1322,7 @@ if (empty($reshook)) } } else dol_print_error($resqlcontact); - } + }*/ // Hooks $parameters = array('objFrom' => $srcobject); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index d05ad059577..572e59e737a 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -498,7 +498,8 @@ class Facture extends CommonInvoice foreach ($exp->linkedObjectsIds['commande'] as $key => $value) { $originforcontact = 'commande'; - $originidforcontact = $value->id; + if (is_object($value)) $originidforcontact = $value->id; + else $originidforcontact = $value; break; // We take first one } }