X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/61cdba5d566357f3beabe0e7f3f0cb2d7bdccd73..fec48603264c8adad06fbc212358633778322b56:/SL/SEPA/XML.pm diff --git a/SL/SEPA/XML.pm b/SL/SEPA/XML.pm index 90c77ec3d..54df4eda6 100644 --- a/SL/SEPA/XML.pm +++ b/SL/SEPA/XML.pm @@ -12,6 +12,7 @@ use XML::Writer; use SL::Iconv; use SL::SEPA::XML::Transaction; +use SL::DB::Helper::ReplaceSpecialChars qw(replace_special_chars); sub new { my $class = shift; @@ -40,7 +41,7 @@ sub _init { croak "Missing parameter: $missing_parameter" if ($missing_parameter); croak "Missing parameter: creditor_id" if !$self->{creditor_id} && $self->{collection}; - map { $self->{$_} = $self->_replace_special_chars($self->{iconv}->convert($self->{$_})) } qw(company message_id creditor_id); + map { $self->{$_} = replace_special_chars($self->{iconv}->convert($self->{$_})) } qw(company message_id creditor_id); } sub add_transaction { @@ -54,26 +55,6 @@ sub add_transaction { return 1; } -sub _replace_special_chars { - my $self = shift; - my $text = shift; - - my %special_chars = ( - 'ä' => 'ae', - 'ö' => 'oe', - 'ü' => 'ue', - 'Ä' => 'Ae', - 'Ö' => 'Oe', - 'Ü' => 'Ue', - 'ß' => 'ss', - '&' => '+', - ); - - map { $text =~ s/$_/$special_chars{$_}/g; } keys %special_chars; - - return $text; -} - sub _format_amount { my $self = shift; my $amount = shift; @@ -223,8 +204,8 @@ sub to_xml { $xml->startTag('DrctDbtTx'); $xml->startTag('MndtRltdInf'); - $xml->dataElement('MndtId', $self->_restricted_identification_sepa2($transaction->get('company_number'))); - $xml->dataElement('DtOfSgntr', $transaction->get('reference_date', 2010-12-02)); + $xml->dataElement('MndtId', $self->_restricted_identification_sepa2($transaction->get('mandator_id'))); + $xml->dataElement('DtOfSgntr', $self->_restricted_identification_sepa2($transaction->get('date_of_signature'))); $xml->endTag('MndtRltdInf'); $xml->startTag('CdtrSchmeId');