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,
use SL::Chart;
use SL::CT;
use SL::Form;
+use SL::GenericTranslations;
use SL::ReportGenerator;
use SL::SEPA;
use SL::SEPA::XML;
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,
<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>