fix: when invoice is created by WORKFLOW_ORDER_AUTOCREATE_INVOICE on ORDER_CLOSE, the invoice must have the default bank account of the thirdparty is it's empty on order (#29462)

* fix: when invoice is created by WORKFLOW_ORDER_AUTOCREATE_INVOICE on ORDER_CLOSE, the invoice must have the default bank account of the thirdparty is it's empty on order

* fix: add control on back stattement
This commit is contained in:
HENRY Florian 2024-04-27 12:49:27 +02:00 committed by GitHub
parent c29a27d79d
commit 768846191b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -116,6 +116,14 @@ class InterfaceWorkflowManager extends DolibarrTriggers
if ($ret < 0) {
$this->error = $newobject->error;
$this->errors[] = $newobject->error;
} else {
if (empty($object->fk_account) && !empty($object->thirdparty->fk_account) && !getDolGlobalInt('BANK_ASK_PAYMENT_BANK_DURING_ORDER')) {
$res = $newobject->setBankAccount($object->thirdparty->fk_account, true, $user);
if ($ret < 0) {
$this->error = $newobject->error;
$this->errors[] = $newobject->error;
}
}
}
$object->clearObjectLinkedCache();