From d55f90b460e8488facf9bb286574937de3dd180b Mon Sep 17 00:00:00 2001 From: mikygee Date: Wed, 23 Oct 2024 23:52:08 +0200 Subject: [PATCH] Bug fix #31369 date_solde not taken into account when sent through API (#31490) * Bug fix #31369 date_solde not taken into account when sent through API * Move $account->date_solde = time() above --------- Co-authored-by: mikael Co-authored-by: Laurent Destailleur --- htdocs/compta/bank/class/api_bankaccounts.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 663eef6f6f3..1726f6395a7 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -159,6 +159,8 @@ class BankAccounts extends DolibarrApi $result = $this->_validate($request_data); $account = new Account($this->db); + // Date of the initial balance (required to create an account). + $account->date_solde = time(); foreach ($request_data as $field => $value) { if ($field === 'caller') { // Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller @@ -168,8 +170,6 @@ class BankAccounts extends DolibarrApi $account->$field = $this->_checkValForAPI($field, $value, $account); } - // Date of the initial balance (required to create an account). - $account->date_solde = time(); // courant and type are the same thing but the one used when // creating an account is courant $account->courant = $account->type; // deprecated