Bei SEPA-Überweisungen Verwendungszweke mit "Rechnung" (übersetzt) präfixen
authorMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 3 Dec 2010 15:09:21 +0000 (16:09 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Fri, 3 Dec 2010 15:09:21 +0000 (16:09 +0100)
SL/SEPA.pm
bin/mozilla/sepa.pl
templates/webpages/sepa/bank_transfer_add.html

index 38341ec..9a29783 100644 (file)
@@ -22,7 +22,7 @@ sub retrieve_open_invoices {
   my $query =
     qq|
        SELECT ${arap}.id, ${arap}.invnumber, ${arap}.${vc}_id, ${arap}.amount AS invoice_amount, ${arap}.invoice,
-         vc.name AS vcname, ${arap}.duedate as duedate,
+         vc.name AS vcname, vc.language_id, ${arap}.duedate as duedate,
 
          COALESCE(vc.iban, '') <> '' AND COALESCE(vc.bic, '') <> '' AS vc_bank_info_ok,
 
index 7971b7d..f6041fb 100755 (executable)
@@ -8,6 +8,7 @@ use SL::BankAccount;
 use SL::Chart;
 use SL::CT;
 use SL::Form;
+use SL::GenericTranslations;
 use SL::ReportGenerator;
 use SL::SEPA;
 use SL::SEPA::XML;
@@ -41,6 +42,15 @@ sub bank_transfer_add {
 
   my $bank_account_label_sub = sub { $locale->text('Account number #1, bank code #2, #3', $_[0]->{account_number}, $_[0]->{bank_code}, $_[0]->{bank}) };
 
+  my $translation_list = GenericTranslations->list(translation_type => 'sepa_remittance_info_pfx');
+  my %translations     = map { ( ($_->{language_id} || 'default') => $_->{translation} ) } @{ $translation_list };
+
+  foreach my $invoice (@{ $invoices }) {
+    my $prefix                    = $translations{ $invoice->{language_id} } || $translations{default} || $::locale->text('Invoice');
+    $prefix                      .= ' ' unless $prefix =~ m/ $/;
+    $invoice->{reference_prefix}  = $prefix;
+  }
+
   $form->header();
   print $form->parse_html_template('sepa/bank_transfer_add',
                                    { 'INVOICES'           => $invoices,
index 0954d1d..56d36d0 100644 (file)
@@ -73,7 +73,7 @@
       <td align="right">[% LxERP.format_amount(invoice.invoice_amount, -2) %]</td>
       <td align="right">[% LxERP.format_amount(invoice.open_amount, -2) %]</td>
       <td align="right">[% invoice.duedate %]</td>
-      <td><input name="bank_transfers[].reference" value="[% HTML.escape(invoice.invnumber) %]"></td>
+      <td><input name="bank_transfers[].reference" value="[% HTML.escape(invoice.reference_prefix _ invoice.invnumber) %]"></td>
       <td align="right">
        <input name="bank_transfers[].amount" value="[% LxERP.format_amount(invoice.invoice_amount, -2) %]" style="text-align: right">
       </td>