From 92fb9fc766802c2bb2543e59f868b7bb0aeb35e8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2026 13:29:47 +0200 Subject: [PATCH] FIX #37762 --- htdocs/ticket/class/api_tickets.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index c07e382f3da..5c446a0aadc 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -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