From a59921613e14e8ecb25fc55eade9921afe784879 Mon Sep 17 00:00:00 2001 From: denes44 <60078357+denes44@users.noreply.github.com> Date: Sat, 23 Nov 2024 01:21:30 +0100 Subject: [PATCH] FIX #32072 PUT API call does not handle extra fields in shipment module Store extra field during updating the shipment object --- htdocs/expedition/class/api_shipments.class.php | 7 ++++++- htdocs/expedition/class/expedition.class.php | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index 51b3aa550b8c1..4d67ffe024fe0 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -483,7 +483,12 @@ public function put($id, $request_data = null) $this->shipment->context['caller'] = sanitizeVal($request_data['caller'], 'aZ09'); continue; } - + if ($field == 'array_options' && is_array($value)) { + foreach ($value as $index => $val) { + $this->shipment->array_options[$index] = $this->_checkValForAPI($field, $val, $this->shipment); + } + continue; + } $this->shipment->$field = $this->_checkValForAPI($field, $value, $this->shipment); } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 47fae30ca4b07..f7b5c2aeb3b3f 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -1252,6 +1252,14 @@ public function update($user = null, $notrigger = 0) $this->errors[] = "Error ".$this->db->lasterror(); } + // Actions on extra fields + if (!$error) { + $result = $this->insertExtraFields(); + if ($result < 0) { + $error++; + } + } + if (!$error && !$notrigger) { // Call trigger $result = $this->call_trigger('SHIPPING_MODIFY', $user);