From c31a924812fa490b17696c97fd28a13bbee14ecf Mon Sep 17 00:00:00 2001 From: marc Date: Sun, 24 Jul 2022 16:50:08 +0200 Subject: [PATCH] The return code 0 is not an error but the serveur refuse to execute the request --- htdocs/compta/facture/class/api_invoices.class.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 6948ae850c7..285d9d366f7 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -666,8 +666,10 @@ class Invoices extends DolibarrApi } $result = $this->invoice->delete(DolibarrApiAccess::$user); - if ($result <= 0) { + if ($result < 0) { throw new RestException(500, 'Error when deleting invoice'); + } elseif ($result == 0) { + throw new RestException(403, 'Invoice not erasable'); } return array(