Forgot to modify checkSwiftForAccount and checkIbanForAccount

This commit is contained in:
David Pareja Rodriguez 2023-08-11 14:11:49 +02:00 committed by Laurent Destailleur
parent ad140ea4bc
commit f471bbae20

View file

@ -276,9 +276,13 @@ function various_payment_prepare_head($object)
* @param Account $account A bank account
* @return boolean True if informations are valid, false otherwise
*/
function checkSwiftForAccount($account)
function checkSwiftForAccount(Account $account = null, $swift = null)
{
$swift = $account->bic;
if ($account == null && $swift == null) {
return false;
} else {
$swift = $account->bic;
}
if (preg_match("/^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$/", $swift)) {
return true;
} else {
@ -292,12 +296,15 @@ function checkSwiftForAccount($account)
* @param Account $account A bank account
* @return boolean True if informations are valid, false otherwise
*/
function checkIbanForAccount(Account $account)
function checkIbanForAccount(Account $account = null, $ibantocheck = null)
{
if ($account == null && $ibantocheck == null) {
return false;
} else {
$ibantocheck = ($account->iban ? $account->iban : $account->iban_prefix); // iban or iban_prefix for backward compatibility
}
require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php';
$ibantocheck = ($account->iban ? $account->iban : $account->iban_prefix); // iban or iban_prefix for backward compatibility
$iban = new PHP_IBAN\IBAN($ibantocheck);
$check = $iban->Verify();