From a0313fdc52e6738d84938ecbd8f0f1270f899d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Sat, 19 Sep 2020 22:39:39 +0200 Subject: [PATCH] Update api_invoices.class.php --- htdocs/compta/facture/class/api_invoices.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 7b19e95a974..ab712a5f854 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -477,8 +477,9 @@ class Invoices extends DolibarrApi * * @param int $id Id of invoice to update * @param int $rowid Row key of the contact in the array contact_ids. + * @param string $type Type of the contact (BILLING, SHIPPING, CUSTOMER). * - * @url DELETE {id}/contact/{rowid} + * @url DELETE {id}/contact/{rowid}/{type} * * @return array * @@ -486,7 +487,7 @@ class Invoices extends DolibarrApi * @throws RestException 404 * @throws RestException 500 */ - public function deleteContact($id, $rowid) + public function deleteContact($id, $rowid, $type) { if (!DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); @@ -505,7 +506,7 @@ class Invoices extends DolibarrApi $contacts = $this->invoice->liste_contact(); foreach ($contacts as $contact) { - if ($contact['id'] == $rowid) { + if ($contact['id'] == $rowid && $contact['code'] == $type) { $result = $this->invoice->delete_contact($contact['rowid']); if (!$result) {