iban human readable

This commit is contained in:
Frédéric FRANCE 2022-08-19 17:21:00 +02:00
parent 183b205c32
commit 6923bd9c06
2 changed files with 19 additions and 1 deletions

View File

@ -758,7 +758,7 @@ if ($action == 'create') {
}
print '<tr><td>'.$langs->trans($ibankey).'</td>';
print '<td>'.$object->iban.'&nbsp;';
print '<td>'.getIbanHumanReadable($object).'&nbsp;';
if (!empty($object->iban)) {
if (!checkIbanForAccount($object)) {
print img_picto($langs->trans("IbanNotValid"), 'warning');

View File

@ -290,6 +290,24 @@ function checkIbanForAccount(Account $account)
}
}
/**
* Returns the iban human readable
*
* @param Account $account Account object
* @return string
*/
function getIbanHumanReadable(Account $account)
{
if ($account->getCountryCode() == 'FR') {
require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php';
$ibantoprint = preg_replace('/[^a-zA-Z0-9]/', '', $account->iban);
$iban = new PHP_IBAN\IBAN($ibantoprint);
return $iban->HumanFormat();
}
return $account->iban;
}
/**
* Check account number informations for a bank account
*