From a3f40667900da18679bd44dacaae88456e6c044b Mon Sep 17 00:00:00 2001 From: Neil Orley Date: Tue, 19 Dec 2017 14:14:26 +0100 Subject: [PATCH] NEW Update bank account when updating an invoice Add the ability to update the bankaccount when updating an invoice --- htdocs/compta/facture/class/api_invoices.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 34935c3088a..1e0392bf452 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -422,6 +422,15 @@ class Invoices extends DolibarrApi $this->invoice->$field = $value; } + // update bank account + if(!empty($this->invoice->fk_account)) + { + if($this->invoice->setBankAccount($this->invoice->fk_account) == 0) + { + throw new RestException(400,$this->invoice->error); + } + } + if($this->invoice->update($id, DolibarrApiAccess::$user)) return $this->get ($id);