From 88e6c203eb919c2f28ddbfe8381ea8bedb93c966 Mon Sep 17 00:00:00 2001
From: Juanjo Menent <jmenent@2byte.es>
Date: Fri, 25 Nov 2016 23:41:47 +0100
Subject: [PATCH] Fix #6037 Bill Orders issue

---
 htdocs/compta/facture/class/facture.class.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 61f51b19436..b938bdd0883 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -424,7 +424,7 @@ class Facture extends CommonInvoice
 				    else                                // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1))
 				    {
 				        $origin_id = $tmp_origin_id;
-    					$ret = $this->add_object_linked($origin, $origin_id);
+    					$ret = $this->add_object_linked($this->origin, $origin_id);
     					if (! $ret)
     					{
     						dol_print_error($this->db);
@@ -434,7 +434,7 @@ class Facture extends CommonInvoice
 				    
 					if (! empty($conf->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN))
 					{
-    					$originforcontact = $origin;
+    					$originforcontact = $this->origin;
     					$originidforcontact = $origin_id;
     					if ($originforcontact == 'shipping')     // shipment and order share the same contacts. If creating from shipment we take data of order
     					{
-- 
GitLab