Fix error message on IBAN/BIC validation

This commit is contained in:
Laurent Destailleur 2022-04-06 16:15:34 +02:00
parent 0b8f4489c8
commit 5a8d5618f2
2 changed files with 17 additions and 5 deletions

View File

@ -1441,9 +1441,13 @@ class Account extends CommonObject
// Call function to check BAN
if (!checkIbanForAccount($this) || !checkSwiftForAccount($this)) {
if (!checkIbanForAccount($this)) {
$this->error_number = 12;
$this->error_message = 'IBANSWIFTControlError';
$this->error_message = 'IBANNotValid';
}
if (!checkSwiftForAccount($this)) {
$this->error_number = 12;
$this->error_message = 'SwiftNotValid';
}
/*if (! checkBanForAccount($this))
{

View File

@ -449,9 +449,17 @@ if ($resql) {
// RIB
print '<td>';
print $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
if ($bac->verif() <= 0) {
print img_warning('Error on default bank number for IBAN : '.$bac->error_message);
if ($bac->id > 0) {
if (!empty($bac->iban) || !empty($bac->bic)) {
print $bac->iban.(($bac->iban && $bac->bic) ? ' / ' : '').$bac->bic;
if ($bac->verif() <= 0) {
print img_warning('Error on default bank number for IBAN : '.$langs->trans($bac->error_message));
}
} else {
print img_warning($langs->trans("IBANNotDefined"));
}
} else {
print img_warning($langs->trans("NoBankAccountDefined"));
}
print '</td>';