Subversion Repositories wpShopGermany4

Rev

Rev 5261 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1502 daniel 1
<?php
2
 
3
	/**
4
	 * Template für die Integration der Kundeneingaben für das Modul "Bankeinzug" in den Checkout2
5
	 */
6
 
7
?>
8
<br /><br />
9
<div class="wpsg_mod_autodebit">
3429 daniel 10
 
11
	<div class="wpsg_mod_autodebit_inhaber wpsg_mod_autodebit_field">
1502 daniel 12
		<label>
3429 daniel 13
			<?php echo __('Inhaber', 'wpsg'); ?><span class="wpsg_required">*</span>:
14
			<input class="<?php echo ((in_array("mod_autodebit_inhaber", (array)$this->view['error']))?'wpsg_error':''); ?>" type="text" name="wpsg_mod_autodebit[inhaber]" value="<?php echo wpsg_hspc($this->view['wpsg_mod_autodebit']['inhaber']); ?>" />
1502 daniel 15
		</label>
16
	</div>
17
	<div class="wpsg_clear"></div>
3429 daniel 18
 
19
	<?php if ($this->get_option('wpsg_mod_autodebit_iban') == '1') { ?>
20
	<div class="wpsg_mod_autodebit_bic wpsg_mod_autodebit_field">
1502 daniel 21
		<label>
3429 daniel 22
			<?php echo __('BIC', 'wpsg'); ?><span class="wpsg_required">*</span>:
23
			<input class="<?php echo ((in_array("mod_autodebit_bic", (array)$this->view['error']))?'wpsg_error':''); ?>" type="text" name="wpsg_mod_autodebit[bic]" value="<?php echo wpsg_hspc($this->view['wpsg_mod_autodebit']['bic']); ?>" />
1502 daniel 24
		</label>
25
	</div>
26
	<div class="wpsg_clear"></div>
3429 daniel 27
	<?php } else { ?>
28
	<div class="wpsg_mod_autodebit_blz wpsg_mod_autodebit_field">
3344 daniel 29
		<label>
3429 daniel 30
			<?php echo __('Bankleitzahl', 'wpsg'); ?><span class="wpsg_required">*</span>:
31
			<input class="<?php echo ((in_array("mod_autodebit_blz", (array)$this->view['error']))?'wpsg_error':''); ?>" type="text" name="wpsg_mod_autodebit[blz]" value="<?php echo wpsg_hspc($this->view['wpsg_mod_autodebit']['blz']); ?>" />
3344 daniel 32
		</label>
33
	</div>
34
	<div class="wpsg_clear"></div>
3429 daniel 35
	<?php } ?>
36
 
37
	<?php if ($this->get_option('wpsg_mod_autodebit_iban') == '1') { ?>
38
	<div class="wpsg_mod_autodebit_iban wpsg_mod_autodebit_field">
1502 daniel 39
		<label>
3429 daniel 40
			<?php echo __('IBAN', 'wpsg'); ?><span class="wpsg_required">*</span>:
5866 hartmut 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']); ?>" />
1502 daniel 42
		</label>
43
	</div>
44
	<div class="wpsg_clear"></div>
3429 daniel 45
	<?php } else { ?>
1502 daniel 46
	<div class="wpsg_mod_autodebit_knr wpsg_mod_autodebit_field">
47
		<label>
48
			<?php echo __('Kontonummer', 'wpsg'); ?><span class="wpsg_required">*</span>:
49
			<input class="<?php echo ((in_array("mod_autodebit_knr", (array)$this->view['error']))?'wpsg_error':''); ?>" type="text" name="wpsg_mod_autodebit[knr]" value="<?php echo wpsg_hspc($this->view['wpsg_mod_autodebit']['knr']); ?>" />
50
		</label>
51
	</div>
52
	<div class="wpsg_clear"></div>
3429 daniel 53
	<?php } ?>
54
 
55
	<div class="wpsg_mod_autodebit_name wpsg_mod_autodebit_field">
3344 daniel 56
		<label>
3429 daniel 57
			<?php echo __('Name der Bank', 'wpsg'); ?><span class="wpsg_required">*</span>:
58
			<input class="<?php echo ((in_array("mod_autodebit_name", (array)$this->view['error']))?'wpsg_error':''); ?>" type="text" name="wpsg_mod_autodebit[name]" value="<?php echo wpsg_hspc($this->view['wpsg_mod_autodebit']['name']); ?>" />
3344 daniel 59
		</label>
60
	</div>
61
	<div class="wpsg_clear"></div>
2780 daniel 62
 
63
	<div class="wpsg_mandatoryfield_hint">
64
		<?php echo wpsg_translate(__('Mit #1# gekennzeichnete Felder sind Pflichtfelder.', 'wpsg'), '<span class="wpsg_required">*</span>'); ?>
65
	</div>
66
 
5866 hartmut 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>