diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index c2745b31426..5a484e9e97c 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -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)) { diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 3f00a4f0660..1049ce4cf1a 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -449,9 +449,17 @@ if ($resql) { // RIB print ''; - 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 '';