diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 03db1b45fbc..ec76c094f64 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -1370,11 +1370,13 @@ class Thirdparties extends DolibarrApi $account->fetch($bankaccount_id); - if (!$account->socid == $id) { - throw new RestException(403); - } + $socid = (int) $account->socid; - return $account->delete(DolibarrApiAccess::$user); + if ($socid == $id) { + return $account->delete(DolibarrApiAccess::$user); + } else { + throw new RestException(403, "Not allowed due to bad consistency of input data"); + } } /**