Revision 16e9dc2c
Von Jan Büren vor mehr als 7 Jahren hinzugefügt
SL/SEPA/XML.pm | ||
---|---|---|
12 | 12 |
|
13 | 13 |
use SL::Iconv; |
14 | 14 |
use SL::SEPA::XML::Transaction; |
15 |
use SL::DB::Helper::ReplaceSpecialChars qw(replace_special_chars); |
|
16 | 15 |
|
17 | 16 |
sub new { |
18 | 17 |
my $class = shift; |
... | ... | |
41 | 40 |
croak "Missing parameter: $missing_parameter" if ($missing_parameter); |
42 | 41 |
croak "Missing parameter: creditor_id" if !$self->{creditor_id} && $self->{collection}; |
43 | 42 |
|
44 |
map { $self->{$_} = replace_special_chars($self->{iconv}->convert($self->{$_})) } qw(company message_id creditor_id); |
|
43 |
map { $self->{$_} = $self->_replace_special_chars($self->{iconv}->convert($self->{$_})) } qw(company message_id creditor_id);
|
|
45 | 44 |
} |
46 | 45 |
|
47 | 46 |
sub add_transaction { |
... | ... | |
55 | 54 |
return 1; |
56 | 55 |
} |
57 | 56 |
|
57 |
sub _replace_special_chars { |
|
58 |
my $self = shift; |
|
59 |
my $text = shift; |
|
60 |
|
|
61 |
my %special_chars = ( |
|
62 |
'ä' => 'ae', |
|
63 |
'ö' => 'oe', |
|
64 |
'ü' => 'ue', |
|
65 |
'Ä' => 'Ae', |
|
66 |
'Ö' => 'Oe', |
|
67 |
'Ü' => 'Ue', |
|
68 |
'ß' => 'ss', |
|
69 |
'&' => '+', |
|
70 |
'`' => '\'', |
|
71 |
); |
|
72 |
|
|
73 |
map { $text =~ s/$_/$special_chars{$_}/g; } keys %special_chars; |
|
74 |
|
|
75 |
# for all other non ascii chars 'OLÉ S.L.' and 'Årdberg AB'! |
|
76 |
use Text::Unidecode qw(unidecode); |
|
77 |
$text = unidecode($text); |
|
78 |
|
|
79 |
return $text; |
|
80 |
} |
|
81 |
|
|
58 | 82 |
sub _format_amount { |
59 | 83 |
my $self = shift; |
60 | 84 |
my $amount = shift; |
Auch abrufbar als: Unified diff
Revert "_replace_special_chars in Helper ausgelagert."
Funktion in die falsche Stelle ausgelagert, ferner zu
'speziell' um die für andere Anforderungen wiederzuverwerten
This reverts commit fec48603264c8adad06fbc212358633778322b56.