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 <mikael@expevelidv751.expertinet.net>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
mikygee 2024-10-23 23:52:08 +02:00 committed by GitHub
parent 12ca029fb0
commit d55f90b460
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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