From b892fc718262996e329e93728f252a2a8f867ff6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 14 Feb 2019 18:22:35 +0100 Subject: [PATCH] Update api_invoices.class.php --- .../facture/class/api_invoices.class.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index af3626942de..3056fc1c7f4 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -338,7 +338,7 @@ class Invoices extends DolibarrApi throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } $request_data = (object) $request_data; - $updateRes = $this->invoice->updateline( + $updateRes = $this->invoice->updateline( $lineid, $request_data->desc, $request_data->subprice, @@ -362,7 +362,7 @@ class Invoices extends DolibarrApi $request_data->situation_percent, $request_data->fk_unit, $request_data->multicurrency_subprice - ); + ); if ($updateRes > 0) { $result = $this->get($id); @@ -392,7 +392,7 @@ class Invoices extends DolibarrApi throw new RestException(401); } - $result = $this->facture->fetch($id); + $result = $this->invoice->fetch($id); if(!$result) { throw new RestException(404, 'Invoice not found'); @@ -402,17 +402,17 @@ class Invoices extends DolibarrApi throw new RestException(500, 'Availables types: BILLING, SHIPPING OR CUSTOMER'); } - if(!DolibarrApi::_checkAccessToResource('invoice', $this->facture->id)) { + if(!DolibarrApi::_checkAccessToResource('invoice', $this->invoice->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $result = $this->facture->add_contact($contactid, $type, 'external'); + $result = $this->invoice->add_contact($contactid, $type, 'external'); if (!$result) { throw new RestException(500, 'Error when added the contact'); } - return $this->facture; + return $this->_cleanObjectDatas($this->invoice); } /** @@ -434,23 +434,23 @@ class Invoices extends DolibarrApi throw new RestException(401); } - $result = $this->facture->fetch($id); + $result = $this->invoice->fetch($id); - if(!$result) { + if (!$result) { throw new RestException(404, 'Invoice not found'); } - if(!DolibarrApi::_checkAccessToResource('invoice', $this->facture->id)) { + if (!DolibarrApi::_checkAccessToResource('invoice', $this->invoice->id)) { throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - $result = $this->facture->delete_contact($rowid); + $result = $this->invoice->delete_contact($rowid); if (!$result) { throw new RestException(500, 'Error when deleted the contact'); } - return $this->facture; + return $this->_cleanObjectDatas($this->invoice); } /**