diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php
index d416b52635f..9233d397152 100644
--- a/htdocs/compta/bank/card.php
+++ b/htdocs/compta/bank/card.php
@@ -751,7 +751,7 @@ if ($action == 'create') {
}
print '
| '.$langs->trans($ibankey).' | ';
- print ''.$object->iban.' ';
+ print ' | '.getIbanHumanReadable($object).' ';
if (!empty($object->iban)) {
if (!checkIbanForAccount($object)) {
print img_picto($langs->trans("IbanNotValid"), 'warning');
diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php
index 4c728adbfc8..b42ef184c8f 100644
--- a/htdocs/compta/bank/class/account.class.php
+++ b/htdocs/compta/bank/class/account.class.php
@@ -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).' '.$langs->trans("BankAccount").'';
@@ -1389,7 +1390,7 @@ class Account extends CommonObject
}
$label .= ' '.$langs->trans('Label').': '.$this->label;
$label .= ' '.$langs->trans('AccountNumber').': '.$this->number;
- $label .= ' '.$langs->trans('IBAN').': '.$this->iban;
+ $label .= ' '.$langs->trans('IBAN').': '.getIbanHumanReadable($this);
$label .= ' '.$langs->trans('BIC').': '.$this->bic;
$label .= ' '.$langs->trans("AccountCurrency").': '.$this->currency_code;
diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php
index a19c6e44a92..5dde1bc4360 100644
--- a/htdocs/core/lib/bank.lib.php
+++ b/htdocs/core/lib/bank.lib.php
@@ -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
*
|