From d1c66059cd7ef147285b7c914a8fa1dd8ac87432 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 6 Dec 2020 19:01:09 +0100 Subject: [PATCH 1/4] Add missing tag order_ref and order_ref_customer on shipments for ODT generation. Conflicts: htdocs/core/class/commondocgenerator.class.php --- htdocs/core/class/commondocgenerator.class.php | 10 ++++++++-- .../doc/doc_generic_shipment_odt.modules.php | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 90cfd84cf69..aa8cb7a1301 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -690,8 +690,14 @@ abstract class CommonDocGenerator $array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs); } - return $array_shipment; - } + // Add infor from $object->xxx where xxx has been loaded by fetch_origin() of shipment + if (!empty($object->commande) && is_object($object->commande)) { + $array_shipment['order_ref'] = $object->commande->ref; + $array_shipment['order_ref_customer'] = $object->commande->ref_customer; + } + + return $array_shipment; + } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 8b255e146d5..dffe3197c7b 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -468,6 +468,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition // Replace tags of object + external modules $tmparray = $this->get_substitutionarray_shipment($object, $outputlangs); + complete_substitutions_array($tmparray, $outputlangs, $object); // Call the ODTSubstitution hook $parameters = array('odfHandler'=>&$odfHandler, 'file'=>$file, 'object'=>$object, 'outputlangs'=>$outputlangs, 'substitutionarray'=>&$tmparray); From 7ad70c7c218410575065b6fff36acfe9604ead0e Mon Sep 17 00:00:00 2001 From: Frans Bosman Date: Mon, 7 Dec 2020 14:33:44 +0100 Subject: [PATCH 2/4] Update product.class.php Added Hidden Option STOCK_DEFAULT_BATCH, in order to replace the default '000000' batchnumber for the existing stock when batchnumbers are enabled for a product. --- htdocs/product/class/product.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index ac931da8702..9abd1d82da5 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -934,6 +934,7 @@ class Product extends CommonObject if ($this->hasbatch() && !$this->oldcopy->hasbatch()) { //$valueforundefinedlot = 'Undefined'; // In previous version, 39 and lower $valueforundefinedlot = '000000'; + if ($conf->global->STOCK_DEFAULT_BATCH) $valueforundefinedlot = $conf->global->STOCK_DEFAULT_BATCH; dol_syslog("Flag batch of product id=".$this->id." is set to ON, so we will create missing records into product_batch"); From 669205af1c05f879a59f57a2160b7515991d964b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 7 Dec 2020 19:02:49 +0100 Subject: [PATCH 3/4] Update product.class.php --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 9abd1d82da5..ccca1a85f47 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -934,7 +934,7 @@ class Product extends CommonObject if ($this->hasbatch() && !$this->oldcopy->hasbatch()) { //$valueforundefinedlot = 'Undefined'; // In previous version, 39 and lower $valueforundefinedlot = '000000'; - if ($conf->global->STOCK_DEFAULT_BATCH) $valueforundefinedlot = $conf->global->STOCK_DEFAULT_BATCH; + if (!empty($conf->global->STOCK_DEFAULT_BATCH)) $valueforundefinedlot = $conf->global->STOCK_DEFAULT_BATCH; dol_syslog("Flag batch of product id=".$this->id." is set to ON, so we will create missing records into product_batch"); From 485fe0fc62a4d452c429de2d68e4883692114013 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Dec 2020 17:51:26 +0100 Subject: [PATCH 4/4] FIX Can receipt of a product that required lot after disabling stock and lot module --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 289d317abb7..3e76b2bb12a 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -240,7 +240,7 @@ if (empty($reshook)) $stockLocation = "ent1".$i."_0"; $qty = "qtyl".$i; - if ($objectsrc->lines[$i]->product_tobatch) // If product need a batch number + if (!empty($conf->productbatch->enabled) && $objectsrc->lines[$i]->product_tobatch) // If product need a batch number { if (GETPOSTISSET($batch)) {