diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index e3fb787657b..77b92447d3f 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -123,6 +123,29 @@ function bank_admin_prepare_head($object) return $head; } +/** + * Check IBAN number informations for a bank account + * + * @param Account $account A bank account + * @return int True if informations are valid, false otherwise + */ +function checkIbanForAccount($account) +{ + require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php'; + $iban = new Iban(); + $check = $iban->Verify($account->iban); + //print '
'.print_r($iban, true).'
'; + if ($check) { + //print '
OK
'; + return true; + } else { + //$suggest = $iban->MistranscriptionSuggestions($account->iban); + //print '
'.print_r($suggest, true).'
'; + return false; + } + +} + /** * Check account number informations for a bank account * diff --git a/htdocs/societe/rib.php b/htdocs/societe/rib.php index f57eb6a5b70..a615577a8c4 100644 --- a/htdocs/societe/rib.php +++ b/htdocs/societe/rib.php @@ -293,7 +293,15 @@ if ($socid && $action != 'edit' && $action != "create") } print ''.$langs->trans("IBAN").''; - print ''.$account->iban.''; + print ''.$account->iban . ' '; + if (! empty($account->iban)) { + if (! checkIbanForAccount($account)) { + print img_picto($langs->trans("NotValid"),'warning'); + } else { + print img_picto($langs->trans("IsValid"),'info'); + } + } + print ''; print ''.$langs->trans("BIC").''; print ''.$account->bic.'';