From 27f89cc62a63d3159d5e99ba1ca64ccc009646f8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2026 13:20:30 +0200 Subject: [PATCH] FIX #37760 --- htdocs/comm/propal/class/api_proposals.class.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 875e6affbb5..eb656527d8e 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -314,8 +314,20 @@ class Proposals extends DolibarrApi if (!DolibarrApiAccess::$user->hasRight('propal', 'creer')) { throw new RestException(403, "Insufficiant rights"); } + // Check mandatory fields - $result = $this->_validate($request_data); + $this->_validate($request_data); + + // Check thirdparty validity + $socid = (int) $request_data['socid']; + $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') {