diff options
| author | hartmut <noreply@maennchen1.de> | 2016-10-21 14:14:00 +0000 |
|---|---|---|
| committer | hartmut <noreply@maennchen1.de> | 2016-10-21 14:14:00 +0000 |
| commit | ad164f505a7bd14de7a7d177a8be256499974c09 (patch) | |
| tree | d942e84a53752041f8d59ca68e97ae871adaf68a /views/mods/mod_autodebit/paymenthint.phtml | |
| parent | 1f48113a90c745e51778d7c8801ca138f4661edb (diff) | |
Shop4 Korrekturen
git-svn-id: https://[internal]/wordpress/plugins/wpsg4@5866 0d5edaf7-2b12-4e95-93f4-047927463d4b
Diffstat (limited to 'views/mods/mod_autodebit/paymenthint.phtml')
| -rw-r--r-- | views/mods/mod_autodebit/paymenthint.phtml | 65 |
1 files changed, 63 insertions, 2 deletions
diff --git a/views/mods/mod_autodebit/paymenthint.phtml b/views/mods/mod_autodebit/paymenthint.phtml index 93de573..6f17260 100644 --- a/views/mods/mod_autodebit/paymenthint.phtml +++ b/views/mods/mod_autodebit/paymenthint.phtml @@ -38,7 +38,7 @@ <div class="wpsg_mod_autodebit_iban wpsg_mod_autodebit_field">
<label>
<?php echo __('IBAN', 'wpsg'); ?><span class="wpsg_required">*</span>:
- <input class="<?php echo ((in_array("mod_autodebit_iban", (array)$this->view['error']))?'wpsg_error':''); ?>" type="text" name="wpsg_mod_autodebit[iban]" value="<?php echo wpsg_hspc($this->view['wpsg_mod_autodebit']['iban']); ?>" />
+ <input class="<?php echo ((in_array("mod_autodebit_iban", (array)$this->view['error']))?'wpsg_error':''); ?>" type="text" name="wpsg_mod_autodebit[iban]" id="wpsg_mod_autodebit_iban" value="<?php echo wpsg_hspc($this->view['wpsg_mod_autodebit']['iban']); ?>" />
</label>
</div>
<div class="wpsg_clear"></div>
@@ -64,4 +64,65 @@ <?php echo wpsg_translate(__('Mit #1# gekennzeichnete Felder sind Pflichtfelder.', 'wpsg'), '<span class="wpsg_required">*</span>'); ?>
</div>
-</div>
\ No newline at end of file +</div>
+
+<script>
+
+//id="wpsg_mod_autodebit_iban"
+jQuery("#wpsg_mod_autodebit_iban").on("input", function () {
+ var
+ iban,
+ a1,
+ bb = true,
+ sum = 0,
+ csum,
+ i;
+
+ //alert("oninput");
+ iban = jQuery('#wpsg_mod_autodebit_iban').val();
+ iban = iban.replace(/ /g, "");
+ // 2 + 2 + 8 + 10
+ // DE 22 Zeichen
+ // AT 20 Zeichen
+ // CH 21 Zeichen
+ // Ersetze alle Buchstaben durch Zahlen, wobei A = 10, B = 11, …, Z = 35.
+ // Berechne den ganzzahligen Rest, der bei Division durch 97 bleibt.
+ // Subtrahiere den Rest von 98, das Ergebnis sind die beiden Prüfziffern.
+ // Falls das Ergebnis einstellig ist, wird es mit einer führenden Null ergänzt.
+ // DE80500105175408332501 --> 500105175408332501DE80 --> 500105175408332501131480
+ // Zahl modulo 97 muss 1 ergeben
+
+ if (iban.length < 16) { return; }
+
+ sum = iban.substr(4);
+
+ a1 = parseInt(iban.charCodeAt(0, 1) - 64, 10) + 9;
+ sum = sum + a1.toString();
+ a1 = parseInt(iban.charCodeAt(1, 1) - 64, 10) + 9;
+ sum = sum + a1.toString();
+ sum = sum + iban.substr(2, 2);
+
+ //sum = sum % 97;
+ // Calculate checksum
+ csum = parseInt(sum.substr(0, 1), 10);
+ for (i = 1; i < sum.length; i++) {
+ csum = csum * 10;
+ csum = csum + parseInt(sum.substr(i, 1), 10);
+ csum = csum % 97;
+ }
+
+ if (csum !== 1) { bb = false; }
+
+ jQuery('#wpsg_mod_autodebit_iban').removeClass('wpsg_error');
+ if (bb === false) {
+ //alert('IBAN fehlerhaft');
+ jQuery('#wpsg_mod_autodebit_iban').addClass('wpsg_error');
+ }
+
+});
+
+
+
+
+
+</script>
|
