This commit is contained in:
Laurent Destailleur 2026-04-23 13:29:47 +02:00
parent 5586cb4583
commit 92fb9fc766

View file

@ -450,6 +450,19 @@ class Tickets extends DolibarrApi
throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
// Check thirdparty validity
$socid = (int) $request_data['socid'];
if ($socid > 0) {
$thirdpartytmp = new Societe($this->db);
$thirdparty_result = $thirdpartytmp->fetch($socid);
if ($thirdparty_result < 1) {
throw new RestException(404, 'Thirdparty with id='.$socid.' not found or not allowed');
}
if (!DolibarrApi::_checkAccessToResource('societe', $thirdpartytmp->id)) {
throw new RestException(404, 'Thirdparty with id='.$thirdpartytmp->id.' not found or not allowed');
}
}
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 with the caller