summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorivan <ivan>2011-11-12 00:35:39 +0000
committerivan <ivan>2011-11-12 00:35:39 +0000
commitcd7626282ab808893f3b1d06bd77d0a64300c3e5 (patch)
treeeb7e06116f9354dfeaae716e08167937d8f7e84c
parentc381f36ecbe08d5a2030873091062683dae301e3 (diff)
invoice language from self-servie, RT#13656
-rw-r--r--FS/FS/ClientAPI/MyAccount.pm14
-rw-r--r--FS/FS/Schema.pm3
-rw-r--r--FS/FS/cust_bill.pm6
3 files changed, 17 insertions, 6 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index 3b18947b5..71e47b567 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -1140,7 +1140,10 @@ sub invoice_pdf {
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'},
+ }),
};
}
@@ -1154,10 +1157,15 @@ sub legacy_invoice {
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;
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index e060daf84..fcdb6542d 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -549,10 +549,11 @@ sub tables_hashref {
'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' => {
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm
index 0a1577f63..4dc41f091 100644
--- a/FS/FS/cust_bill.pm
+++ b/FS/FS/cust_bill.pm
@@ -2362,11 +2362,13 @@ unsquelch_cdr - overrides any per customer cdr squelching when true
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;
@@ -2655,7 +2657,7 @@ sub print_generic {
);
#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