Merge pull request #21803 from frederic34/ibanForHuman
iban human readable
This commit is contained in:
commit
88e66ab39a
@ -751,7 +751,7 @@ if ($action == 'create') {
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans($ibankey).'</td>';
|
||||
print '<td>'.$object->iban.' ';
|
||||
print '<td>'.getIbanHumanReadable($object).' ';
|
||||
if (!empty($object->iban)) {
|
||||
if (!checkIbanForAccount($object)) {
|
||||
print img_picto($langs->trans("IbanNotValid"), 'warning');
|
||||
|
||||
@ -1381,6 +1381,7 @@ class Account extends CommonObject
|
||||
public function getNomUrl($withpicto = 0, $mode = '', $option = '', $save_lastsearch_value = -1, $notooltip = 0)
|
||||
{
|
||||
global $conf, $langs, $user;
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
|
||||
$result = '';
|
||||
$label = img_picto('', $this->picto).' <u class="paddingrightnow">'.$langs->trans("BankAccount").'</u>';
|
||||
@ -1389,7 +1390,7 @@ class Account extends CommonObject
|
||||
}
|
||||
$label .= '<br><b>'.$langs->trans('Label').':</b> '.$this->label;
|
||||
$label .= '<br><b>'.$langs->trans('AccountNumber').':</b> '.$this->number;
|
||||
$label .= '<br><b>'.$langs->trans('IBAN').':</b> '.$this->iban;
|
||||
$label .= '<br><b>'.$langs->trans('IBAN').':</b> '.getIbanHumanReadable($this);
|
||||
$label .= '<br><b>'.$langs->trans('BIC').':</b> '.$this->bic;
|
||||
$label .= '<br><b>'.$langs->trans("AccountCurrency").':</b> '.$this->currency_code;
|
||||
|
||||
|
||||
@ -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
|
||||
*
|
||||
|
||||
Loading…
Reference in New Issue
Block a user