Merge branch 'feature/better-iban-view' into 'master'
Added Spaces to IBAN for IBAN View in Address View and Form.php See merge request fronk/thetool!325
This commit is contained in:
@@ -571,26 +571,68 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* link autocomplete
|
||||
*/
|
||||
|
||||
$('.link-autocomplete').autoComplete();
|
||||
$('.link-autocomplete').keydown(function() {
|
||||
if(event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
// Format IBAN with Spaces
|
||||
function formatIBAN(input) {
|
||||
let iban = input.value.replace(/\s/g, '');
|
||||
|
||||
let formattedIBAN = '';
|
||||
for (let i = 0; i < iban.length; i++) {
|
||||
if (i > 0 && i % 4 === 0) {
|
||||
formattedIBAN += ' ';
|
||||
}
|
||||
formattedIBAN += iban[i];
|
||||
}
|
||||
|
||||
input.value = formattedIBAN;
|
||||
}
|
||||
|
||||
$("#bank_account_iban").on("input", function () {
|
||||
formatIBAN(this);
|
||||
});
|
||||
formatIBAN(document.getElementById('bank_account_iban'));
|
||||
|
||||
|
||||
$('#addressForm').submit(function (e) {
|
||||
$("#error").hide();
|
||||
$("#bank-error").hide();
|
||||
|
||||
if ($('#billing_type').val() == "sepa") {
|
||||
console.log("bankdata_valid (1): " + bankdata_valid);
|
||||
if (bankdata_valid) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!validateIbanFormat($("#bank_account_iban").val().replace(/\s/g, ''))) {
|
||||
$("#error").show();
|
||||
console.log("nope");
|
||||
}
|
||||
|
||||
console.log("bankdata_valid: " + bankdata_valid);
|
||||
if ($("#bank_account_iban").val().replace(/\s/g, '') != "<?=$address->bank_account_iban?>" || $("#bank_account_bic").val() != "<?=$address->bank_account_bic?>") {
|
||||
validateIbanBic($("#bank_account_iban").val().replace(/\s/g, ''), $("#bank_account_bic").val());
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
$("#bank_account_iban").val($("#bank_account_iban").val().replace(/\s/g, ''));
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/*
|
||||
* link autocomplete
|
||||
*/
|
||||
|
||||
$('.link-autocomplete').autoComplete();
|
||||
$('.link-autocomplete').keydown(function () {
|
||||
if (event.keyCode == 13) {
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* Links autocomplete
|
||||
|
||||
@@ -112,7 +112,13 @@
|
||||
<td><?=$address->bank_account_owner?></td>
|
||||
</tr><tr>
|
||||
<th>IBAN</th>
|
||||
<td><?=$address->bank_account_iban?></td>
|
||||
<td><?php
|
||||
$iban = $address->bank_account_iban;
|
||||
$iban = preg_replace('/\s+/', '', $iban);
|
||||
$iban = chunk_split($iban, 4, ' ');
|
||||
$iban = trim($iban);
|
||||
echo $iban;
|
||||
?></td>
|
||||
</tr><tr>
|
||||
<th>BIC</th>
|
||||
<td><?=$address->bank_account_bic?></td>
|
||||
|
||||
Reference in New Issue
Block a user