return { 'error' => '',
'invnum' => $invnum,
- 'invoice_pdf' => $cust_bill->print_pdf( { unsquelch_cdr => 1 } ),
+ 'invoice_pdf' => $cust_bill->print_pdf({
+ 'unsquelch_cdr' => 1,
+ 'locale' => $p->{'locale'},
+ }),
};
}
my $legacyinvnum = $p->{'legacyinvnum'};
- my $legacy_cust_bill = qsearchs('legacy_cust_bill', {
+ my %hash = (
'legacyinvnum' => $legacyinvnum,
'custnum' => $custnum,
- }) or return { 'error' => "Can't find legacyinvnum" };
+ );
+
+ my $legacy_cust_bill =
+ qsearchs('legacy_cust_bill', { %hash, 'locale' => $p->{'locale'} } )
+ || qsearchs('legacy_cust_bill', \%hash )
+ or return { 'error' => "Can't find legacyinvnum" };
#my %return;
'charged', @money_type, '', '',
'content_pdf', 'blob', 'NULL', '', '', '',
'content_html', 'text', 'NULL', '', '', '',
+ 'locale', 'varchar', 'NULL', 16, '', '',
],
'primary_key' => 'legacyinvnum',
'unique' => [],
- 'index' => [ ['legacyid', 'custnum'], ],
+ 'index' => [ ['legacyid', 'custnum', 'locale' ], ],
},
'cust_statement' => {
notice_name - overrides "Invoice" as the name of the sent document (templates from 10/2009 or newer required)
+locale - override customer's locale
+
=cut
#what's with all the sprintf('%10.2f')'s in here? will it cause any
# (alignment in text invoice?) problems to change them all to '%.2f' ?
-# yes: fixed width (dot matrix) text printing will be borked
+# yes: fixed width/plain text printing will be borked
sub print_generic {
my( $self, %params ) = @_;
my $conf = $self->conf;
);
#localization
- my $lh = FS::L10N->get_handle($cust_main->locale);
+ my $lh = FS::L10N->get_handle( $params{'locale'} || $cust_main->locale );
$invoice_data{'emt'} = sub { &$escape_function($self->mt(@_)) };
my %info = FS::Locales->locale_info($cust_main->locale || 'en_US');
# eval to avoid death for unimplemented languages