From 210328dd332a5f9ad9d7d11479c8207c418ae5eb Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Tue, 28 Oct 2025 01:07:22 +0100 Subject: [PATCH] FIX avoid php warnings (#35967) --- htdocs/expedition/card.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 2dc153a5f7f..d4fb779f199 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1251,12 +1251,18 @@ if ($action == 'create') { $objectsav = $object; // Because Expedition is $expe and not $object that is wrongly a duplicate of $objectsrc. $object = $expe; // Propagate extrafieldsvalue from source object to shipment object - foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - if (array_key_exists('options_'.$key, $objectsav->array_options)) { // We take value from order only if extrafield has the same name/key. - $object->array_options['options_'.$key] = $objectsav->array_options['options_'.$key]; + if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && !empty($extrafields->attributes[$object->table_element]['label'])) { + foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { + if (array_key_exists('options_'.$key, $objectsav->array_options)) { // We take value from order only if extrafield has the same name/key. + $object->array_options['options_'.$key] = $objectsav->array_options['options_'.$key]; + } } } - $parameters = array('objectsrc' => isset($objectsrc) ? $objectsrc : '', 'cols' => '3', 'socid' => $socid); + $parameters = array( + 'objectsrc' => isset($objectsrc) ? $objectsrc : '', + 'cols' => '3', + 'socid' => $socid + ); include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; $object = $objectsav;