From ea60d0be635138ce6e90a4807e1bc0636c77d5d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 17 Apr 2020 10:27:38 +0200 Subject: [PATCH] FIX #13618 --- htdocs/compta/facture/class/api_invoices.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 7c7437bfb8e..a178e5bba82 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -445,8 +445,7 @@ class Invoices extends DolibarrApi } $result = $this->invoice->delete_contact($rowid); - - if (!$result) { + if ($result < 0) { throw new RestException(500, 'Error when deleted the contact'); } @@ -543,7 +542,7 @@ class Invoices extends DolibarrApi /** * Delete invoice * - * @param int $id Invoice ID + * @param int $id Invoice ID * @return array */ public function delete($id) @@ -560,7 +559,8 @@ class Invoices extends DolibarrApi throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - if ($this->invoice->delete($id) < 0) + $result = $this->invoice->delete(DolibarrApiAccess::$user); + if ($result < 0) { throw new RestException(500); }