Skip to content

Commit

Permalink
FIX Dolibarr#32072 PUT API call does not handle extra fields in shipm…
Browse files Browse the repository at this point in the history
…ent module

Store extra field during updating the shipment object
  • Loading branch information
denes44 committed Nov 23, 2024
1 parent 2b264ae commit a599216
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion htdocs/expedition/class/api_shipments.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
8 changes: 8 additions & 0 deletions htdocs/expedition/class/expedition.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit a599216

Please sign in to comment.