Add BIC/SWIFT Validation
This commit is contained in:
parent
f652cf4e97
commit
4bbbff8d69
@ -256,7 +256,15 @@ if (($_GET["id"] || $_GET["ref"]) && $action != 'edit')
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans($bickey).'</td>';
|
print '<tr><td valign="top">'.$langs->trans($bickey).'</td>';
|
||||||
print '<td colspan="3">'.$account->bic.'</td></tr>';
|
print '<td colspan="3">'.$account->bic.' ';
|
||||||
|
if (! empty($account->bic)) {
|
||||||
|
if (! checkSwiftForAccount($account)) {
|
||||||
|
print img_picto($langs->trans("SwiftNotValid"),'warning');
|
||||||
|
} else {
|
||||||
|
print img_picto($langs->trans("SwiftValid"),'info');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
||||||
print nl2br($account->domiciliation);
|
print nl2br($account->domiciliation);
|
||||||
|
|||||||
@ -123,6 +123,23 @@ function bank_admin_prepare_head($object)
|
|||||||
return $head;
|
return $head;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check SWIFT informations for a bank account
|
||||||
|
*
|
||||||
|
* @param Account $account A bank account
|
||||||
|
* @return int True if informations are valid, false otherwise
|
||||||
|
*/
|
||||||
|
function checkSwiftForAccount($account)
|
||||||
|
{
|
||||||
|
$swift = $account->bic;
|
||||||
|
if (eregi("^([a-zA-Z]){4}([a-zA-Z]){2}([0-9a-zA-Z]){2}([0-9a-zA-Z]{3})?$", $swift)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check IBAN number informations for a bank account
|
* Check IBAN number informations for a bank account
|
||||||
*
|
*
|
||||||
@ -134,13 +151,9 @@ function checkIbanForAccount($account)
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php';
|
require_once DOL_DOCUMENT_ROOT.'/includes/php-iban/oophp-iban.php';
|
||||||
$iban = new Iban($account->iban);
|
$iban = new Iban($account->iban);
|
||||||
$check = $iban->Verify();
|
$check = $iban->Verify();
|
||||||
//print '<pre>'.print_r($iban, true).'</pre>';
|
|
||||||
if ($check) {
|
if ($check) {
|
||||||
//print '<pre>OK</pre>';
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
//$suggest = $iban->MistranscriptionSuggestions($account->iban);
|
|
||||||
//print '<pre>'.print_r($suggest, true).'</pre>';
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -33,9 +33,11 @@ AllTime=From start
|
|||||||
Reconciliation=Reconciliation
|
Reconciliation=Reconciliation
|
||||||
RIB=Bank Account Number
|
RIB=Bank Account Number
|
||||||
IBAN=IBAN number
|
IBAN=IBAN number
|
||||||
IbanValid=Valid IBAN
|
IbanValid=IBAN is Valid
|
||||||
IbanNotValid=Not Valid IBAN
|
IbanNotValid=IBAN is Not Valid
|
||||||
BIC=BIC/SWIFT number
|
BIC=BIC/SWIFT number
|
||||||
|
SwiftValid=BIC/SWIFT is Valid
|
||||||
|
SwiftNotValid=BIC/SWIFT is Not Valid
|
||||||
StandingOrders=Standing orders
|
StandingOrders=Standing orders
|
||||||
StandingOrder=Standing order
|
StandingOrder=Standing order
|
||||||
Withdrawals=Withdrawals
|
Withdrawals=Withdrawals
|
||||||
|
|||||||
@ -304,7 +304,15 @@ if ($socid && $action != 'edit' && $action != "create")
|
|||||||
print '</td></tr>';
|
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.' ';
|
||||||
|
if (! empty($account->bic)) {
|
||||||
|
if (! checkSwiftForAccount($account)) {
|
||||||
|
print img_picto($langs->trans("SwiftNotValid"),'warning');
|
||||||
|
} else {
|
||||||
|
print img_picto($langs->trans("SwiftValid"),'info');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
|
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="4">';
|
||||||
print $account->domiciliation;
|
print $account->domiciliation;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user