From d1c66059cd7ef147285b7c914a8fa1dd8ac87432 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 6 Dec 2020 19:01:09 +0100 Subject: [PATCH] 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);