fix delete in paymentvat.class.php (#39323)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Frédéric FRANCE 2026-07-30 17:35:24 +02:00 committed by GitHub
parent 8739e98012
commit cdc6063405
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -458,11 +458,13 @@ class PaymentVAT extends CommonObject
if ($this->bank_line > 0) {
$accline = new AccountLine($this->db);
$accline->fetch($this->bank_line);
$result = $accline->delete($user);
if ($result < 0) {
$this->errors[] = $accline->error;
$error++;
$result = $accline->fetch($this->bank_line);
if ($result > 0) {
$result = $accline->delete($user); // $result may be 0 if not found (when bank entry was deleted manually and fk_bank point to nothing)
if ($result < 0) {
$this->errors[] = $accline->error;
$error++;
}
}
}