Try an implementation a fix to avoid infinite loop in sync api - trigger

This commit is contained in:
Laurent Destailleur 2023-11-29 16:18:34 +01:00
parent aaca019f54
commit 3a78357253

View file

@ -263,8 +263,14 @@ class Thirdparties extends DolibarrApi
$result = $this->_validate($request_data);
foreach ($request_data as $field => $value) {
if ($field === 'caller') {
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again whith the caller
$this->company->context['caller'] = $request_data['caller'];
continue;
}
$this->company->$field = $value;
}
if ($this->company->create(DolibarrApiAccess::$user) < 0) {
throw new RestException(500, 'Error creating thirdparty', array_merge(array($this->company->error), $this->company->errors));
}