Fix error was not propagated correctly

This commit is contained in:
Laurent Destailleur 2023-02-02 20:53:07 +01:00
parent 1be5145148
commit e9c43718ba
2 changed files with 5 additions and 2 deletions

View File

@ -1070,7 +1070,7 @@ class Account extends CommonObject
return 0;
}
} else {
$this->error = $this->db->lasterror;
$this->error = $this->db->lasterror();
$this->errors[] = $this->error;
return -1;
}

View File

@ -643,6 +643,8 @@ class Paiement extends CommonObject
$acc = new Account($this->db);
$result = $acc->fetch($this->fk_account);
if ($result < 0) {
$this->error = $acc->error;
$this->errors = $acc->errors;
$error++;
return -1;
}
@ -768,7 +770,7 @@ class Paiement extends CommonObject
}
// Add link 'InvoiceRefused' in bank_url
if (! $error && $label == '(InvoiceRefused)') {
if (!$error && $label == '(InvoiceRefused)') {
$result=$acc->add_url_line(
$bank_line_id,
$this->id_prelevement,
@ -788,6 +790,7 @@ class Paiement extends CommonObject
}
} else {
$this->error = $acc->error;
$this->errors = $acc->errors;
$error++;
}