forked from Wavyzz/dolibarr
Add php-iban and check IBAN
This commit is contained in:
@@ -123,6 +123,29 @@ function bank_admin_prepare_head($object)
|
|||||||
return $head;
|
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 '<pre>'.print_r($iban, true).'</pre>';
|
||||||
|
if ($check) {
|
||||||
|
//print '<pre>OK</pre>';
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
//$suggest = $iban->MistranscriptionSuggestions($account->iban);
|
||||||
|
//print '<pre>'.print_r($suggest, true).'</pre>';
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check account number informations for a bank account
|
* Check account number informations for a bank account
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -293,7 +293,15 @@ if ($socid && $action != 'edit' && $action != "create")
|
|||||||
}
|
}
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("IBAN").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("IBAN").'</td>';
|
||||||
print '<td colspan="4">'.$account->iban.'</td></tr>';
|
print '<td colspan="4">'.$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 '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("BIC").'</td>';
|
print '<tr><td valign="top">'.$langs->trans("BIC").'</td>';
|
||||||
print '<td colspan="4">'.$account->bic.'</td></tr>';
|
print '<td colspan="4">'.$account->bic.'</td></tr>';
|
||||||
|
|||||||
Reference in New Issue
Block a user