Subversion Repositories wpShopGermany4

Rev

Rev 5261 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5261 Rev 5866
Line 36... Line 36...
36
	
36
	
37
	<?php if ($this->get_option('wpsg_mod_autodebit_iban') == '1') { ?>
37
	<?php if ($this->get_option('wpsg_mod_autodebit_iban') == '1') { ?>
38
	<div class="wpsg_mod_autodebit_iban wpsg_mod_autodebit_field">
38
	<div class="wpsg_mod_autodebit_iban wpsg_mod_autodebit_field">
39
		<label>
39
		<label>
40
			<?php echo __('IBAN', 'wpsg'); ?><span class="wpsg_required">*</span>:
40
			<?php echo __('IBAN', 'wpsg'); ?><span class="wpsg_required">*</span>:
41
			<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']); ?>" />
41
			<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']); ?>" />
42
		</label>
42
		</label>
43
	</div>
43
	</div>
44
	<div class="wpsg_clear"></div>
44
	<div class="wpsg_clear"></div>
45
	<?php } else { ?>
45
	<?php } else { ?>
46
	<div class="wpsg_mod_autodebit_knr wpsg_mod_autodebit_field">
46
	<div class="wpsg_mod_autodebit_knr wpsg_mod_autodebit_field">
Line 62... Line 62...
62
	
62
	
63
	<div class="wpsg_mandatoryfield_hint">
63
	<div class="wpsg_mandatoryfield_hint">
64
		<?php echo wpsg_translate(__('Mit #1# gekennzeichnete Felder sind Pflichtfelder.', 'wpsg'), '<span class="wpsg_required">*</span>'); ?>
64
		<?php echo wpsg_translate(__('Mit #1# gekennzeichnete Felder sind Pflichtfelder.', 'wpsg'), '<span class="wpsg_required">*</span>'); ?>
65
	</div>
65
	</div>
66
	
66
	
67
</div>
-
 
68
67
</div>
-
 
68
 
-
 
69
<script>
-
 
70
 
-
 
71
//id="wpsg_mod_autodebit_iban"
-
 
72
jQuery("#wpsg_mod_autodebit_iban").on("input", function () {
-
 
73
	var
-
 
74
		iban,
-
 
75
		a1,
-
 
76
		bb = true,
-
 
77
		sum = 0,
-
 
78
		csum,
-
 
79
		i;
-
 
80
 
-
 
81
	//alert("oninput");
-
 
82
	iban = jQuery('#wpsg_mod_autodebit_iban').val();
-
 
83
	iban = iban.replace(/ /g, "");
-
 
84
	// 2 + 2 + 8 + 10
-
 
85
	// DE 22 Zeichen
-
 
86
	// AT 20 Zeichen
-
 
87
	// CH 21 Zeichen
-
 
88
	// Ersetze alle Buchstaben durch Zahlen, wobei A = 10, B = 11, …, Z = 35.
-
 
89
    // Berechne den ganzzahligen Rest, der bei Division durch 97 bleibt.
-
 
90
    // Subtrahiere den Rest von 98, das Ergebnis sind die beiden Prüfziffern. 
-
 
91
    // Falls das Ergebnis einstellig ist, wird es mit einer führenden Null ergänzt.
-
 
92
	// DE80500105175408332501 --> 500105175408332501DE80 --> 500105175408332501131480
-
 
93
	// Zahl modulo 97 muss 1 ergeben
-
 
94
 
-
 
95
	if (iban.length < 16) { return; }
-
 
96
 
-
 
97
	sum = iban.substr(4);
-
 
98
 
-
 
99
	a1 = parseInt(iban.charCodeAt(0, 1) - 64, 10) + 9;
-
 
100
	sum = sum + a1.toString();
-
 
101
	a1 = parseInt(iban.charCodeAt(1, 1) - 64, 10) + 9;
-
 
102
	sum = sum + a1.toString();
-
 
103
	sum = sum + iban.substr(2, 2);
-
 
104
	
-
 
105
	//sum = sum % 97;
-
 
106
    // Calculate checksum
-
 
107
    csum = parseInt(sum.substr(0, 1), 10);
-
 
108
    for (i = 1; i < sum.length; i++) {
-
 
109
        csum = csum * 10;
-
 
110
        csum = csum + parseInt(sum.substr(i, 1), 10);
-
 
111
        csum = csum % 97;
-
 
112
    }
-
 
113
	
-
 
114
	if (csum !== 1) { bb = false; }
-
 
115
 
-
 
116
	jQuery('#wpsg_mod_autodebit_iban').removeClass('wpsg_error');
-
 
117
	if (bb === false) {
-
 
118
		//alert('IBAN fehlerhaft');
-
 
119
		jQuery('#wpsg_mod_autodebit_iban').addClass('wpsg_error');
-
 
120
	}
-
 
121
 
-
 
122
});
-
 
123
 
-
 
124
 
-
 
125
 
-
 
126
 
-
 
127
 
-
 
128
</script>
-
 
129