line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::DE::KontoCheck; |
2
|
|
|
|
|
|
|
require 5.00503; |
3
|
|
|
|
|
|
|
$VERSION = '0.12'; |
4
|
1
|
|
|
1
|
|
51620
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
6
|
1
|
|
|
1
|
|
6
|
use Cwd; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
67
|
|
7
|
1
|
|
|
1
|
|
7
|
use Carp qw(carp croak); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
57
|
|
8
|
1
|
|
|
1
|
|
444
|
use Business::DE::Konto qw(:errorcodes); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
157
|
|
9
|
1
|
|
|
1
|
|
7
|
use vars qw($cache $CACHE_ON $CACHE_ALL $STORABLE); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9020
|
|
10
|
|
|
|
|
|
|
$CACHE_ALL = 0; |
11
|
|
|
|
|
|
|
$CACHE_ON = 1; |
12
|
|
|
|
|
|
|
#use Data::Dumper; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $check_code = { |
15
|
|
|
|
|
|
|
# METHODE, MODULO, [GEWICHTUNGEN], PRUEFZIFFER-STELLE, FALLBACKMWTHODE |
16
|
|
|
|
|
|
|
"00" => ["QUER", 10,[2, 1, 2, 1, 2, 1, 2, 1, 2], 10, "00"], |
17
|
|
|
|
|
|
|
"01" => ["NORMAL",10,[3, 7, 1, 3, 7, 1, 3, 7, 1], 10, "01"], |
18
|
|
|
|
|
|
|
"02" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 8, 9, 2], 10, "02"], |
19
|
|
|
|
|
|
|
"03" => ["NORMAL",10,[2, 1, 2, 1, 2, 1, 2, 1, 2], 10, "01"], |
20
|
|
|
|
|
|
|
"04" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 2, 3, 4], 10, "02"], |
21
|
|
|
|
|
|
|
"05" => ["NORMAL",10,[7, 3, 1, 7, 3, 1, 7, 3, 1], 10, "01"], |
22
|
|
|
|
|
|
|
"06" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 2, 3, 4], 10, "06"], |
23
|
|
|
|
|
|
|
"07" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 8, 9, 10],10, "02"], |
24
|
|
|
|
|
|
|
"08" => ["QUER", 10,[2, 1, 2, 1, 2, 1, 2, 1, 2], 10, "08"], |
25
|
|
|
|
|
|
|
"09" => ["NORMAL",11,[2, 1, 2, 1, 2, 1, 2, 1, 2], 10, "09"], |
26
|
|
|
|
|
|
|
"10" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 8, 9, 10],10, "06"], |
27
|
|
|
|
|
|
|
"11" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 8, 9, 10],10, "11"], |
28
|
|
|
|
|
|
|
"12" => ["NORMAL",10,[1, 3, 7, 1, 3, 7, 1, 3, 7], 10, "01"], |
29
|
|
|
|
|
|
|
"13" => ["QUER", 10,[0, 0, 2, 1, 2, 1, 2, 1, 0], 8, "13"],# bugfix 12.09.02 |
30
|
|
|
|
|
|
|
"14" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 2, 3, 4], 10, "14"], |
31
|
|
|
|
|
|
|
"15" => ["NORMAL",11,[2, 3, 4, 5, 2, 3, 4, 5, 2], 10, "06"], |
32
|
|
|
|
|
|
|
"16" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 2, 3, 4], 10, "16"], |
33
|
|
|
|
|
|
|
"17" => ["NORMAL",11,[1, 2, 1, 2, 1, 2, 1, 2, 1], 8, "17"], |
34
|
|
|
|
|
|
|
"18" => ["NORMAL",10,[3, 9, 7, 1, 3, 9, 7, 1, 3], 10, "01"], |
35
|
|
|
|
|
|
|
"19" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 8, 9, 1], 10, "06"], |
36
|
|
|
|
|
|
|
"20" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 8, 9, 3], 10, "06"], |
37
|
|
|
|
|
|
|
"21" => ["QUER", 10,[2, 1, 2, 1, 2, 1, 2, 1, 2], 10, "21"], |
38
|
|
|
|
|
|
|
"22" => ["ONES", 10,[3, 1, 3, 1, 3, 1, 3, 1, 3], 10, "00"], |
39
|
|
|
|
|
|
|
"23" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 2, 3, 4], 7, "16"], |
40
|
|
|
|
|
|
|
"24" => ["NORMAL",11,[1, 2, 3, 1, 2, 3, 1, 2, 3], 10, "24"], |
41
|
|
|
|
|
|
|
"25" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 8, 9, 0], 10, "25"], |
42
|
|
|
|
|
|
|
"26" => ["NORMAL",11,[0, 0, 2, 3, 4, 5, 6, 7, 2], 10, "06"], |
43
|
|
|
|
|
|
|
"27" => ["QUER", 10,[2, 1, 2, 1, 2, 1, 2, 1, 2], 10, "00"], |
44
|
|
|
|
|
|
|
"28" => ["NORMAL",11,[0, 0, 2, 3, 4, 5, 6, 7, 8], 8, "06"], |
45
|
|
|
|
|
|
|
"29" => ["QUER", 10,[2, 1, 2, 1, 2, 1, 2, 1, 2], 10, "27"], |
46
|
|
|
|
|
|
|
"30" => ["NORMAL",10,[2, 0, 0, 0, 0, 1, 2, 1, 2], 10, "00"], |
47
|
|
|
|
|
|
|
"31" => ["NORMAL",11,[9, 8, 7, 6, 5, 4, 3, 2, 1], 10, "31"], |
48
|
|
|
|
|
|
|
"32" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 0, 0, 0], 10, "06"], |
49
|
|
|
|
|
|
|
"33" => ["NORMAL",11,[2, 3, 4, 5, 6, 0, 0, 0, 0], 10, "06"], |
50
|
|
|
|
|
|
|
"34" => ["NORMAL",11,[0, 0, 2, 4, 8, 5,10, 9, 7], 8, "06"], |
51
|
|
|
|
|
|
|
"35" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 8, 9,10], 10, "35"], |
52
|
|
|
|
|
|
|
"36" => ["NORMAL",11,[2, 4, 8, 5, 0, 0, 0, 0, 0], 10, "06"], |
53
|
|
|
|
|
|
|
"37" => ["NORMAL",11,[2, 4, 8, 5,10, 0, 0, 0, 0], 10, "06"], |
54
|
|
|
|
|
|
|
"38" => ["NORMAL",11,[2, 4, 8, 5,10, 9, 0, 0, 0], 10, "06"], |
55
|
|
|
|
|
|
|
"39" => ["NORMAL",11,[2, 4, 8, 5,10, 9, 7, 0, 0], 10, "06"], |
56
|
|
|
|
|
|
|
"40" => ["NORMAL",11,[2, 4, 8, 5,10, 9, 7, 3, 6], 10, "06"], |
57
|
|
|
|
|
|
|
"41" => ["QUER", 10,[2, 1, 2, 1, 2, 1, 2, 1, 2], 10, "00"], |
58
|
|
|
|
|
|
|
"42" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 8, 9, 0], 10, "06"], |
59
|
|
|
|
|
|
|
"43" => ["NORMAL",10,[1, 2, 3, 4, 5, 6, 7, 8, 9], 10, "01"], |
60
|
|
|
|
|
|
|
"44" => ["NORMAL",11,[2, 4, 8, 5,10, 0, 0, 0, 0], 10, "06"], |
61
|
|
|
|
|
|
|
"45" => ["QUER", 10,[2, 1, 2, 1, 2, 1, 2, 1, 2], 10, "00"], |
62
|
|
|
|
|
|
|
"46" => ["NORMAL",11,[0, 0, 2, 3, 4, 5, 6, 0, 0], 8, "06"], |
63
|
|
|
|
|
|
|
"47" => ["NORMAL",11,[0, 2, 3, 4, 5, 6, 0, 0, 0], 9, "06"], |
64
|
|
|
|
|
|
|
"48" => ["NORMAL",11,[0, 2, 3, 4, 5, 6, 7, 0, 0], 9, "06"], |
65
|
|
|
|
|
|
|
"49" => ["QUER", 10,[2, 1, 2, 1, 2, 1, 2, 1, 2], 10, "00"], |
66
|
|
|
|
|
|
|
"50" => ["NORMAL",11,[0, 0, 0, 2, 3, 4, 5, 6, 7], 7, "06"], |
67
|
|
|
|
|
|
|
"51" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 0, 0, 0], 10, "06"], |
68
|
|
|
|
|
|
|
"52" => ["NORMAL",11,[2, 4, 8, 5,10, 9, 7, 3, 6, 1, 2, 4], 6, "52"], |
69
|
|
|
|
|
|
|
"53" => ["NORMAL",11,[2, 4, 8, 5,10, 9, 7, 3, 6, 1, 2, 4], 6, "52"], |
70
|
|
|
|
|
|
|
"54" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 2, 0, 0], 10, "06"], |
71
|
|
|
|
|
|
|
"55" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 8, 7, 8], 10, "06"], |
72
|
|
|
|
|
|
|
"56" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 2, 3, 4], 10, "06"], |
73
|
|
|
|
|
|
|
"57" => ["QUER", 10,[1, 2, 1, 2, 1, 2, 1, 2, 1], 10, "00"], |
74
|
|
|
|
|
|
|
"58" => ["NORMAL",11,[2, 3, 4, 5, 6, 0, 0, 0, 0], 10, "02"], |
75
|
|
|
|
|
|
|
"59" => ["QUER", 10,[2, 1, 2, 1, 2, 1, 2, 1, 2], 10, "00"], |
76
|
|
|
|
|
|
|
"60" => ["QUER", 10,[2, 1, 2, 1, 2, 1, 2, 0, 0], 10, "00"], |
77
|
|
|
|
|
|
|
"61" => ["QUER", 10,[2, 1, 2, 1, 2, 1, 2, 1, 2], 8, "01"], |
78
|
|
|
|
|
|
|
"62" => ["QUER", 10,[0, 0, 2, 1, 2, 1, 2, 0, 0], 8, "00"], |
79
|
|
|
|
|
|
|
"63" => ["QUER", 10,[0, 0, 2, 1, 2, 1, 2, 1, 0], 8, "00"], |
80
|
|
|
|
|
|
|
"64" => ["NORMAL",11,[0, 0, 0, 2, 4, 8, 5,10, 9], 7, "06"], |
81
|
|
|
|
|
|
|
"65" => ["QUER", 10,[2, 1, 2, 1, 2, 1, 2, 1, 2], 8, "00"], |
82
|
|
|
|
|
|
|
"66" => ["NORMAL",11,[2, 3, 4, 5, 6, 0, 0, 7, 0], 10, "01"], |
83
|
|
|
|
|
|
|
"67" => ["QUER", 10,[0, 0, 2, 1, 2, 1, 2, 1, 2], 8, "00"], |
84
|
|
|
|
|
|
|
"68" => ["QUER", 10,[2, 1, 2, 1, 2, 1, 2, 1, 2], 10, "00"], |
85
|
|
|
|
|
|
|
"69" => ["NORMAL",11,[0, 0, 2, 3, 4, 5, 6, 7, 8], 10, "06"], |
86
|
|
|
|
|
|
|
"70" => ["NORMAL",11,[2, 3, 4, 5, 6, 7, 2, 3, 4], 10, "06"], |
87
|
|
|
|
|
|
|
"71" => ["NORMAL",11,[0, 0, 1, 2, 3, 4, 5, 6, 0], 10, "06"], |
88
|
|
|
|
|
|
|
"72" => ["QUER", 10,[2, 1, 2, 1, 2, 1, 0, 0, 0], 10, "00"], |
89
|
|
|
|
|
|
|
"73" => ["QUER", 10,[2, 1, 2, 1, 2, 1, 2, 1, 2], 10, "00"], |
90
|
|
|
|
|
|
|
"74" => ["QUER", 10,[2, 1, 2, 1, 2, 1, 2, 1, 2], 10, "00"], |
91
|
|
|
|
|
|
|
}; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub new { |
94
|
2
|
|
|
2
|
1
|
2907
|
my ($class, %args) = @_; |
95
|
2
|
|
|
|
|
9
|
my $self = bless {}, $class; |
96
|
2
|
|
|
|
|
10
|
$self->{BLZFILE} = "./BLZ.dat"; |
97
|
2
|
50
|
|
|
|
10
|
$self->{BLZFILE} = $args{BLZFILE} if defined $args{BLZFILE}; |
98
|
2
|
|
50
|
|
|
9
|
$self->{MODE_BLZ_FILE} = $args{MODE_BLZ_FILE} || 'BANK'; |
99
|
2
|
50
|
|
|
|
48
|
croak "Could not find BLZFILE ".cwd."/$self->{BLZFILE}." unless -f $self->{BLZFILE}; |
100
|
2
|
50
|
|
|
|
7
|
$self->_cache_all() if $CACHE_ALL; |
101
|
2
|
50
|
|
|
|
7
|
if ($self->{MODE_BLZ_FILE} eq 'MINIMAL') { |
102
|
|
|
|
|
|
|
#eval qq{use Storable;warn "loaded Storable\n"}; |
103
|
0
|
|
|
|
|
0
|
require Storable; |
104
|
|
|
|
|
|
|
} |
105
|
2
|
|
|
|
|
8
|
return $self; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
############################ |
109
|
|
|
|
|
|
|
sub check { |
110
|
212
|
|
|
212
|
1
|
82023
|
my ($self, %args) = @_; |
111
|
212
|
|
|
|
|
437
|
$self->{ERRORS} = {}; |
112
|
212
|
50
|
|
|
|
763
|
$self->{KONTONR} = $args{KONTONR} if defined $args{KONTONR}; |
113
|
212
|
50
|
|
|
|
562
|
$self->{BLZ} = $args{BLZ} if defined $args{BLZ}; |
114
|
|
|
|
|
|
|
#print "new Konto...\n"; |
115
|
212
|
|
|
|
|
622
|
my $konto = Business::DE::Konto->new; |
116
|
212
|
50
|
33
|
|
|
545
|
unless ($self->_validBLZ($self->{BLZ}) && $self->_validKONTONR($self->{KONTONR})) { |
117
|
0
|
|
|
|
|
0
|
$konto->_setError($_) for keys %{ $self->{ERRORS} }; |
|
0
|
|
|
|
|
0
|
|
118
|
|
|
|
|
|
|
#print Dumper $self->{ERRORS}; |
119
|
0
|
|
|
|
|
0
|
return $konto; |
120
|
|
|
|
|
|
|
} |
121
|
212
|
|
|
|
|
544
|
my $result = $self->get_info_for_blz($self->{BLZ}, $konto); |
122
|
|
|
|
|
|
|
#print Dumper $result; |
123
|
|
|
|
|
|
|
# ok, input is okay, so now let's go into details |
124
|
212
|
50
|
|
|
|
447
|
if ($result) { |
125
|
|
|
|
|
|
|
#print Dumper $konto; |
126
|
212
|
|
|
|
|
571
|
$konto->_setValue(KONTONR => $self->{KONTONR}); |
127
|
212
|
50
|
|
|
|
438
|
$konto->_setErrorCodes($self->{ERRORCODES}) if $self->{ERRORCODES}; |
128
|
|
|
|
|
|
|
#print "_pruefe ($konto->{KONTONR}, $konto->{METHOD})\n"; |
129
|
212
|
100
|
|
|
|
412
|
unless ($self->_pruefe($konto)) { |
130
|
71
|
|
|
|
|
191
|
$konto->_setError("ERR_KNR_INVALID"); |
131
|
71
|
|
|
|
|
961
|
return $konto; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
} |
134
|
141
|
|
|
|
|
139
|
$konto->_setError($_) for keys %{$self->{ERRORS}}; |
|
141
|
|
|
|
|
491
|
|
135
|
141
|
|
|
|
|
464
|
return $konto; |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
############################ |
138
|
|
|
|
|
|
|
sub _validBLZ { |
139
|
212
|
|
|
212
|
|
257
|
my $self = shift; |
140
|
212
|
|
|
|
|
265
|
my $blz = shift; |
141
|
212
|
50
|
|
|
|
475
|
$self->{ERRORS}->{ERR_NO_BLZ}++,return unless defined $blz; |
142
|
212
|
50
|
|
|
|
480
|
$self->{ERRORS}->{ERR_BLZ}++,return if ($blz =~ tr/0-9//) != 8; |
143
|
|
|
|
|
|
|
#print Dumper $self; |
144
|
|
|
|
|
|
|
#print "valid blz $blz\n"; |
145
|
212
|
|
|
|
|
918
|
return 1; |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
############################ |
148
|
|
|
|
|
|
|
sub _validKONTONR { |
149
|
212
|
|
|
212
|
|
268
|
my $self = shift; |
150
|
212
|
|
|
|
|
247
|
my $kontonr = shift; |
151
|
212
|
50
|
|
|
|
503
|
$self->{ERRORS}->{ERR_NO_KNR}++,return unless defined $kontonr; |
152
|
212
|
50
|
|
|
|
570
|
$self->{ERRORS}->{ERR_KNR}++,return if $kontonr =~ m/\D/; |
153
|
212
|
|
|
|
|
741
|
return 1; |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
############################ |
156
|
|
|
|
|
|
|
sub _cache_all { |
157
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
158
|
0
|
|
|
|
|
0
|
$CACHE_ON = 1; |
159
|
0
|
|
0
|
|
|
0
|
my $mode = $self->{MODE_BLZ_FILE} || 'BANK'; |
160
|
0
|
0
|
|
|
|
0
|
open BLZ, "<$self->{BLZFILE}" or die "Could not open BLZ-File $self->{BLZFILE}: $!"; |
161
|
0
|
0
|
|
|
|
0
|
if ($mode eq 'BANK') { |
|
|
0
|
|
|
|
|
|
162
|
0
|
|
|
|
|
0
|
while (my $line = ) { |
163
|
|
|
|
|
|
|
my ( |
164
|
0
|
|
|
|
|
0
|
$D_BLZ, $D_EIGEN, $OLD_BLZ, undef, undef, |
165
|
|
|
|
|
|
|
undef, $D_INST, $D_K_ORT, $D_PLZ, $D_ORT, |
166
|
|
|
|
|
|
|
undef, undef, undef, $D_BIC, $D_METHOD, |
167
|
|
|
|
|
|
|
undef |
168
|
|
|
|
|
|
|
) = |
169
|
|
|
|
|
|
|
unpack "A8A1A8AA4A5A58A20A5A29A27A5AA9A2A5", $line; |
170
|
0
|
|
|
|
|
0
|
$cache->{$D_BLZ}->{METHOD} = $D_METHOD; |
171
|
|
|
|
|
|
|
#$cache->{$D_BLZ}->{OLD_BLZ} = $OLD_BLZ; |
172
|
0
|
0
|
|
|
|
0
|
$cache->{$OLD_BLZ}->{METHOD} = $D_METHOD if $D_BLZ eq "00000000"; |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
elsif ($mode eq 'POST') { |
176
|
0
|
|
|
|
|
0
|
while (my $line = ) { |
177
|
0
|
0
|
|
|
|
0
|
if (my ($D_BLZ, $D_INST, $D_PLZ, $D_ORT, $D_METHOD, $REST) = |
178
|
|
|
|
|
|
|
$line =~ m/^(\d{8})(.{58})(\d{5})(.{30})(\d\d)(\d)/ ) { |
179
|
0
|
|
|
|
|
0
|
$D_INST =~ s/^\s+|\s+$//; |
180
|
0
|
|
|
|
|
0
|
$D_ORT =~ s/^\s+|\s+$//; |
181
|
0
|
|
|
|
|
0
|
$cache->{$D_BLZ}->{METHOD} = $D_METHOD; |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
#warn "blz read...\n"; |
186
|
|
|
|
|
|
|
#; |
187
|
0
|
|
|
|
|
0
|
my $count = keys %$cache; |
188
|
0
|
|
|
|
|
0
|
warn "count: $count (line $.)\n"; |
189
|
0
|
|
|
|
|
0
|
close BLZ; |
190
|
|
|
|
|
|
|
#warn "closed file\n"; |
191
|
|
|
|
|
|
|
#; |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
############################ |
194
|
|
|
|
|
|
|
sub get_info_for_blz { |
195
|
213
|
|
|
213
|
1
|
357
|
my ($self, $blz, $konto) = @_; |
196
|
213
|
|
50
|
|
|
463
|
my $mode = $self->{MODE_BLZ_FILE} || 'BANK'; |
197
|
213
|
100
|
|
|
|
416
|
unless ($konto) { |
198
|
1
|
|
|
|
|
7
|
$konto = Business::DE::Konto->new; |
199
|
|
|
|
|
|
|
} |
200
|
213
|
|
|
|
|
203
|
my ($line,$result); |
201
|
213
|
50
|
|
|
|
541
|
unless ($mode eq 'MINIMAL') { |
202
|
213
|
50
|
|
|
|
8267
|
open BLZ, "<$self->{BLZFILE}" or die "Could not open BLZ-File $self->{BLZFILE}: $!"; |
203
|
213
|
|
|
|
|
4240
|
while (defined ($line = )) { |
204
|
7933
|
100
|
33
|
|
|
73045
|
last if $line =~ m/^$blz/ || ($mode eq 'BANK' && $line =~ m/^\d{8}.$blz/); |
|
|
|
66
|
|
|
|
|
205
|
|
|
|
|
|
|
} |
206
|
213
|
50
|
|
|
|
482
|
unless ($line) { |
207
|
0
|
|
|
|
|
0
|
$self->{ERRORS}->{ERR_BLZ_EXIST}++; |
208
|
0
|
|
|
|
|
0
|
return; |
209
|
|
|
|
|
|
|
} |
210
|
213
|
|
|
|
|
3149
|
close BLZ; |
211
|
|
|
|
|
|
|
} |
212
|
213
|
100
|
66
|
|
|
1296
|
unless ($CACHE_ON && $cache->{$blz}->{METHOD}) { |
213
|
68
|
50
|
|
|
|
202
|
if ($mode eq 'POST') { |
|
|
50
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
214
|
0
|
0
|
|
|
|
0
|
if (my ($D_BLZ, $D_INST, $D_PLZ, $D_ORT, $D_METHOD, $REST) = |
215
|
|
|
|
|
|
|
$line =~ m/^(\d{8})(.{58})(\d{5})(.{30})(\d\d)(\d)/ ) { |
216
|
0
|
|
|
|
|
0
|
$D_INST =~ s/^\s+|\s+$//; |
217
|
0
|
|
|
|
|
0
|
$D_ORT =~ s/^\s+|\s+$//; |
218
|
0
|
|
|
|
|
0
|
@{$result}{qw(BLZ INST PLZ ORT METHOD REST)} = |
|
0
|
|
|
|
|
0
|
|
219
|
|
|
|
|
|
|
($D_BLZ, $D_INST, $D_PLZ, $D_ORT, $D_METHOD, $REST); |
220
|
0
|
0
|
|
|
|
0
|
$cache->{$blz}->{METHOD} = $D_METHOD if $CACHE_ON; |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
else { |
223
|
0
|
|
|
|
|
0
|
$self->{ERRORS}->{ERR_BLZ_FILE}++; |
224
|
0
|
|
|
|
|
0
|
return; |
225
|
|
|
|
|
|
|
} |
226
|
|
|
|
|
|
|
} |
227
|
|
|
|
|
|
|
elsif ($mode eq 'BANK') { |
228
|
68
|
|
|
|
|
172
|
chomp $line; |
229
|
|
|
|
|
|
|
my ( |
230
|
68
|
|
|
|
|
541
|
$D_BLZ, $D_EIGEN, $D_INST, $D_PLZ, $D_ORT, |
231
|
|
|
|
|
|
|
$D_KURZ, $D_PAN, $D_BIC, $D_METHOD, $D_NUMBER |
232
|
|
|
|
|
|
|
) = |
233
|
|
|
|
|
|
|
unpack "A8A1A58A5A35A27A5A11A2A6", $line; |
234
|
68
|
50
|
|
|
|
178
|
if ($D_BLZ ne $blz) { |
235
|
|
|
|
|
|
|
#print "if ($D_BLZ ne $blz) {$blz = $D_BLZ};\n"; |
236
|
0
|
|
|
|
|
0
|
$blz = $D_BLZ; |
237
|
|
|
|
|
|
|
} |
238
|
68
|
|
|
|
|
390
|
@$result{qw(BLZ INST PLZ ORT METHOD BIC)} = |
239
|
|
|
|
|
|
|
($blz, $D_INST, $D_PLZ, $D_ORT, $D_METHOD, $D_BIC); |
240
|
68
|
50
|
|
|
|
297
|
$cache->{$blz}->{METHOD} = $D_METHOD if $CACHE_ON; |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
elsif ($self->{MODE_BLZ_FILE} eq 'MINIMAL') { |
243
|
0
|
|
|
|
|
0
|
my $file = $self->{BLZFILE}; |
244
|
0
|
|
0
|
|
|
0
|
$STORABLE ||= Storable::retrieve( $file); |
245
|
0
|
|
|
|
|
0
|
my $D_BLZ = $STORABLE->{$blz}; |
246
|
0
|
0
|
|
|
|
0
|
unless ($D_BLZ) { |
247
|
0
|
|
|
|
|
0
|
$self->{ERRORS}->{ERR_BLZ_EXIST}++; # BUGFIX 2.10.2002 |
248
|
0
|
|
|
|
|
0
|
return; |
249
|
|
|
|
|
|
|
} |
250
|
0
|
|
|
|
|
0
|
@$result{qw(BLZ METHOD )} = |
251
|
|
|
|
|
|
|
($blz, $STORABLE->{$blz}); |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
} |
254
|
|
|
|
|
|
|
else { |
255
|
|
|
|
|
|
|
# reading blz from cache... |
256
|
145
|
|
|
|
|
486
|
$result->{METHOD} = $cache->{$blz}->{METHOD}; |
257
|
145
|
|
|
|
|
360
|
$result->{BLZ} = $blz; |
258
|
|
|
|
|
|
|
} |
259
|
213
|
50
|
|
|
|
449
|
if ($result) { |
260
|
213
|
|
|
|
|
976
|
$konto->_setValue(%$result); |
261
|
213
|
|
|
|
|
1002
|
return $konto; |
262
|
|
|
|
|
|
|
} |
263
|
0
|
|
|
|
|
0
|
return $result; |
264
|
|
|
|
|
|
|
} |
265
|
|
|
|
|
|
|
############################ |
266
|
|
|
|
|
|
|
sub _quersumme { |
267
|
653
|
|
|
653
|
|
1027
|
my $num = shift; |
268
|
653
|
100
|
|
|
|
2001
|
return $num if length $num == 1; |
269
|
97
|
|
|
|
|
96
|
my $sum = 0; |
270
|
97
|
|
|
|
|
226
|
foreach (split //, $num) {$sum += $_} |
|
194
|
|
|
|
|
306
|
|
271
|
97
|
|
|
|
|
362
|
return $sum; |
272
|
|
|
|
|
|
|
} |
273
|
|
|
|
|
|
|
############################ |
274
|
|
|
|
|
|
|
sub _pruefe { |
275
|
1
|
|
|
1
|
|
10
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4669
|
|
276
|
212
|
|
|
212
|
|
272
|
my $self = shift; |
277
|
212
|
|
|
|
|
251
|
my $konto = shift; |
278
|
212
|
|
|
|
|
676
|
my $k = $konto->{KONTONR}; |
279
|
212
|
|
|
|
|
278
|
my $m = $konto->{METHOD}; |
280
|
212
|
|
|
|
|
223
|
my ($ziffer,$pruefziffer); |
281
|
|
|
|
|
|
|
#print Dumper $check_code->{$m}; |
282
|
212
|
100
|
|
|
|
424
|
if (exists $check_code->{$m}) { |
283
|
141
|
|
|
|
|
145
|
my ($method,$mod,$array,$pz_stelle,$m_alias) = @{$check_code->{$m}}; |
|
141
|
|
|
|
|
350
|
|
284
|
141
|
|
|
|
|
153
|
$pz_stelle--; |
285
|
141
|
|
|
|
|
540
|
my $sum = $self->_add($array, $k, {METHOD => $method}); |
286
|
141
|
|
|
|
|
321
|
my $sub = "_m$m_alias"; |
287
|
|
|
|
|
|
|
#print "methode $sub\n"; |
288
|
141
|
50
|
66
|
|
|
2724
|
if ($m == 13) { |
|
|
50
|
100
|
|
|
|
|
|
|
50
|
100
|
|
|
|
|
|
|
50
|
100
|
|
|
|
|
|
|
100
|
66
|
|
|
|
|
|
|
100
|
66
|
|
|
|
|
|
|
100
|
100
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
289
|
0
|
|
|
|
|
0
|
$k = sprintf "%010s",$k; |
290
|
0
|
|
|
|
|
0
|
$pruefziffer = substr(($k),7,1); |
291
|
0
|
|
|
|
|
0
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
292
|
0
|
0
|
|
|
|
0
|
unless ($pruefziffer == $ziffer) { |
293
|
0
|
|
|
|
|
0
|
substr($k,0,2) = ''; |
294
|
0
|
|
|
|
|
0
|
$k .= '00'; |
295
|
0
|
|
|
|
|
0
|
$pruefziffer = substr($k,7,1); |
296
|
0
|
|
|
|
|
0
|
$sum = $self->_add($array, $k, {METHOD => $method}); |
297
|
0
|
|
|
|
|
0
|
$ziffer = $sub->($self,$array,"$k",$sum,$mod); |
298
|
|
|
|
|
|
|
} |
299
|
|
|
|
|
|
|
} |
300
|
|
|
|
|
|
|
elsif ($m eq "15") { |
301
|
0
|
|
|
|
|
0
|
substr($k,0,5) = "00000"; |
302
|
0
|
|
|
|
|
0
|
$sum = $self->_add($array, $k, {METHOD => $method}); |
303
|
0
|
|
|
|
|
0
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
304
|
0
|
|
|
|
|
0
|
$pruefziffer = $k % 10; |
305
|
|
|
|
|
|
|
} |
306
|
|
|
|
|
|
|
elsif ($m eq "14") { |
307
|
0
|
|
|
|
|
0
|
$k = sprintf "%010s",$k; # BUGFIX tina |
308
|
0
|
|
|
|
|
0
|
substr($k,0,3) = "000"; |
309
|
0
|
|
|
|
|
0
|
$sum = $self->_add($array, $k, {METHOD => $method}); |
310
|
0
|
|
|
|
|
0
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
311
|
0
|
|
|
|
|
0
|
$pruefziffer = $k % 10; |
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
elsif ($m eq "23") { |
314
|
0
|
|
|
|
|
0
|
substr($k,-3,3) = ""; |
315
|
0
|
|
|
|
|
0
|
$pruefziffer = substr((sprintf "%010s",$k),7,1); |
316
|
0
|
|
|
|
|
0
|
$sum = $self->_add($array, $k, {METHOD => $method}); |
317
|
0
|
|
|
|
|
0
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
318
|
0
|
|
|
|
|
0
|
$pruefziffer = $k % 10; |
319
|
|
|
|
|
|
|
} |
320
|
|
|
|
|
|
|
elsif ($m eq "26") { |
321
|
3
|
|
|
|
|
8
|
$k = sprintf "%010s",$k; |
322
|
3
|
100
|
|
|
|
13
|
$k = substr($k,0,8). '00' if $k =~ s/^00//; # Kris 2001/11/22 |
323
|
3
|
|
|
|
|
11
|
$sum = $self->_add($array, $k, {METHOD => $method}); |
324
|
|
|
|
|
|
|
#print "method $sub, knr: $k\n"; |
325
|
3
|
|
|
|
|
13
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
326
|
3
|
|
|
|
|
6
|
$pruefziffer = substr($k,-3,1); # Kris 2001/11/22; |
327
|
|
|
|
|
|
|
#$pruefziffer = substr($k,-3,1); # Kris 2001/11/22; |
328
|
|
|
|
|
|
|
#print "$ziffer == $pruefziffer\n"; |
329
|
|
|
|
|
|
|
} |
330
|
|
|
|
|
|
|
elsif ($m eq "27" && $k > 999999999) { |
331
|
1
|
|
|
|
|
3
|
$sub = "_m27"; |
332
|
1
|
|
|
|
|
4
|
$sum = $self->_add($array, $k, {METHOD => $method}); |
333
|
1
|
|
|
|
|
8
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
334
|
1
|
|
|
|
|
2
|
$pruefziffer = $k % 10; |
335
|
|
|
|
|
|
|
} |
336
|
|
|
|
|
|
|
elsif ($m eq "28" || $m eq "34") { |
337
|
|
|
|
|
|
|
#$k = substr($k,0,8).'00'; |
338
|
4
|
|
|
|
|
10
|
$k = sprintf "%010s",$k; |
339
|
4
|
|
|
|
|
7
|
$pruefziffer = substr($k,$pz_stelle,1); # Kris 2001/11/22; |
340
|
4
|
|
|
|
|
47
|
$sum = $self->_add($array, $k, {METHOD => $method}); |
341
|
4
|
|
|
|
|
14
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
342
|
|
|
|
|
|
|
} |
343
|
|
|
|
|
|
|
elsif ($m eq "35") { |
344
|
6
|
|
|
|
|
12
|
$k = sprintf "%010s",$k; |
345
|
6
|
|
|
|
|
9
|
$pruefziffer = substr($k,$pz_stelle,1); # Kris 2001/11/22; |
346
|
6
|
|
|
|
|
17
|
$sum = $self->_add($array, $k, {METHOD => $method}); |
347
|
6
|
|
|
|
|
20
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
348
|
6
|
50
|
|
|
|
17
|
$ziffer = $pruefziffer if substr($k,-2,1) eq substr($k,-2,1); |
349
|
|
|
|
|
|
|
} |
350
|
|
|
|
|
|
|
elsif ($m eq "41" && substr((sprintf "%010s",$k),3,1) == 9) { |
351
|
3
|
|
|
|
|
7
|
$k = sprintf "%010s",$k; |
352
|
3
|
|
|
|
|
14
|
$k =~ s/^.../000/; |
353
|
3
|
|
|
|
|
5
|
$pruefziffer = substr($k,$pz_stelle,1); # Kris 2001/11/22; |
354
|
3
|
|
|
|
|
11
|
$sum = $self->_add($array, $k, {METHOD => $method}); |
355
|
3
|
|
|
|
|
12
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
356
|
|
|
|
|
|
|
} |
357
|
|
|
|
|
|
|
elsif ($m eq "45" |
358
|
|
|
|
|
|
|
&& (substr((sprintf "%010s",$k),0,1) == 0 |
359
|
|
|
|
|
|
|
|| substr((sprintf "%010s",$k),4,1) == 1) |
360
|
|
|
|
|
|
|
) { |
361
|
4
|
|
|
|
|
7
|
$k = sprintf "%010s",$k; |
362
|
4
|
|
|
|
|
5
|
$pruefziffer = substr($k,$pz_stelle,1); # Kris 2001/11/22; |
363
|
4
|
|
|
|
|
5
|
$ziffer = $pruefziffer; |
364
|
|
|
|
|
|
|
} |
365
|
|
|
|
|
|
|
elsif ($m == 49) { |
366
|
|
|
|
|
|
|
# method 00, and if error, use method 01 |
367
|
0
|
|
|
|
|
0
|
$k = sprintf "%010s",$k; #bugfix 12.09.02 |
368
|
0
|
|
|
|
|
0
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
369
|
0
|
|
|
|
|
0
|
$pruefziffer = substr($k,$pz_stelle,1); |
370
|
|
|
|
|
|
|
#print "$ziffer == $pruefziffer? (m $mod)\n"; |
371
|
0
|
0
|
|
|
|
0
|
unless ($ziffer == $pruefziffer) { |
372
|
0
|
|
|
|
|
0
|
my ($method,$mod,$array,$pz_stelle,$m_alias) = @{$check_code->{"01"}}; |
|
0
|
|
|
|
|
0
|
|
373
|
0
|
|
|
|
|
0
|
$pz_stelle--; |
374
|
0
|
|
|
|
|
0
|
$sub = "_m01"; |
375
|
0
|
|
|
|
|
0
|
$sum = $self->_add($array, $k, {METHOD => $method}); |
376
|
0
|
|
|
|
|
0
|
$pruefziffer = substr($k,$pz_stelle,1); |
377
|
0
|
|
|
|
|
0
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
378
|
|
|
|
|
|
|
#print "$ziffer == $pruefziffer?\n"; |
379
|
|
|
|
|
|
|
} |
380
|
|
|
|
|
|
|
} |
381
|
|
|
|
|
|
|
elsif ($m == 50) { |
382
|
3
|
|
|
|
|
8
|
$k = sprintf "%010s",$k; #bugfix 12.09.02 |
383
|
|
|
|
|
|
|
# method 00, and if error, append "000" at the end |
384
|
3
|
|
|
|
|
11
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
385
|
3
|
|
|
|
|
5
|
$pruefziffer = substr($k,$pz_stelle,1); |
386
|
3
|
50
|
|
|
|
9
|
unless ($ziffer == $pruefziffer) { |
387
|
0
|
|
|
|
|
0
|
$k = sprintf "%010s",$k; |
388
|
0
|
|
|
|
|
0
|
$k .= "000"; |
389
|
0
|
|
|
|
|
0
|
$k =~ s/...//; |
390
|
0
|
|
|
|
|
0
|
$sum = $self->_add($array, $k, {METHOD => $method}); |
391
|
0
|
|
|
|
|
0
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
392
|
|
|
|
|
|
|
} |
393
|
|
|
|
|
|
|
} |
394
|
|
|
|
|
|
|
elsif ($m == 51) { |
395
|
5
|
|
|
|
|
13
|
$k = sprintf "%010s",$k; |
396
|
5
|
100
|
|
|
|
13
|
unless (substr($k,2,2) eq '99') { |
397
|
|
|
|
|
|
|
# print "no 99 $k\n"; |
398
|
4
|
|
|
|
|
11
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
399
|
4
|
|
|
|
|
8
|
$pruefziffer = substr($k,$pz_stelle,1); |
400
|
|
|
|
|
|
|
# method 00, and if error, use method plan B (33) |
401
|
4
|
100
|
|
|
|
10
|
unless ($ziffer == $pruefziffer) { |
402
|
1
|
|
|
|
|
2
|
my ($method,$mod,$array,$pz_stelle,$m_alias) = @{$check_code->{$m}}; |
|
1
|
|
|
|
|
4
|
|
403
|
1
|
|
|
|
|
3
|
$pz_stelle--; |
404
|
1
|
|
|
|
|
7
|
my $sum = $self->_add($array, $k, {METHOD => $method}); |
405
|
1
|
|
|
|
|
4
|
my $sub = "_m$m_alias"; |
406
|
|
|
|
|
|
|
#print "new test B ($k) $sub\n"; |
407
|
1
|
|
|
|
|
4
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
408
|
|
|
|
|
|
|
} |
409
|
|
|
|
|
|
|
# if error, use method plan C (33, but $sum / 7) |
410
|
4
|
100
|
|
|
|
11
|
unless ($ziffer == $pruefziffer) { |
411
|
1
|
|
|
|
|
3
|
my ($method,$mod,$array,$pz_stelle,$m_alias) = @{$check_code->{$m}}; |
|
1
|
|
|
|
|
3
|
|
412
|
1
|
|
|
|
|
2
|
$pz_stelle--; |
413
|
1
|
|
|
|
|
3
|
$mod = 7; |
414
|
1
|
|
|
|
|
9
|
my $sum = $self->_add($array, $k, {METHOD => $method}); |
415
|
1
|
|
|
|
|
4
|
my $sub = "_m$m_alias"; |
416
|
|
|
|
|
|
|
#print "new test C ($k) $sub\n"; |
417
|
1
|
|
|
|
|
6
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
418
|
|
|
|
|
|
|
} |
419
|
|
|
|
|
|
|
} |
420
|
|
|
|
|
|
|
else { |
421
|
|
|
|
|
|
|
# number has '99' at substr 3 and 4 => method 10 |
422
|
|
|
|
|
|
|
# this method sucks... |
423
|
|
|
|
|
|
|
#print "new test method 10\n"; |
424
|
1
|
|
|
|
|
3
|
my ($method,$mod,$array,$pz_stelle,$m_alias) = @{$check_code->{10}}; |
|
1
|
|
|
|
|
6
|
|
425
|
1
|
|
|
|
|
2
|
$pz_stelle--; |
426
|
1
|
|
|
|
|
6
|
my $sum = $self->_add($array, $k, {METHOD => $method}); |
427
|
1
|
|
|
|
|
4
|
my $sub = "_m$m_alias"; |
428
|
1
|
|
|
|
|
2
|
$pruefziffer = substr($k,$pz_stelle,1); |
429
|
1
|
|
|
|
|
5
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
430
|
|
|
|
|
|
|
} |
431
|
|
|
|
|
|
|
} |
432
|
|
|
|
|
|
|
elsif ($m == 52 || $m == 53) { |
433
|
1
|
50
|
|
|
|
3
|
if ($k =~ m/^9\d{9}$/) { |
434
|
0
|
|
|
|
|
0
|
my ($method,$mod,$array,$pz_stelle,$m_alias) = @{$check_code->{20}}; |
|
0
|
|
|
|
|
0
|
|
435
|
0
|
|
|
|
|
0
|
$pz_stelle--; |
436
|
0
|
|
|
|
|
0
|
my $sum = $self->_add($array, $k, {METHOD => $method}); |
437
|
0
|
|
|
|
|
0
|
my $sub = "_m$m_alias"; |
438
|
0
|
|
|
|
|
0
|
$pruefziffer = substr($k,$pz_stelle,1); |
439
|
0
|
|
|
|
|
0
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
440
|
|
|
|
|
|
|
} |
441
|
|
|
|
|
|
|
else { |
442
|
1
|
50
|
|
|
|
4
|
if ($m == 52) { |
443
|
1
|
|
|
|
|
3
|
my $blz = $konto->{BLZ}; |
444
|
1
|
|
|
|
|
5
|
my ($s1) = $blz =~ m/^...5(.*)$/; # bugfix 12.09.02 |
445
|
1
|
|
|
|
|
4
|
my $s2 = substr($k,0,2,''); |
446
|
1
|
|
|
|
|
4
|
$k =~ s/^0+//; |
447
|
1
|
|
|
|
|
4
|
$k = $s1.$s2.$k; |
448
|
1
|
|
|
|
|
3
|
$pruefziffer = substr($k,$pz_stelle,1,0); |
449
|
1
|
|
|
|
|
3
|
$k = sprintf "%012s",$k; |
450
|
|
|
|
|
|
|
#print "($k) p: $pruefziffer ($pz_stelle)\n"; |
451
|
1
|
|
|
|
|
6
|
my $sum = $self->_add($array, $k, {METHOD => $method, M => $m}); |
452
|
1
|
|
|
|
|
7
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
453
|
|
|
|
|
|
|
} |
454
|
|
|
|
|
|
|
else { |
455
|
0
|
|
|
|
|
0
|
my $blz = $konto->{BLZ}; |
456
|
0
|
|
|
|
|
0
|
$k =~ s/^0+//; |
457
|
|
|
|
|
|
|
#print "BLZ $blz, knr: $k\n"; |
458
|
0
|
|
|
|
|
0
|
my ($s1) = $blz =~ m/^...5(.*)$/; # bugfix 12.09.02 |
459
|
0
|
|
|
|
|
0
|
my $s2 = substr($k,0,3,''); |
460
|
0
|
|
|
|
|
0
|
my ($x,$t,$p) = split //,$s2; |
461
|
0
|
|
|
|
|
0
|
substr($s1,2,1) = $t; |
462
|
0
|
|
|
|
|
0
|
$s2 = $x.$p; |
463
|
0
|
|
|
|
|
0
|
$k = $s1.$s2.$k; |
464
|
|
|
|
|
|
|
#print "altkonto: $k\n"; |
465
|
0
|
|
|
|
|
0
|
$pruefziffer = substr($k,$pz_stelle,1,0); |
466
|
0
|
|
|
|
|
0
|
$k = sprintf "%012s",$k; |
467
|
|
|
|
|
|
|
#print "($k) p: $pruefziffer ($pz_stelle)\n"; |
468
|
0
|
|
|
|
|
0
|
my $sum = $self->_add($array, $k, {METHOD => $method, M => $m}); |
469
|
0
|
|
|
|
|
0
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
470
|
|
|
|
|
|
|
#print "$pruefziffer == $ziffer?\n"; |
471
|
|
|
|
|
|
|
} |
472
|
|
|
|
|
|
|
} |
473
|
|
|
|
|
|
|
} |
474
|
|
|
|
|
|
|
elsif ($m == 56 && $k =~ m/^9\d{9}/) { |
475
|
1
|
|
|
|
|
4
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
476
|
1
|
50
|
|
|
|
9
|
$ziffer = 7 if $ziffer == 10; |
477
|
1
|
50
|
|
|
|
3
|
$ziffer = 8 if $ziffer == 11; |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
} |
480
|
|
|
|
|
|
|
elsif ($m == 57) { |
481
|
8
|
|
|
|
|
573
|
$k = sprintf "%010s",$k; |
482
|
8
|
|
|
|
|
15
|
my $d = substr($k,0,2); |
483
|
8
|
100
|
66
|
|
|
71
|
if ($d <= 50 || $d == 91 || |
|
|
|
33
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
66
|
|
|
|
|
484
|
|
|
|
|
|
|
($d >=96 && $d <= 99) || $k=~m/^[78]{6}/) { |
485
|
4
|
|
|
|
|
7
|
my ($method,$mod,$array,$pz_stelle,$m_alias) = @{$check_code->{$m}}; |
|
4
|
|
|
|
|
11
|
|
486
|
4
|
|
|
|
|
6
|
$pz_stelle--; |
487
|
4
|
|
|
|
|
17
|
my $sum = $self->_add($array, $k, {METHOD => $method}); |
488
|
4
|
|
|
|
|
14
|
my $sub = "_m$m_alias"; |
489
|
4
|
|
|
|
|
7
|
$pruefziffer = substr($k,$pz_stelle,1); |
490
|
4
|
|
|
|
|
8
|
$ziffer = $pruefziffer; |
491
|
|
|
|
|
|
|
} |
492
|
|
|
|
|
|
|
else { |
493
|
4
|
|
|
|
|
9
|
$pruefziffer = substr($k,$pz_stelle,1); |
494
|
4
|
|
|
|
|
12
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
495
|
|
|
|
|
|
|
} |
496
|
|
|
|
|
|
|
} |
497
|
|
|
|
|
|
|
elsif ($m == 59) { |
498
|
0
|
|
|
|
|
0
|
$pruefziffer = substr($k,$pz_stelle,1); |
499
|
0
|
|
|
|
|
0
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
500
|
0
|
0
|
|
|
|
0
|
$ziffer = $pruefziffer if length $k < 9; |
501
|
|
|
|
|
|
|
} |
502
|
|
|
|
|
|
|
elsif ($m == 61) { |
503
|
2
|
|
|
|
|
6
|
$k = sprintf "%010s",$k; |
504
|
2
|
|
|
|
|
4
|
$pruefziffer = substr($k,$pz_stelle,1); |
505
|
2
|
100
|
|
|
|
7
|
if (substr($k,8,1) == 8) { |
506
|
1
|
|
|
|
|
2
|
substr($k,7,1) = ''; |
507
|
1
|
|
|
|
|
2
|
$k .= $pruefziffer; |
508
|
|
|
|
|
|
|
} |
509
|
|
|
|
|
|
|
else { |
510
|
1
|
|
|
|
|
3
|
substr($k,7,2) = '000'; |
511
|
|
|
|
|
|
|
} |
512
|
2
|
|
|
|
|
10
|
my $sum = $self->_add($array, $k, {METHOD => $method, M => $m}); |
513
|
2
|
|
|
|
|
5
|
$ziffer = 10 - $sum % 10; |
514
|
2
|
50
|
|
|
|
6
|
$ziffer = 0 if $ziffer == 10; #bugfix 12.09.02 |
515
|
|
|
|
|
|
|
} |
516
|
|
|
|
|
|
|
elsif ($m == 63) { |
517
|
2
|
|
|
|
|
8
|
$k = sprintf "%010s",$k; |
518
|
2
|
100
|
|
|
|
9
|
if ($k =~ m/^000/) {$k =~ s/^00//;$k .= "00"} |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
3
|
|
519
|
2
|
|
|
|
|
10
|
my $sum = $self->_add($array, $k, {METHOD => $method, M => $m}); |
520
|
2
|
|
|
|
|
7
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
521
|
2
|
|
|
|
|
4
|
$pruefziffer = substr($k,$pz_stelle,1); |
522
|
|
|
|
|
|
|
} |
523
|
|
|
|
|
|
|
elsif ($m == 65) { |
524
|
2
|
|
|
|
|
5
|
$k = sprintf "%010s",$k; |
525
|
2
|
100
|
|
|
|
8
|
unless (substr($k,8,1) eq '9') { |
526
|
1
|
|
|
|
|
2
|
$pruefziffer = substr($k,$pz_stelle,1); |
527
|
1
|
|
|
|
|
3
|
substr($k,7,2) = "00"; |
528
|
|
|
|
|
|
|
} |
529
|
2
|
|
|
|
|
8
|
my $sum = $self->_add($array, $k, {METHOD => $method, M => $m}); |
530
|
2
|
|
|
|
|
15
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
531
|
|
|
|
|
|
|
} |
532
|
|
|
|
|
|
|
elsif ($m == 68) { |
533
|
3
|
100
|
33
|
|
|
16
|
if (length($k) == 10) { |
|
|
50
|
|
|
|
|
|
534
|
1
|
|
|
|
|
2
|
substr($k,0,3) = "000"; |
535
|
|
|
|
|
|
|
#print "new k: $k\n"; |
536
|
1
|
|
|
|
|
6
|
my $sum = $self->_add($array, $k, {METHOD => $method, M => $m}); |
537
|
1
|
|
|
|
|
2
|
$pruefziffer = substr($k,$pz_stelle,1); |
538
|
|
|
|
|
|
|
#print "sum: $sum $pruefziffer\n"; |
539
|
1
|
|
|
|
|
4
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
540
|
|
|
|
|
|
|
} |
541
|
|
|
|
|
|
|
elsif ($k >= 400000000 && $k <=499999999) { |
542
|
0
|
|
|
|
|
0
|
$ziffer = $pruefziffer = 1; |
543
|
|
|
|
|
|
|
} |
544
|
|
|
|
|
|
|
else { |
545
|
2
|
|
|
|
|
6
|
$k = sprintf "%010s",$k; |
546
|
2
|
|
|
|
|
11
|
my $sum = $self->_add($array, $k, {METHOD => $method, M => $m}); |
547
|
2
|
|
|
|
|
7
|
$pruefziffer = substr($k,$pz_stelle,1); |
548
|
2
|
|
|
|
|
7
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
549
|
2
|
100
|
|
|
|
7
|
if ($ziffer != $pruefziffer) { |
550
|
1
|
|
|
|
|
2
|
substr($k,2,2) = "00"; |
551
|
1
|
|
|
|
|
6
|
my $sum = $self->_add($array, $k, {METHOD => $method, M => $m}); |
552
|
1
|
|
|
|
|
4
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
553
|
|
|
|
|
|
|
} |
554
|
|
|
|
|
|
|
} |
555
|
|
|
|
|
|
|
} |
556
|
|
|
|
|
|
|
elsif ($m == 69) { |
557
|
3
|
|
|
|
|
7
|
$k = sprintf "%010s",$k; |
558
|
3
|
50
|
66
|
|
|
22
|
if ($k ge 9300000000 && $k lt 9400000000) { |
|
|
100
|
66
|
|
|
|
|
559
|
0
|
|
|
|
|
0
|
$sub = "_m06"; |
560
|
0
|
|
|
|
|
0
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
561
|
0
|
|
|
|
|
0
|
$pruefziffer = substr($k,$pz_stelle,1); |
562
|
|
|
|
|
|
|
} |
563
|
|
|
|
|
|
|
elsif ($k ge 9700000000 && $k lt 9800000000) { |
564
|
1
|
|
|
|
|
2
|
$sub = "_m27"; |
565
|
1
|
|
|
|
|
2
|
$pruefziffer = substr($k,$pz_stelle,1); # Kris 2001/11/22; |
566
|
1
|
|
|
|
|
6
|
$sum = $self->_add($array, $k, {METHOD => $method}); |
567
|
1
|
|
|
|
|
3
|
$mod = 10; |
568
|
1
|
|
|
|
|
5
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
569
|
|
|
|
|
|
|
} |
570
|
|
|
|
|
|
|
else { |
571
|
2
|
|
|
|
|
3
|
$sub = "_m06"; |
572
|
2
|
|
|
|
|
2
|
$pz_stelle = 8; |
573
|
2
|
|
|
|
|
3
|
$pz_stelle--; |
574
|
2
|
|
|
|
|
3
|
$pruefziffer = substr($k,$pz_stelle,1); # Kris 2001/11/22; |
575
|
2
|
|
|
|
|
7
|
$sum = $self->_add($array, $k, {METHOD => $method}); |
576
|
2
|
|
|
|
|
8
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
577
|
2
|
100
|
|
|
|
6
|
unless ($ziffer == $pruefziffer) { |
578
|
1
|
|
|
|
|
2
|
$sub = "_m27"; |
579
|
1
|
|
|
|
|
3
|
$pz_stelle = 9; |
580
|
1
|
|
|
|
|
1
|
$pruefziffer = substr($k,$pz_stelle,1); # Kris 2001/11/22; |
581
|
1
|
|
|
|
|
2
|
$mod = 10; |
582
|
1
|
|
|
|
|
4
|
$sum = $self->_add($array, $k, {METHOD => $method}); |
583
|
1
|
|
|
|
|
7
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
584
|
|
|
|
|
|
|
} |
585
|
|
|
|
|
|
|
} |
586
|
|
|
|
|
|
|
} |
587
|
|
|
|
|
|
|
elsif ($m == 70) { |
588
|
0
|
|
|
|
|
0
|
$k = sprintf "%010s",$k; |
589
|
0
|
0
|
0
|
|
|
0
|
$k =~ s/^.../000/ if (substr($k,3,1)==5) || substr($k,3,2) eq 69; |
590
|
0
|
|
|
|
|
0
|
$sum = $self->_add($array, $k, {METHOD => $method}); |
591
|
0
|
|
|
|
|
0
|
$pruefziffer = substr($k,$pz_stelle,1); |
592
|
0
|
|
|
|
|
0
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
593
|
|
|
|
|
|
|
} |
594
|
|
|
|
|
|
|
elsif ($m == 73) { |
595
|
2
|
|
|
|
|
6
|
$k = sprintf "%010s",$k; |
596
|
2
|
100
|
|
|
|
7
|
if (substr($k,2,1)==9) { |
597
|
1
|
|
|
|
|
2
|
my ($method,$mod,$array,$pz_stelle,$m_alias) = @{$check_code->{"06"}}; |
|
1
|
|
|
|
|
5
|
|
598
|
1
|
|
|
|
|
1
|
$pz_stelle--; |
599
|
1
|
|
|
|
|
5
|
my $sum = $self->_add($array, $k, {METHOD => $method}); |
600
|
1
|
|
|
|
|
3
|
my $sub = "_m$m_alias"; |
601
|
1
|
|
|
|
|
2
|
$pruefziffer = substr($k,$pz_stelle,1); |
602
|
1
|
|
|
|
|
3
|
$ziffer = $pruefziffer; |
603
|
|
|
|
|
|
|
} |
604
|
|
|
|
|
|
|
else { |
605
|
1
|
50
|
|
|
|
7
|
$k =~ s/^.../000/ if (substr($k,2,1)!=9); |
606
|
1
|
|
|
|
|
5
|
$sum = $self->_add($array, $k, {METHOD => $method}); |
607
|
1
|
|
|
|
|
4
|
$pruefziffer = substr($k,$pz_stelle,1); |
608
|
1
|
|
|
|
|
5
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
609
|
|
|
|
|
|
|
} |
610
|
|
|
|
|
|
|
} |
611
|
|
|
|
|
|
|
elsif ($m == 74) { |
612
|
2
|
|
|
|
|
5
|
$k = sprintf "%010s",$k; |
613
|
2
|
|
|
|
|
9
|
$sum = $self->_add($array, $k, {METHOD => $method}); |
614
|
2
|
|
|
|
|
7
|
$pruefziffer = substr($k,$pz_stelle,1); |
615
|
2
|
|
|
|
|
190
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
616
|
2
|
100
|
|
|
|
8
|
unless ($ziffer == $pruefziffer) { |
617
|
|
|
|
|
|
|
# nächste "halbdekade" |
618
|
1
|
|
|
|
|
2
|
$ziffer = 5- $sum % 5; |
619
|
|
|
|
|
|
|
} |
620
|
|
|
|
|
|
|
} |
621
|
|
|
|
|
|
|
else { |
622
|
86
|
|
|
|
|
265
|
$ziffer = $sub->($self,$array,$k,$sum,$mod); |
623
|
86
|
|
|
|
|
180
|
$k = sprintf "%010s",$k; |
624
|
86
|
|
|
|
|
132
|
$pruefziffer = substr($k,$pz_stelle,1); |
625
|
|
|
|
|
|
|
#$pruefziffer = $k % 10; |
626
|
|
|
|
|
|
|
} |
627
|
|
|
|
|
|
|
#print "PRUEFZIFFER: $pruefziffer, $ziffer\n"; |
628
|
141
|
50
|
|
|
|
243
|
return 0 unless defined $ziffer; |
629
|
141
|
|
100
|
|
|
318
|
$pruefziffer ||=0; |
630
|
141
|
50
|
|
|
|
554
|
return ($ziffer == $pruefziffer)? 1 : 0 |
631
|
|
|
|
|
|
|
} |
632
|
|
|
|
|
|
|
else { |
633
|
|
|
|
|
|
|
#warn "Method $m not implemented yet\n"; |
634
|
71
|
|
|
|
|
203
|
$konto->_setError("ERR_METHOD"); |
635
|
71
|
|
|
|
|
226
|
return 0; |
636
|
|
|
|
|
|
|
} |
637
|
|
|
|
|
|
|
} |
638
|
|
|
|
|
|
|
############################ |
639
|
|
|
|
|
|
|
sub _add { |
640
|
184
|
|
|
184
|
|
210
|
my $self = shift; |
641
|
184
|
|
|
|
|
266
|
my ($array, $k, $args) = @_; |
642
|
184
|
|
|
|
|
460
|
$array = [reverse @$array]; |
643
|
184
|
|
|
|
|
431
|
$k = sprintf "%010s",$k; |
644
|
184
|
|
|
|
|
176
|
my $sum; |
645
|
184
|
|
|
|
|
193
|
my $last_index = 9; |
646
|
|
|
|
|
|
|
#print Dumper $args; |
647
|
184
|
|
100
|
|
|
616
|
$args->{M}||=0; |
648
|
184
|
100
|
66
|
|
|
757
|
if ($args->{M} == 52 || $args->{M} == 53) { $last_index = 11 } |
|
1
|
|
|
|
|
2
|
|
649
|
|
|
|
|
|
|
#print "(0..$last_index)\n"; |
650
|
184
|
|
|
|
|
296
|
for my $x (0..$last_index) { |
651
|
1842
|
|
100
|
|
|
4531
|
my $add = ($array->[$x]||0) * substr($k,$x,1); |
652
|
1842
|
100
|
|
|
|
3907
|
$add = _quersumme($add) if $args->{METHOD} eq "QUER"; |
653
|
|
|
|
|
|
|
#print "$add = $array->[$x] * (substr($k,$x,1) ".substr($k,$x,1)."\n"; |
654
|
1842
|
50
|
|
|
|
3602
|
$add = $add % 10 if $args->{METHOD} eq "ONES"; |
655
|
1842
|
|
|
|
|
6618
|
$sum += $add; |
656
|
|
|
|
|
|
|
} |
657
|
184
|
|
|
|
|
477
|
return $sum; |
658
|
|
|
|
|
|
|
} |
659
|
|
|
|
|
|
|
############################ |
660
|
|
|
|
|
|
|
sub _summe { |
661
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
662
|
0
|
|
|
|
|
0
|
my $sum; |
663
|
0
|
|
|
|
|
0
|
$sum += $_ for @_; |
664
|
0
|
|
|
|
|
0
|
return $sum; |
665
|
|
|
|
|
|
|
} |
666
|
|
|
|
|
|
|
############################ |
667
|
|
|
|
|
|
|
sub getMethod2BLZ { |
668
|
0
|
|
|
0
|
1
|
0
|
my ($self, $blz) = @_; |
669
|
0
|
|
|
|
|
0
|
my $konto = Business::DE::Konto->new(); |
670
|
0
|
0
|
|
|
|
0
|
my $result = $self->get_info_for_blz($blz, $konto) or return; |
671
|
0
|
|
|
|
|
0
|
return $konto->get_method; |
672
|
|
|
|
|
|
|
} |
673
|
|
|
|
|
|
|
############################ |
674
|
|
|
|
|
|
|
# Modulus 10, Gewichtung 2, 1, 2, 1, 2, 1, 2, 1, 2 |
675
|
|
|
|
|
|
|
# Die Stellen der Kontonummer sind von rechts nach links mit |
676
|
|
|
|
|
|
|
# den Ziffern 2, 1, 2, 1, 2 usw. zu multiplizieren. Die jeweiligen |
677
|
|
|
|
|
|
|
# Produkte werden addiert, nachdem jeweils aus den |
678
|
|
|
|
|
|
|
# zweistelligen Produkten die Quersumme gebildet wurde |
679
|
|
|
|
|
|
|
# (z. B. Produkt 16 = Quersumme 7). Nach der Addition |
680
|
|
|
|
|
|
|
# bleiben außer der Einerstelle alle anderen Stellen |
681
|
|
|
|
|
|
|
# unberücksichtigt. Die Einerstelle wird von dem Wert 10 |
682
|
|
|
|
|
|
|
# subtrahiert. Das Ergebnis ist die Prüfziffer (10. Stelle der |
683
|
|
|
|
|
|
|
# Kontonummer). Ergibt sich nach der Subtraktion der |
684
|
|
|
|
|
|
|
# Rest 10, ist die Prüfziffer 0. |
685
|
|
|
|
|
|
|
# Testkontonummern:9290701, 539290858, 1501824, 1501832 |
686
|
|
|
|
|
|
|
sub _m00 { |
687
|
32
|
|
|
32
|
|
55
|
my ($self,$array,$k,$sum,$mod)= @_; |
688
|
32
|
|
|
|
|
49
|
my $ziffer = $mod - $sum % 10; |
689
|
|
|
|
|
|
|
#print "$ziffer = $mod - $sum % 10\n"; |
690
|
32
|
100
|
|
|
|
58
|
$ziffer = 0 if $ziffer == 10; |
691
|
32
|
|
|
|
|
57
|
return $ziffer; |
692
|
|
|
|
|
|
|
} |
693
|
|
|
|
|
|
|
############################ |
694
|
|
|
|
|
|
|
sub _m01 { |
695
|
6
|
|
|
6
|
|
10
|
my ($self,$array,$k,$sum,$mod)= @_; |
696
|
6
|
|
|
|
|
8
|
$sum = $sum % $mod; |
697
|
6
|
|
|
|
|
8
|
my $ziffer = $mod - $sum; |
698
|
6
|
50
|
|
|
|
15
|
return ($ziffer == 10)? 0 : $ziffer; |
699
|
|
|
|
|
|
|
} |
700
|
|
|
|
|
|
|
############################ |
701
|
|
|
|
|
|
|
sub _m02 { |
702
|
4
|
|
|
4
|
|
7
|
my ($self,$array,$k,$sum,$mod)= @_; |
703
|
4
|
|
|
|
|
7
|
my $rest = $sum % $mod; |
704
|
4
|
50
|
|
|
|
8
|
return if ($rest == 1); |
705
|
4
|
100
|
|
|
|
9
|
return 0 if($rest == 0); # BUGFIX kristian |
706
|
3
|
|
|
|
|
8
|
return $mod - $rest; |
707
|
|
|
|
|
|
|
} |
708
|
|
|
|
|
|
|
############################ |
709
|
|
|
|
|
|
|
sub _m06 { |
710
|
55
|
|
|
55
|
|
86
|
my ($self,$array,$k,$sum,$mod)= @_; |
711
|
55
|
|
|
|
|
98
|
$k = sprintf "%010s", $k; |
712
|
55
|
|
|
|
|
72
|
my $rest = $sum % $mod; |
713
|
55
|
|
|
|
|
49
|
my $ziffer; |
714
|
55
|
100
|
|
|
|
112
|
if ($rest == 1) {$ziffer = 0} |
|
6
|
100
|
|
|
|
10
|
|
|
6
|
|
|
|
|
10
|
|
715
|
|
|
|
|
|
|
elsif ($rest == 0) {$ziffer = 0} |
716
|
|
|
|
|
|
|
else { |
717
|
43
|
|
|
|
|
49
|
$ziffer = $mod - $rest; |
718
|
|
|
|
|
|
|
} |
719
|
|
|
|
|
|
|
# print "$sum, z: $ziffer, mod: $mod\n"; |
720
|
55
|
|
|
|
|
95
|
return $ziffer; |
721
|
|
|
|
|
|
|
} |
722
|
|
|
|
|
|
|
############################ |
723
|
|
|
|
|
|
|
sub _m08 { |
724
|
1
|
|
|
1
|
|
19
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1594
|
|
725
|
0
|
|
|
0
|
|
0
|
my ($self,$array,$k,$sum,$mod)= @_; |
726
|
0
|
0
|
|
|
|
0
|
return unless $k > 60000; |
727
|
0
|
|
|
|
|
0
|
my $method = "_m00"; # BUGFIX kristian |
728
|
0
|
|
|
|
|
0
|
$self->$method($array,$k,$sum,$mod); |
729
|
|
|
|
|
|
|
} |
730
|
|
|
|
|
|
|
############################ |
731
|
|
|
|
|
|
|
sub _m09 { |
732
|
25
|
|
|
25
|
|
43
|
my ($self,$array,$k,$sum,$mod)= @_; |
733
|
25
|
|
|
|
|
65
|
return $k % 10; |
734
|
|
|
|
|
|
|
} |
735
|
|
|
|
|
|
|
############################ |
736
|
|
|
|
|
|
|
sub _m11 { |
737
|
0
|
|
|
0
|
|
0
|
my ($self,$array,$k,$sum,$mod)= @_; |
738
|
0
|
|
|
|
|
0
|
my $rest = $sum % $mod; |
739
|
0
|
|
|
|
|
0
|
my $ziffer; |
740
|
0
|
0
|
|
|
|
0
|
if ($rest == 1) {$ziffer = 9} |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
741
|
|
|
|
|
|
|
elsif ($rest == 0) {$ziffer = 0} # BUGFIX kristian |
742
|
|
|
|
|
|
|
else { |
743
|
0
|
|
|
|
|
0
|
$ziffer = $mod - $rest; |
744
|
|
|
|
|
|
|
} |
745
|
0
|
|
|
|
|
0
|
return $ziffer; |
746
|
|
|
|
|
|
|
|
747
|
|
|
|
|
|
|
} |
748
|
|
|
|
|
|
|
############################ |
749
|
|
|
|
|
|
|
sub _m13 { |
750
|
0
|
|
|
0
|
|
0
|
my ($self,$array,$k,$sum,$mod)= @_; |
751
|
0
|
|
|
|
|
0
|
substr($k,0,1)=0; |
752
|
0
|
|
|
|
|
0
|
$sum = $sum % 10; |
753
|
0
|
|
|
|
|
0
|
my $ziffer = $mod - $sum; |
754
|
0
|
0
|
|
|
|
0
|
$ziffer = 0 if $ziffer == 10; |
755
|
0
|
|
|
|
|
0
|
return $ziffer; |
756
|
|
|
|
|
|
|
|
757
|
|
|
|
|
|
|
} |
758
|
|
|
|
|
|
|
############################ |
759
|
|
|
|
|
|
|
sub _m14 { |
760
|
0
|
|
|
0
|
|
0
|
my ($self,$array,$k,$sum,$mod)= @_; |
761
|
0
|
|
|
|
|
0
|
my $rest = $sum % $mod; |
762
|
0
|
0
|
|
|
|
0
|
return if ($rest == 1); |
763
|
0
|
0
|
|
|
|
0
|
return 0 if($rest == 0); # BUGFIX kristian |
764
|
0
|
|
|
|
|
0
|
return $mod - $rest; |
765
|
|
|
|
|
|
|
} |
766
|
|
|
|
|
|
|
############################ |
767
|
|
|
|
|
|
|
sub _m16 { |
768
|
0
|
|
|
0
|
|
0
|
my ($self,$array,$k,$sum,$mod)= @_; |
769
|
0
|
|
|
|
|
0
|
my $rest = $sum % $mod; |
770
|
0
|
|
|
|
|
0
|
my $ziffer; |
771
|
0
|
0
|
|
|
|
0
|
if ($rest == 1) {$ziffer = substr($k,-2,1);} |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
772
|
|
|
|
|
|
|
elsif ($rest == 0) {$ziffer = 0} |
773
|
|
|
|
|
|
|
else { |
774
|
0
|
|
|
|
|
0
|
$ziffer = $mod - $rest; |
775
|
|
|
|
|
|
|
} |
776
|
0
|
|
|
|
|
0
|
return $ziffer; |
777
|
|
|
|
|
|
|
} |
778
|
|
|
|
|
|
|
############################ |
779
|
|
|
|
|
|
|
sub _m17 { |
780
|
1
|
|
|
1
|
|
3
|
my ($self,$array,$k,$sum,$mod)= @_; |
781
|
1
|
|
|
|
|
8
|
my @k = (split //, (sprintf "%010s",$k))[1..7]; |
782
|
1
|
|
|
|
|
3
|
my $pruef = pop @k; |
783
|
1
|
|
|
|
|
6
|
$sum = $k[0] + _quersumme($k[1]*2) + |
784
|
|
|
|
|
|
|
$k[2] + _quersumme($k[3]*2) + |
785
|
|
|
|
|
|
|
$k[4] + _quersumme($k[5]*2); |
786
|
1
|
|
|
|
|
2
|
$sum--; |
787
|
1
|
|
|
|
|
3
|
my $ziffer = $sum % $mod; |
788
|
1
|
50
|
|
|
|
3
|
if ($ziffer == 0) { |
789
|
1
|
|
|
|
|
2
|
$ziffer = 0; |
790
|
|
|
|
|
|
|
} |
791
|
|
|
|
|
|
|
else { |
792
|
0
|
|
|
|
|
0
|
$ziffer = 10 - $ziffer; |
793
|
|
|
|
|
|
|
} |
794
|
1
|
50
|
|
|
|
4
|
if($ziffer == $pruef){ |
795
|
1
|
|
|
|
|
5
|
return $k % 10; |
796
|
|
|
|
|
|
|
} |
797
|
|
|
|
|
|
|
else{ |
798
|
0
|
|
|
|
|
0
|
return undef; |
799
|
|
|
|
|
|
|
} |
800
|
|
|
|
|
|
|
} |
801
|
|
|
|
|
|
|
############################ |
802
|
|
|
|
|
|
|
sub _m21 { |
803
|
0
|
|
|
0
|
|
0
|
my ($self,$array,$k,$sum,$mod)= @_; |
804
|
0
|
|
|
|
|
0
|
my $ziffer = _quersumme $sum; |
805
|
0
|
|
|
|
|
0
|
while ($ziffer > 9) { |
806
|
0
|
|
|
|
|
0
|
$ziffer = _quersumme $ziffer; |
807
|
|
|
|
|
|
|
} |
808
|
0
|
|
|
|
|
0
|
$ziffer = $mod - $ziffer; |
809
|
0
|
|
|
|
|
0
|
return $ziffer; |
810
|
|
|
|
|
|
|
|
811
|
|
|
|
|
|
|
} |
812
|
|
|
|
|
|
|
############################ |
813
|
|
|
|
|
|
|
sub _m24 { |
814
|
0
|
|
|
0
|
|
0
|
my ($self,$array,$k,$sum,$mod)= @_; |
815
|
0
|
|
|
|
|
0
|
my $blz = $self->{BLZ}; |
816
|
0
|
|
|
|
|
0
|
$k = sprintf "%010s", $k; |
817
|
0
|
0
|
|
|
|
0
|
if ($k =~ m/^[3456]/) { |
818
|
0
|
|
|
|
|
0
|
substr($k,0,1) = 0; |
819
|
|
|
|
|
|
|
} |
820
|
0
|
0
|
|
|
|
0
|
if (substr($k,0,1) == 9) { |
821
|
0
|
|
|
|
|
0
|
substr($k,0,3) = "000"; |
822
|
|
|
|
|
|
|
} |
823
|
0
|
|
|
|
|
0
|
$k = $k + 0; |
824
|
0
|
|
|
|
|
0
|
my @k = split //,$k; |
825
|
0
|
|
|
|
|
0
|
my $pruef = pop @k; |
826
|
0
|
|
|
|
|
0
|
$sum = 0; |
827
|
0
|
|
|
|
|
0
|
my ($i) =0; |
828
|
0
|
|
|
|
|
0
|
for (@k) { |
829
|
0
|
|
|
|
|
0
|
$sum += (($k[$i] * $array->[$i]) + $array->[$i]) % $mod; |
830
|
0
|
|
|
|
|
0
|
$i++; |
831
|
|
|
|
|
|
|
} |
832
|
0
|
|
|
|
|
0
|
my $ziffer = $sum % 10; |
833
|
0
|
|
|
|
|
0
|
return $ziffer; |
834
|
|
|
|
|
|
|
} |
835
|
|
|
|
|
|
|
############################ |
836
|
|
|
|
|
|
|
sub _m25 { |
837
|
0
|
|
|
0
|
|
0
|
my ($self,$array,$k,$sum,$mod)= @_; |
838
|
0
|
|
|
|
|
0
|
$k = sprintf "%010s", $k; |
839
|
0
|
|
|
|
|
0
|
my $rest = $sum % $mod; |
840
|
0
|
|
|
|
|
0
|
my ($ziffer); |
841
|
0
|
0
|
|
|
|
0
|
if ($rest == 0) { |
|
|
0
|
|
|
|
|
|
842
|
0
|
|
|
|
|
0
|
$ziffer = 0; |
843
|
|
|
|
|
|
|
} |
844
|
|
|
|
|
|
|
elsif ($rest == 1) { |
845
|
0
|
|
|
|
|
0
|
$ziffer = 0; |
846
|
0
|
0
|
|
|
|
0
|
return undef unless (substr($k,1,1) =~ m/^[89]$/); |
847
|
|
|
|
|
|
|
} |
848
|
|
|
|
|
|
|
else { |
849
|
0
|
|
|
|
|
0
|
$ziffer = $mod - $rest; |
850
|
|
|
|
|
|
|
} |
851
|
0
|
|
|
|
|
0
|
return $ziffer; |
852
|
|
|
|
|
|
|
} |
853
|
|
|
|
|
|
|
############################ |
854
|
|
|
|
|
|
|
sub _m26 { |
855
|
0
|
|
|
0
|
|
0
|
my ($self,$array,$k,$sum,$mod)= @_; |
856
|
|
|
|
|
|
|
|
857
|
|
|
|
|
|
|
} |
858
|
|
|
|
|
|
|
############################ |
859
|
|
|
|
|
|
|
sub _m27 { |
860
|
|
|
|
|
|
|
#print "method 27\n"; |
861
|
4
|
|
|
4
|
|
8
|
my ($self,$array,$k,$sum,$mod)= @_; |
862
|
4
|
|
|
|
|
5
|
my $ergebnis; |
863
|
4
|
|
|
|
|
16
|
my @trans = qw(1 4 3 2 1 4 3 2 1); |
864
|
4
|
|
|
|
|
34
|
my @zeilen = ([qw(0 1 5 9 3 7 4 8 2 6)], |
865
|
|
|
|
|
|
|
[qw(0 1 7 6 9 8 3 2 5 4)], |
866
|
|
|
|
|
|
|
[qw(0 1 8 4 6 2 9 5 7 3)], |
867
|
|
|
|
|
|
|
[qw(0 1 2 3 4 5 6 7 8 9)], |
868
|
|
|
|
|
|
|
); |
869
|
4
|
|
|
|
|
20
|
my @k = split //, $k; |
870
|
4
|
|
|
|
|
9
|
my $pruef = pop @k; |
871
|
4
|
|
|
|
|
9
|
for my $z (0..@k-1) { |
872
|
36
|
|
|
|
|
44
|
my $trans = $trans[$z] - 1; |
873
|
36
|
|
|
|
|
59
|
$ergebnis += $zeilen[$trans][$k[$z]]; |
874
|
|
|
|
|
|
|
#print "$k[$z] => $zeilen[$trans][$k[$z]] ($ergebnis)\n"; |
875
|
|
|
|
|
|
|
} |
876
|
4
|
|
|
|
|
8
|
$ergebnis %= 10; |
877
|
|
|
|
|
|
|
#print "10 - $ergebnis (mod: $mod)\n"; |
878
|
4
|
|
|
|
|
6
|
my $ziffer = $mod - $ergebnis; |
879
|
4
|
|
|
|
|
5
|
$ziffer %= 10; |
880
|
4
|
|
|
|
|
21
|
return $ziffer; |
881
|
|
|
|
|
|
|
|
882
|
|
|
|
|
|
|
} |
883
|
|
|
|
|
|
|
sub _m31 { |
884
|
0
|
|
|
0
|
|
0
|
my ($self,$array,$k,$sum,$mod)= @_; |
885
|
0
|
|
|
|
|
0
|
my $ziffer = $sum % $mod; |
886
|
0
|
0
|
|
|
|
0
|
return if $ziffer == 10; |
887
|
0
|
|
|
|
|
0
|
return $ziffer; |
888
|
|
|
|
|
|
|
} |
889
|
|
|
|
|
|
|
|
890
|
|
|
|
|
|
|
sub _m35 { |
891
|
6
|
|
|
6
|
|
9
|
my ($self,$array,$k,$sum,$mod)= @_; |
892
|
6
|
|
|
|
|
12
|
$k = sprintf "%010s", $k; |
893
|
6
|
|
|
|
|
7
|
my $rest = $sum % $mod; |
894
|
6
|
|
|
|
|
3
|
my $ziffer = $rest; |
895
|
|
|
|
|
|
|
#print "$sum, z: $ziffer, mod: $mod\n"; |
896
|
6
|
|
|
|
|
10
|
return $ziffer; |
897
|
|
|
|
|
|
|
} |
898
|
|
|
|
|
|
|
sub _m52 { |
899
|
1
|
|
|
1
|
|
3
|
my ($self,$array,$k,$sum,$mod)= @_; |
900
|
1
|
|
|
|
|
2
|
my $ix = 0; |
901
|
1
|
|
|
|
|
12
|
$ix++ while $k =~ s/^0//g; |
902
|
1
|
|
|
|
|
4
|
$ix += 5; |
903
|
1
|
|
|
|
|
3
|
$ix = 11-$ix; |
904
|
1
|
|
|
|
|
2
|
my $rest = $sum % $mod; |
905
|
|
|
|
|
|
|
#print "k: $k, sum: $sum, rest: $rest (ix: $ix)\n"; |
906
|
|
|
|
|
|
|
# my ($method,$mod,$array,$pz_stelle,$m_alias) = @{$check_code->{$m}}; |
907
|
|
|
|
|
|
|
# $pz_stelle--; |
908
|
1
|
|
|
|
|
3
|
my $gewicht = $array->[$ix]; |
909
|
|
|
|
|
|
|
#print "gewicht $gewicht (@$array)\n"; |
910
|
1
|
|
|
|
|
2
|
my $ziffer; |
911
|
1
|
|
|
|
|
4
|
for (0..11) { |
912
|
4
|
|
|
|
|
5
|
my $test = $rest + $_ * $gewicht; |
913
|
4
|
|
|
|
|
6
|
my $rest1 = $test % $mod; |
914
|
|
|
|
|
|
|
#print "($rest + $_ * $gewicht) % $mod = $rest1\n"; |
915
|
4
|
100
|
|
|
|
11
|
$ziffer = $_, last if $rest1 == 10; |
916
|
|
|
|
|
|
|
} |
917
|
1
|
|
|
|
|
4
|
return $ziffer; |
918
|
|
|
|
|
|
|
} |
919
|
|
|
|
|
|
|
############################ |
920
|
|
|
|
|
|
|
1; |
921
|
|
|
|
|
|
|
__END__ |