Fix #36282: Update shipment reference handling in commondocgenerator (#36283)

* Update shipment reference handling in commondocgenerator

* Refactor order reference assignment for clarity

* Refactor origin object handling in shipment array

* Refactor origin object handling in shipment array

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Günter Lukas
2025-11-19 14:49:16 +01:00
committed by GitHub
parent b449edad3a
commit eb2d345330

View File

@@ -1080,10 +1080,12 @@ abstract class CommonDocGenerator
$array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs); $array_shipment = $this->fill_substitutionarray_with_extrafields($object, $array_shipment, $extrafields, $array_key, $outputlangs);
} }
// Add info from $object->xxx where xxx has been loaded by fetch_origin() of shipment // Add info from $object->origin_object which has been loaded by fetch() of shipment
if (is_object($object->commande) && !empty($object->commande->ref)) { if ($object->origin_type == 'commande' && is_object($object->origin_object) && !empty($object->origin_object->ref)) {
$array_shipment['order_ref'] = $object->commande->ref; $originOrder = $object->origin_object;
$array_shipment['order_ref_customer'] = $object->commande->ref_customer; '@phan-var-force Commande $originOrder';
$array_shipment['order_ref'] = $originOrder->ref;
$array_shipment['order_ref_customer'] = $originOrder->ref_customer;
} }
// Load dim data // Load dim data