From f471bbae202e07f63896c35a555dcd2d1cf78778 Mon Sep 17 00:00:00 2001 From: David Pareja Rodriguez Date: Fri, 11 Aug 2023 14:11:49 +0200 Subject: [PATCH] Forgot to modify checkSwiftForAccount and checkIbanForAccount --- htdocs/core/lib/bank.lib.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 72f015197ba..f4c5c709cd3 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -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();