line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Business::DE::Konto; |
2
|
|
|
|
|
|
|
#--------------------------------------------- |
3
|
|
|
|
|
|
|
# $Id: Konto.pm,v 1.12 2002/09/12 21:59:37 tina Exp $ |
4
|
|
|
|
|
|
|
#--------------------------------------------- |
5
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
6
|
1
|
|
|
1
|
|
4
|
use Data::Dumper; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
53
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
1
|
|
|
1
|
|
5
|
use base qw(Exporter); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
109
|
|
9
|
1
|
|
|
1
|
|
5
|
use vars qw(%error_codes @EXPORT_OK %EXPORT_TAGS $VERSION); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
731
|
|
10
|
|
|
|
|
|
|
$VERSION = '0.02'; |
11
|
|
|
|
|
|
|
@EXPORT_OK = qw(%error_codes); |
12
|
|
|
|
|
|
|
%EXPORT_TAGS = ( 'errorcodes' => [@EXPORT_OK]); |
13
|
|
|
|
|
|
|
sub new { |
14
|
213
|
|
|
213
|
1
|
292
|
my ($class, $args) = @_; |
15
|
213
|
|
|
|
|
310
|
my $self = {}; |
16
|
213
|
|
|
|
|
572
|
my @args = qw(PLZ BLZ INST METHOD ORT KONTONR BIC); |
17
|
213
|
|
|
|
|
1086
|
@$self{@args} = @$args{@args}; |
18
|
213
|
|
|
|
|
1103
|
bless ($self, $class); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
0
|
1
|
0
|
sub get_zip { $_[0]->{PLZ} } |
22
|
0
|
|
|
0
|
1
|
0
|
sub get_blz { $_[0]->{BLZ} } |
23
|
1
|
|
|
1
|
1
|
9
|
sub get_bankname { $_[0]->{INST} } |
24
|
0
|
|
|
0
|
1
|
0
|
sub get_location { $_[0]->{ORT} } |
25
|
0
|
|
|
0
|
1
|
0
|
sub get_account_no { $_[0]->{KONTONR} } |
26
|
0
|
|
|
0
|
1
|
0
|
sub get_bic { $_[0]->{BIC} } |
27
|
0
|
|
|
0
|
1
|
0
|
sub get_method { $_[0]->{METHOD} } |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _setValue { |
30
|
425
|
|
|
425
|
|
1174
|
my ($self, %args) = @_; |
31
|
425
|
|
|
|
|
1187
|
while (my ($key,$value) = each %args) { |
32
|
910
|
|
|
|
|
3714
|
$self->{$key} = $value; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
sub check { |
36
|
212
|
|
|
212
|
1
|
689
|
my ($self) = @_; |
37
|
|
|
|
|
|
|
#print "debug 1\n"; |
38
|
212
|
100
|
|
|
|
596
|
return 1 unless $self->{ERRORS}; |
39
|
|
|
|
|
|
|
#print "debug 2\n"; |
40
|
71
|
50
|
33
|
|
|
258
|
return if $self->{ERRORS}->{ERR_KNR_INVALID} && (keys %{$self->{ERRORS}}) == 1; |
|
71
|
|
|
|
|
300
|
|
41
|
|
|
|
|
|
|
#print "debug 3\n"; |
42
|
71
|
|
|
|
|
145
|
return 0; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _setErrorCodes { |
46
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
47
|
0
|
0
|
|
|
|
0
|
my $codes = shift or return; |
48
|
0
|
|
|
|
|
0
|
%error_codes = %$codes; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
sub _setError { |
51
|
142
|
|
|
142
|
|
2815
|
my ($self, $error) = @_; |
52
|
142
|
|
|
|
|
596
|
$self->{ERRORS}->{$error}++ |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
sub printErrors { |
55
|
71
|
|
|
71
|
1
|
325
|
my ($self) = @_; |
56
|
71
|
|
50
|
|
|
169
|
my $errors = $self->{ERRORS} || return ''; |
57
|
|
|
|
|
|
|
#print Dumper $self->{ERRORS}; |
58
|
71
|
|
|
|
|
73
|
my $err_string; |
59
|
71
|
|
|
|
|
167
|
for my $error (keys %$errors) { |
60
|
142
|
|
|
|
|
426
|
$err_string .= "Error $error: $error_codes{$error}\n"; |
61
|
|
|
|
|
|
|
#print "Error $error: $error_codes{$error}\n"; |
62
|
|
|
|
|
|
|
} |
63
|
71
|
|
|
|
|
252
|
return $err_string; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
sub getErrors { |
66
|
71
|
|
|
71
|
1
|
229
|
my ($self) = @_; |
67
|
71
|
|
50
|
|
|
173
|
my $errors = $self->{ERRORS} || return ''; |
68
|
71
|
|
|
|
|
251
|
return [keys %$errors]; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
%error_codes = ( |
71
|
|
|
|
|
|
|
ERR_NO_BLZ => 'Please supply a BLZ', |
72
|
|
|
|
|
|
|
ERR_BLZ => 'Please supply a BLZ with 8 digits', |
73
|
|
|
|
|
|
|
ERR_BLZ_EXIST => 'BLZ doesn\'t exist', |
74
|
|
|
|
|
|
|
ERR_BLZ_FILE => 'BLZ-File corrupted', |
75
|
|
|
|
|
|
|
ERR_NO_KNR => 'Please supply an account number', |
76
|
|
|
|
|
|
|
ERR_KNR => 'Please supply a valid account number with only digits', |
77
|
|
|
|
|
|
|
ERR_KNR_INVALID => 'Account-number is invalid', |
78
|
|
|
|
|
|
|
ERR_METHOD => 'Method not implemented yet', |
79
|
|
|
|
|
|
|
); |
80
|
|
|
|
|
|
|
1; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |