From d35fc67cfcae0b8913462bdc905ffdbc4ba13ee6 Mon Sep 17 00:00:00 2001 From: Neil Orley Date: Fri, 15 Dec 2017 10:00:50 +0100 Subject: [PATCH] Unknown --- htdocs/compta/facture/class/api_invoices.class.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 115080811e6..34935c3088a 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -472,6 +472,11 @@ class Invoices extends DolibarrApi * @url POST {id}/lines * * @return int + * + * @throws 200 + * @throws 401 + * @throws 404 + * @throws 400 */ function postLine($id, $request_data = NULL) { if(! DolibarrApiAccess::$user->rights->facture->creer) { @@ -528,11 +533,11 @@ class Invoices extends DolibarrApi $request_data->fk_unit ); - if ($updateRes > 0) { - return $updateRes; - + if ($updateRes < 0) { + throw new RestException(400, 'Unable to insert the new line. Check your inputs. '.$this->invoice->error); } - throw new RestException(400, 'Unable to insert the new line. Check your inputs.'); + + return $updateRes; } /**