diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index b8f248371ba..c459d4fc975 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -947,7 +947,7 @@ class Commande extends CommonOrder } /** - * Create order + * Create sale order * Note that this->ref can be set or empty. If empty, we will use "(PROV)" * * @param User $user Object user that make creation @@ -1083,7 +1083,7 @@ class Commande extends CommonOrder if (getDolGlobalString('MAIN_CREATEFROM_KEEP_LINE_ORIGIN_INFORMATION')) { $originid = $line->origin_id; - $origintype = $line->origin; + $origintype = empty($line->origin_type) ? $line->origin : $line->origin_type; } else { $originid = $line->id; $origintype = $this->element; @@ -1179,7 +1179,7 @@ class Commande extends CommonOrder } if (!$error && $this->id && getDolGlobalString('MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN') && !empty($this->origin) && !empty($this->origin_id)) { // Get contact from origin object - $originforcontact = $this->origin; + $originforcontact = empty($this->origin_type) ? $this->origin : $this->origin_type; $originidforcontact = $this->origin_id; if ($originforcontact == 'shipping') { // shipment and order share the same contacts. If creating from shipment we take data of order require_once DOL_DOCUMENT_ROOT.'/expedition/class/expedition.class.php';