Merge branch 'test' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / SL / SEPA / XML.pm
index 90c77ec..a4cf5f5 100644 (file)
@@ -67,10 +67,15 @@ sub _replace_special_chars {
     'Ü' => 'Ue',
     'ß' => 'ss',
     '&' => '+',
+    '`' => '\'',
     );
 
   map { $text =~ s/$_/$special_chars{$_}/g; } keys %special_chars;
 
+  # for all other non ascii chars 'OLÉ S.L.' and 'Årdberg AB'!
+  use Text::Unidecode qw(unidecode);
+  $text = unidecode($text);
+
   return $text;
 }
 
@@ -138,7 +143,7 @@ sub to_xml {
   my $is_coll   = $self->{collection};
   my $cd_src    = $is_coll ? 'Cdtr'              : 'Dbtr';
   my $cd_dst    = $is_coll ? 'Dbtr'              : 'Cdtr';
-  my $pain_id   = $is_coll ? 'pain.008.002.02'   : 'pain.001.002.03';
+  my $pain_id   = $is_coll ? 'pain.008.001.02'   : 'pain.001.001.03';
   my $pain_elmt = $is_coll ? 'CstmrDrctDbtInitn' : 'CstmrCdtTrfInitn';
   my @pii_base  = (strftime('PII%Y%m%d%H%M%S', @now), rand(1000000000));
 
@@ -223,8 +228,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');