[freeside-commits] freeside/FS/FS Conf.pm, 1.468.2.5, 1.468.2.6 Locales.pm, 1.1, 1.1.2.1 Schema.pm, 1.317.2.6, 1.317.2.7 conf.pm, 1.2, 1.2.10.1 cust_bill.pm, 1.350.2.3, 1.350.2.4 cust_main.pm, 1.586.2.1, 1.586.2.2 cust_main_Mixin.pm, 1.11, 1.11.2.1
Mark Wells
mark at wavetail.420.am
Thu Sep 15 17:15:49 PDT 2011
- Previous message: [freeside-commits] freeside/FS/FS/ClientAPI MyAccount.pm, 1.133.2.5, 1.133.2.6
- Next message: [freeside-commits] freeside/FS/FS/L10N en_ca.pm, NONE, 1.1.2.2 en_us.pm, 1.1, 1.1.2.1 fr_ca.pm, NONE, 1.1.2.2 fr_fr.pm, NONE, 1.1.2.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv30348/FS/FS
Modified Files:
Tag: FREESIDE_2_3_BRANCH
Conf.pm Locales.pm Schema.pm conf.pm cust_bill.pm cust_main.pm
cust_main_Mixin.pm
Log Message:
invoice template and config localization, #12367
Index: conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/conf.pm,v
retrieving revision 1.2
retrieving revision 1.2.10.1
diff -u -w -d -r1.2 -r1.2.10.1
--- conf.pm 18 Jun 2008 00:10:01 -0000 1.2
+++ conf.pm 16 Sep 2011 00:15:46 -0000 1.2.10.1
@@ -3,6 +3,7 @@
use strict;
use vars qw( @ISA );
use FS::Record;
+use FS::Locales;
@ISA = qw(FS::Record);
@@ -94,6 +95,7 @@
|| $self->ut_foreign_keyn('agentnum', 'agent', 'agentnum')
|| $self->ut_text('name')
|| $self->ut_anything('value')
+ || $self->ut_enum('locale', [ '', FS::Locales->locales ])
;
return $error if $error;
Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.586.2.1
retrieving revision 1.586.2.2
diff -u -w -d -r1.586.2.1 -r1.586.2.2
--- cust_main.pm 6 Aug 2011 00:50:59 -0000 1.586.2.1
+++ cust_main.pm 16 Sep 2011 00:15:46 -0000 1.586.2.2
@@ -68,6 +68,7 @@
use FS::cust_main_note;
use FS::cust_attachment;
use FS::contact;
+use FS::Locales;
# 1 is mostly method/subroutine entry and options
# 2 traces progress of some operations
@@ -1692,6 +1693,7 @@
|| $self->ut_floatn('credit_limit')
|| $self->ut_numbern('billday')
|| $self->ut_enum('edit_subject', [ '', 'Y' ] )
+ || $self->ut_enum('locale', [ '', FS::Locales->locales ])
;
#barf. need message catalogs. i18n. etc.
Index: cust_main_Mixin.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main_Mixin.pm,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -u -w -d -r1.11 -r1.11.2.1
--- cust_main_Mixin.pm 1 Jul 2011 05:33:54 -0000 1.11
+++ cust_main_Mixin.pm 16 Sep 2011 00:15:47 -0000 1.11.2.1
@@ -538,6 +538,41 @@
}
+=item conf
+
+Returns a configuration handle (L<FS::Conf>) set to the customer's locale,
+if they have one. If not, returns an FS::Conf with no locale.
+
+=cut
+
+sub conf {
+ my $self = shift;
+ return $self->{_conf} if (ref $self and $self->{_conf});
+ my $cust_main = $self->cust_main;
+ my $conf = new FS::Conf {
+ 'locale' => ($cust_main ? $cust_main->locale : '')
+ };
+ $self->{_conf} = $conf if ref $self;
+ return $conf;
+}
+
+=item mt TEXT [, ARGS ]
+
+Localizes a text string (see L<Locale::Maketext>) for the customer's locale,
+if they have one.
+
+=cut
+
+sub mt {
+ my $self = shift;
+ return $self->{_lh}->maketext(@_) if (ref $self and $self->{_lh});
+ my $cust_main = $self->cust_main;
+ my $locale = $cust_main ? $cust_main->locale : '';
+ my $lh = FS::L10N->get_handle($locale);
+ $self->{_lh} = $lh if ref $self;
+ return $lh->maketext(@_);
+}
+
=back
=head1 BUGS
Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.468.2.5
retrieving revision 1.468.2.6
diff -u -w -d -r1.468.2.5 -r1.468.2.6
--- Conf.pm 7 Sep 2011 19:12:55 -0000 1.468.2.5
+++ Conf.pm 16 Sep 2011 00:15:45 -0000 1.468.2.6
@@ -47,16 +47,25 @@
=over 4
-=item new
+=item new [ HASHREF ]
Create a new configuration object.
+HASHREF may contain options to set the configuration context. Currently
+accepts C<locale>, and C<localeonly> to disable fallback to the null locale.
+
=cut
sub new {
- my($proto) = @_;
+ my($proto) = shift;
+ my $opts = shift || {};
my($class) = ref($proto) || $proto;
- my($self) = { 'base_dir' => $base_dir };
+ my $self = {
+ 'base_dir' => $base_dir,
+ 'locale' => $opts->{locale},
+ 'localeonly' => $opts->{localeonly}, # for config-view.cgi ONLY
+ };
+ warn "FS::Conf created with no locale fallback.\n" if $self->{localeonly};
bless ($self, $class);
}
@@ -108,14 +117,26 @@
sub _config {
my($self,$name,$agentnum,$agentonly)=@_;
my $hashref = { 'name' => $name };
- $hashref->{agentnum} = $agentnum;
local $FS::Record::conf = undef; # XXX evil hack prevents recursion
- my $cv = FS::Record::qsearchs('conf', $hashref);
- if (!$agentonly && !$cv && defined($agentnum) && $agentnum) {
- $hashref->{agentnum} = '';
+ my $cv;
+ my @a = (
+ ($agentnum || ()),
+ ($agentonly && $agentnum ? () : '')
+ );
+ my @l = (
+ ($self->{locale} || ()),
+ ($self->{localeonly} && $self->{locale} ? () : '')
+ );
+ # try with the agentnum first, then fall back to no agentnum if allowed
+ foreach my $a (@a) {
+ $hashref->{agentnum} = $a;
+ foreach my $l (@l) {
+ $hashref->{locale} = $l;
$cv = FS::Record::qsearchs('conf', $hashref);
+ return $cv if $cv;
}
- return $cv;
+ }
+ return undef;
}
sub config {
@@ -268,10 +289,14 @@
warn "[FS::Conf] SET $name\n" if $DEBUG;
- my $old = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum});
- my $new = new FS::conf { $old ? $old->hash
- : ('name' => $name, 'agentnum' => $agentnum)
+ my $hashref = {
+ name => $name,
+ agentnum => $agentnum,
+ locale => $self->{locale}
};
+
+ my $old = FS::Record::qsearchs('conf', $hashref);
+ my $new = new FS::conf { $old ? $old->hash : %$hashref };
$new->value($value);
my $error;
@@ -312,7 +337,7 @@
return $self->_usecompat('delete', @_) if use_confcompat;
my($name, $agentnum) = @_;
- if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum}) ) {
+ if ( my $cv = FS::Record::qsearchs('conf', {name => $name, agentnum => $agentnum, locale => $self->{locale}}) ) {
warn "[FS::Conf] DELETE $name\n" if $DEBUG;
my $oldAutoCommit = $FS::UID::AutoCommit;
@@ -1035,6 +1060,7 @@
'description' => 'Subject: header on email invoices. Defaults to "Invoice". The following substitutions are available: $name, $name_short, $invoice_number, and $invoice_date.',
'type' => 'text',
'per_agent' => 1,
+ 'per_locale' => 1,
},
{
@@ -1065,6 +1091,7 @@
'description' => 'Notes section for HTML invoices. Defaults to the same data in invoice_latexnotes if not specified.',
'type' => 'textarea',
'per_agent' => 1,
+ 'per_locale' => 1,
},
{
@@ -1073,6 +1100,7 @@
'description' => 'Footer for HTML invoices. Defaults to the same data in invoice_latexfooter if not specified.',
'type' => 'textarea',
'per_agent' => 1,
+ 'per_locale' => 1,
},
{
@@ -1081,6 +1109,7 @@
'description' => 'Summary initial page for HTML invoices.',
'type' => 'textarea',
'per_agent' => 1,
+ 'per_locale' => 1,
},
{
@@ -1088,6 +1117,7 @@
'section' => 'invoicing',
'description' => 'Return address for HTML invoices. Defaults to the same data in invoice_latexreturnaddress if not specified.',
'type' => 'textarea',
+ 'per_locale' => 1,
},
{
@@ -1152,6 +1182,7 @@
'description' => 'Notes section for LaTeX typeset PostScript invoices.',
'type' => 'textarea',
'per_agent' => 1,
+ 'per_locale' => 1,
},
{
@@ -1160,6 +1191,7 @@
'description' => 'Footer for LaTeX typeset PostScript invoices.',
'type' => 'textarea',
'per_agent' => 1,
+ 'per_locale' => 1,
},
{
@@ -1168,6 +1200,7 @@
'description' => 'Summary initial page for LaTeX typeset PostScript invoices.',
'type' => 'textarea',
'per_agent' => 1,
+ 'per_locale' => 1,
},
{
@@ -1176,6 +1209,7 @@
'description' => 'Remittance coupon for LaTeX typeset PostScript invoices.',
'type' => 'textarea',
'per_agent' => 1,
+ 'per_locale' => 1,
},
{
@@ -1254,6 +1288,7 @@
'description' => 'Optional small footer for multi-page LaTeX typeset PostScript invoices.',
'type' => 'textarea',
'per_agent' => 1,
+ 'per_locale' => 1,
},
{
@@ -1832,7 +1867,12 @@
'section' => 'UI',
'description' => 'Default locale',
'type' => 'select',
- 'select_enum' => [ FS::Locales->locales ],
+ 'options_sub' => sub {
+ map { $_ => FS::Locales->description($_) } FS::Locales->locales;
+ },
+ 'option_sub' => sub {
+ FS::Locales->description(shift)
+ },
},
{
@@ -3361,6 +3401,7 @@
'type' => 'image',
'per_agent' => 1, #XXX just view/logo.cgi, which is for the global
#old-style editor anyway...?
+ 'per_locale' => 1,
},
{
@@ -3369,6 +3410,7 @@
'description' => 'Company logo for printed and PDF invoices, in EPS format.',
'type' => 'image',
'per_agent' => 1, #XXX as above, kinda
+ 'per_locale' => 1,
},
{
@@ -4554,6 +4596,20 @@
},
{
+ 'key' => 'available-locales',
+ 'section' => '',
+ 'description' => 'Limit available locales (employee preferences, per-customer locale selection, etc.) to a particular set.',
+ 'type' => 'select-sub',
+ 'multiple' => 1,
+ 'options_sub' => sub {
+ map { $_ => FS::Locales->description($_) }
+ grep { $_ ne 'en_US' }
+ FS::Locales->locales;
+ },
+ 'option_sub' => sub { FS::Locales->description(shift) },
+ },
+
+ {
'key' => 'translate-auto-insert',
'section' => '',
'description' => 'Auto-insert untranslated strings for selected non-en_US locales with their default/en_US values. DO NOT TURN THIS ON.',
Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.350.2.3
retrieving revision 1.350.2.4
diff -u -w -d -r1.350.2.3 -r1.350.2.4
--- cust_bill.pm 2 Aug 2011 05:45:21 -0000 1.350.2.3
+++ cust_bill.pm 16 Sep 2011 00:15:46 -0000 1.350.2.4
@@ -1,8 +1,9 @@
package FS::cust_bill;
use strict;
-use vars qw( @ISA $DEBUG $me $conf
+use vars qw( @ISA $DEBUG $me
$money_char $date_format $rdate_format $date_format_long );
+ # but NOT $conf
use vars qw( $invoice_lines @buf ); #yuck
use Fcntl qw(:flock); #for spool_csv
use Cwd;
@@ -41,6 +42,7 @@
use FS::cust_bill_batch;
use FS::cust_bill_pay_pkg;
use FS::cust_credit_bill_pkg;
+use FS::L10N;
@ISA = qw( FS::cust_main_Mixin FS::Record );
@@ -49,7 +51,7 @@
#ask FS::UID to run this stuff for us later
FS::UID->install_callback( sub {
- $conf = new FS::Conf;
+ my $conf = new FS::Conf; #global
$money_char = $conf->config('money_char') || '$';
$date_format = $conf->config('date_format') || '%x'; #/YY
$rdate_format = $conf->config('date_format') || '%m/%d/%Y'; #/YYYY
@@ -364,6 +366,7 @@
sub display_invnum {
my $self = shift;
+ my $conf = $self->conf;
if ( $conf->exists('cust_bill-default_agent_invid') && $self->agent_invid ){
return $self->agent_invid;
} else {
@@ -807,6 +810,7 @@
sub apply_payments_and_credits {
my( $self, %options ) = @_;
+ my $conf = $self->conf;
local $SIG{HUP} = 'IGNORE';
local $SIG{INT} = 'IGNORE';
@@ -955,6 +959,7 @@
my $self = shift;
my %args = @_;
+ my $conf = $self->conf;
my $me = '[FS::cust_bill::generate_email]';
@@ -989,7 +994,7 @@
my $alternative = build MIME::Entity
'Type' => 'multipart/alternative',
- 'Encoding' => '7bit',
+ #'Encoding' => '7bit',
'Disposition' => 'inline'
;
@@ -1017,8 +1022,8 @@
$alternative->attach(
'Type' => 'text/plain',
- #'Encoding' => 'quoted-printable',
- 'Encoding' => '7bit',
+ 'Encoding' => 'quoted-printable',
+ #'Encoding' => '7bit',
'Data' => $data,
'Disposition' => 'inline',
);
@@ -1240,6 +1245,7 @@
sub send {
my $self = shift;
+ my $conf = $self->conf;
my( $template, $invoice_from, $notice_name );
my $agentnums = '';
@@ -1329,6 +1335,7 @@
#sub email_invoice {
sub email {
my $self = shift;
+ my $conf = $self->conf;
my( $template, $invoice_from, $notice_name, $no_coupon );
if ( ref($_[0]) ) {
@@ -1378,6 +1385,7 @@
sub email_subject {
my $self = shift;
+ my $conf = $self->conf;
#my $template = scalar(@_) ? shift : '';
#per-template?
@@ -1409,6 +1417,7 @@
sub lpr_data {
my $self = shift;
+ my $conf = $self->conf;
my( $template, $notice_name );
if ( ref($_[0]) ) {
my $opt = shift;
@@ -1444,6 +1453,7 @@
#sub print_invoice {
sub print {
my $self = shift;
+ my $conf = $self->conf;
my( $template, $notice_name );
if ( ref($_[0]) ) {
my $opt = shift;
@@ -1483,6 +1493,7 @@
sub fax_invoice {
my $self = shift;
+ my $conf = $self->conf;
my( $template, $notice_name );
if ( ref($_[0]) ) {
my $opt = shift;
@@ -1538,6 +1549,7 @@
sub get_open_bill_batch {
my $self = shift;
+ my $conf = $self->conf;
my $hashref = { status => 'O' };
$hashref->{'agentnum'} = $conf->exists('invoice_print_pdf-spoolagent')
? $self->cust_main->agentnum
@@ -1560,6 +1572,7 @@
sub ftp_invoice {
my $self = shift;
+ my $conf = $self->conf;
my $template = scalar(@_) ? shift : '';
$self->send_csv(
@@ -1582,6 +1595,7 @@
sub spool_invoice {
my $self = shift;
+ my $conf = $self->conf;
my $template = scalar(@_) ? shift : '';
$self->spool_csv(
@@ -2091,6 +2105,7 @@
sub realtime_bop {
my( $self, $method ) = (shift,shift);
+ my $conf = $self->conf;
my %opt = @_;
my $cust_main = $self->cust_main;
@@ -2219,6 +2234,7 @@
sub print_latex {
my $self = shift;
+ my $conf = $self->conf;
my( $today, $template, %opt );
if ( ref($_[0]) ) {
%opt = %{ shift() };
@@ -2284,6 +2300,7 @@
SUFFIX => '.tex',
UNLINK => 0,
) or die "can't open temp file: $!\n";
+ binmode($fh, ':utf8'); # language support
print $fh join('', @filled_in );
close $fh;
@@ -2352,6 +2369,7 @@
# yes: fixed width (dot matrix) text printing will be borked
sub print_generic {
my( $self, %params ) = @_;
+ my $conf = $self->conf;
my $today = $params{today} ? $params{today} : time;
warn "$me print_generic called on $self with suffix $params{template}\n"
if $DEBUG;
@@ -2636,6 +2654,10 @@
);
+ #localization
+ my $lh = FS::L10N->get_handle($cust_main->locale);
+ $invoice_data{'emt'} = sub { &$escape_function($self->mt(@_)) };
+
my $min_sdate = 999999999999;
my $max_edate = 0;
foreach my $cust_bill_pkg ( $self->cust_bill_pkg ) {
@@ -2772,7 +2794,7 @@
$invoice_data{'po_line'} =
( $cust_main->payby eq 'BILL' && $cust_main->payinfo )
- ? &$escape_function("Purchase Order #". $cust_main->payinfo)
+ ? &$escape_function($self->mt("Purchase Order #").$cust_main->payinfo)
: $nbsp;
my %money_chars = ( 'latex' => '',
@@ -2801,7 +2823,7 @@
warn "$me generating sections\n"
if $DEBUG > 1;
- my $previous_section = { 'description' => 'Previous Charges',
+ my $previous_section = { 'description' => $self->mt('Previous Charges'),
'subtotal' => $other_money_char.
sprintf('%.2f', $pr_total),
'summarized' => $summarypage ? 'Y' : '',
@@ -2813,7 +2835,7 @@
if $conf->exists('invoice_include_aging');
my $taxtotal = 0;
- my $tax_section = { 'description' => 'Taxes, Surcharges, and Fees',
+ my $tax_section = { 'description' => $self->mt('Taxes, Surcharges, and Fees'),
'subtotal' => $taxtotal, # adjusted below
'summarized' => $summarypage ? 'Y' : '',
};
@@ -2825,7 +2847,8 @@
my $adjusttotal = 0;
- my $adjust_section = { 'description' => 'Credits, Payments, and Adjustments',
+ my $adjust_section = { 'description' =>
+ $self->mt('Credits, Payments, and Adjustments'),
'subtotal' => 0, # adjusted below
'summarized' => $summarypage ? 'Y' : '',
};
@@ -2910,7 +2933,7 @@
if ( @pr_cust_bill && !$conf->exists('disable_previous_balance') ) {
push @buf, ['','-----------'];
- push @buf, [ 'Total Previous Balance',
+ push @buf, [ $self->mt('Total Previous Balance'),
$money_char. sprintf("%10.2f", $pr_total) ];
push @buf, ['',''];
}
@@ -3066,7 +3089,7 @@
if ( $taxtotal ) {
my $total = {};
- $total->{'total_item'} = 'Sub-total';
+ $total->{'total_item'} = $self->mt('Sub-total');
$total->{'total_amount'} =
$other_money_char. sprintf('%.2f', $self->charged - $taxtotal );
@@ -3083,7 +3106,8 @@
$invoice_data{'taxtotal'} = sprintf('%.2f', $taxtotal);
push @buf,['','-----------'];
- push @buf,[( $conf->exists('disable_previous_balance')
+ push @buf,[$self->mt(
+ $conf->exists('disable_previous_balance')
? 'Total Charges'
: 'Total New Charges'
),
@@ -3092,7 +3116,7 @@
{
my $total = {};
- my $item = 'Total';
+ my $item = $self->mt('Total');
$item = $conf->config('previous_balance-exclude_from_total')
|| 'Total New Charges'
if $conf->exists('previous_balance-exclude_from_total');
@@ -3107,11 +3131,11 @@
&$embolden_function( $other_money_char. sprintf( '%.2f', $amount ) );
if ( $multisection ) {
if ( $adjust_section->{'sort_weight'} ) {
- $adjust_section->{'posttotal'} = 'Balance Forward '. $other_money_char.
- sprintf("%.2f", ($self->billing_balance || 0) );
+ $adjust_section->{'posttotal'} = $self->mt('Balance Forward').' '.
+ $other_money_char. sprintf("%.2f", ($self->billing_balance || 0) );
} else {
- $adjust_section->{'pretotal'} = 'New charges total '. $other_money_char.
- sprintf('%.2f', $self->charged );
+ $adjust_section->{'pretotal'} = $self->mt('New charges total').' '.
+ $other_money_char. sprintf('%.2f', $self->charged );
}
}else{
push @total_items, $total;
@@ -3316,25 +3340,24 @@
}
#setup subroutine for the template
- sub FS::cust_bill::_template::invoice_lines {
- my $lines = shift || scalar(@FS::cust_bill::_template::buf);
+ #sub FS::cust_bill::_template::invoice_lines { # good god, no
+ $invoice_data{invoice_lines} = sub { # much better
+ my $lines = shift || scalar(@buf);
map {
- scalar(@FS::cust_bill::_template::buf)
- ? shift @FS::cust_bill::_template::buf
+ scalar(@buf)
+ ? shift @buf
: [ '', '' ];
}
( 1 .. $lines );
- }
+ };
my $lines;
my @collect;
while (@buf) {
push @collect, split("\n",
- $text_template->fill_in( HASH => \%invoice_data,
- PACKAGE => 'FS::cust_bill::_template'
- )
+ $text_template->fill_in( HASH => \%invoice_data )
);
- $FS::cust_bill::_template::page++;
+ $invoice_data{'page'}++;
}
map "$_\n", @collect;
}else{
@@ -3546,6 +3569,7 @@
sub terms {
my $self = shift;
+ my $conf = $self->conf;
#check for an invoice-specific override
return $self->invoice_terms if $self->invoice_terms;
@@ -3574,10 +3598,11 @@
sub balance_due_msg {
my $self = shift;
- my $msg = 'Balance Due';
+ my $msg = $self->mt('Balance Due');
return $msg unless $self->terms;
if ( $self->due_date ) {
- $msg .= ' - Please pay by '. $self->due_date2str($date_format);
+ $msg .= ' - ' . $self->mt('Please pay by'). ' '.
+ $self->due_date2str($date_format);
} elsif ( $self->terms ) {
$msg .= ' - '. $self->terms;
}
@@ -3586,6 +3611,7 @@
sub balance_due_date {
my $self = shift;
+ my $conf = $self->conf;
my $duedate = '';
if ( $conf->exists('invoice_default_terms')
&& $conf->config('invoice_default_terms')=~ /^\s*Net\s*(\d+)\s*$/ ) {
@@ -3594,7 +3620,10 @@
$duedate;
}
-sub credit_balance_msg { 'Credit Balance Remaining' }
+sub credit_balance_msg {
+ my $self = shift;
+ $self->mt('Credit Balance Remaining')
+}
=item invnum_date_pretty
@@ -3605,7 +3634,7 @@
sub invnum_date_pretty {
my $self = shift;
- 'Invoice #'. $self->invnum. ' ('. $self->_date_pretty. ')';
+ $self->mt('Invoice #'). $self->invnum. ' ('. $self->_date_pretty. ')';
}
=item _date_pretty
@@ -4011,6 +4040,7 @@
sub _items_extra_usage_sections {
my $self = shift;
+ my $conf = $self->conf;
my $escape = shift;
my $format = shift;
@@ -4250,6 +4280,7 @@
sub _items_svc_phone_sections {
my $self = shift;
+ my $conf = $self->conf;
my $escape = shift;
my $format = shift;
@@ -4497,6 +4528,7 @@
sub _items_previous {
my $self = shift;
+ my $conf = $self->conf;
my $cust_main = $self->cust_main;
my( $pr_total, @pr_cust_bill ) = $self->previous; #previous balance
my @b = ();
@@ -4505,7 +4537,7 @@
? 'due '. $_->due_date2str($date_format)
: time2str($date_format, $_->_date);
push @b, {
- 'description' => 'Previous Balance, Invoice #'. $_->invnum. " ($date)",
+ 'description' => $self->mt('Previous Balance, Invoice #'). $_->invnum. " ($date)",
#'pkgpart' => 'N/A',
'pkgnum' => 'N/A',
'amount' => sprintf("%.2f", $_->owed),
@@ -4588,6 +4620,7 @@
sub _items_cust_bill_pkg {
my $self = shift;
+ my $conf = $self->conf;
my $cust_bill_pkgs = shift;
my %opt = @_;
@@ -4913,7 +4946,7 @@
#'description' => 'Credit ref\#'. $_->crednum.
# " (". time2str("%x",$_->cust_credit->_date) .")".
# $reason,
- 'description' => 'Credit applied '.
+ 'description' => $self->mt('Credit applied').' '.
time2str($date_format,$_->cust_credit->_date). $reason,
'amount' => sprintf("%.2f",$_->amount),
};
@@ -4933,7 +4966,7 @@
#something more elaborate if $_->amount ne ->cust_pay->paid ?
push @b, {
- 'description' => "Payment received ".
+ 'description' => $self->mt('Payment received').' '.
time2str($date_format,$_->cust_pay->_date ),
'amount' => sprintf("%.2f", $_->amount )
};
@@ -5159,6 +5192,7 @@
=cut
sub due_date_sql {
+ my $conf = new FS::Conf;
'COALESCE(
SUBSTRING(
COALESCE(
Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.317.2.6
retrieving revision 1.317.2.7
diff -u -w -d -r1.317.2.6 -r1.317.2.7
--- Schema.pm 12 Sep 2011 21:12:10 -0000 1.317.2.6
+++ Schema.pm 16 Sep 2011 00:15:46 -0000 1.317.2.7
@@ -884,6 +884,7 @@
'accountcode_cdr', 'char', 'NULL', 1, '', '',
'billday', 'int', 'NULL', '', '', '',
'edit_subject', 'char', 'NULL', 1, '', '',
+ 'locale', 'varchar', 'NULL', 16, '', '',
],
'primary_key' => 'custnum',
'unique' => [ [ 'agentnum', 'agent_custid' ] ],
@@ -3267,11 +3268,12 @@
'columns' => [
'confnum', 'serial', '', '', '', '',
'agentnum', 'int', 'NULL', '', '', '',
+ 'locale', 'varchar','NULL', 16, '', '',
'name', 'varchar', '', $char_d, '', '',
'value', 'text', 'NULL', '', '', '',
],
'primary_key' => 'confnum',
- 'unique' => [ [ 'agentnum', 'name' ]],
+ 'unique' => [ [ 'agentnum', 'locale', 'name' ] ],
'index' => [],
},
Index: Locales.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Locales.pm,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -w -d -r1.1 -r1.1.2.1
--- Locales.pm 11 May 2011 16:20:12 -0000 1.1
+++ Locales.pm 16 Sep 2011 00:15:46 -0000 1.1.2.1
@@ -28,7 +28,10 @@
=cut
tie our %locales, 'Tie::IxHash',
+ 'en_CA', { name => 'English', country => 'Canada', },
'en_US', { name => 'English', country => 'United States', },
+ 'fr_CA', { name => 'French', country => 'Canada', },
+ 'fr_FR', { name => 'French', country => 'France', },
'iw_IL', { name => 'Hebrew', country => 'Israel', rtl=>1, },
;
@@ -47,6 +50,17 @@
%{ $locales{$locale} };
}
+=item description LOCALE
+
+Returns "Language (Country)" for a locale.
+
+=cut
+
+sub description {
+ my($class, $locale) = @_;
+ $locales{$locale}->{'name'} . ' (' . $locales{$locale}->{'country'} . ')';
+}
+
=back
=head1 BUGS
- Previous message: [freeside-commits] freeside/FS/FS/ClientAPI MyAccount.pm, 1.133.2.5, 1.133.2.6
- Next message: [freeside-commits] freeside/FS/FS/L10N en_ca.pm, NONE, 1.1.2.2 en_us.pm, 1.1, 1.1.2.1 fr_ca.pm, NONE, 1.1.2.2 fr_fr.pm, NONE, 1.1.2.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list