[freeside-commits] branch master updated. 1724266692e1e3ebe8d71a540077ddee92118bb2
Ivan
ivan at 420.am
Wed Mar 27 19:45:23 PDT 2013
The branch, master has been updated
via 1724266692e1e3ebe8d71a540077ddee92118bb2 (commit)
from 3512d4ac59e1b0364ac9e42308bd91972e8085bf (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 1724266692e1e3ebe8d71a540077ddee92118bb2
Author: Ivan Kohler <ivan at freeside.biz>
Date: Wed Mar 27 19:45:19 2013 -0700
use part_pkg_msgcat on invoice line items, RT#19906
diff --git a/FS/FS/TemplateItem_Mixin.pm b/FS/FS/TemplateItem_Mixin.pm
index 324f052..8b0e16a 100644
--- a/FS/FS/TemplateItem_Mixin.pm
+++ b/FS/FS/TemplateItem_Mixin.pm
@@ -52,10 +52,10 @@ line item, and for generic taxes, simply returns "Tax".
=cut
sub desc {
- my $self = shift;
+ my( $self, $locale ) = @_;
if ( $self->pkgnum > 0 ) {
- $self->itemdesc || $self->part_pkg->pkg;
+ $self->itemdesc || $self->part_pkg->pkg_locale($locale);
} else {
my $desc = $self->itemdesc || 'Tax';
$desc .= ' '. $self->itemcomment if $self->itemcomment =~ /\S/;
diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm
index e3958a4..2e78f12 100644
--- a/FS/FS/Template_Mixin.pm
+++ b/FS/FS/Template_Mixin.pm
@@ -2181,6 +2181,7 @@ sub _items_cust_bill_pkg {
my $cust_main = $self->cust_main;#for per-agent cust_bill-line_item-ate_style
# and location labels
+ my $locale = $cust_main->locale;
my @b = ();
my ($s, $r, $u) = ( undef, undef, undef );
@@ -2225,7 +2226,7 @@ sub _items_cust_bill_pkg {
my $type = $display->type;
- my $desc = $cust_bill_pkg->desc;
+ my $desc = $cust_bill_pkg->desc( $cust_main->locale );
$desc = substr($desc, 0, $maxlength). '...'
if $format eq 'latex' && length($desc) > $maxlength;
diff --git a/FS/FS/part_pkg.pm b/FS/FS/part_pkg.pm
index 40fb1dc..e788269 100644
--- a/FS/FS/part_pkg.pm
+++ b/FS/FS/part_pkg.pm
@@ -719,13 +719,14 @@ sub propagate {
=item pkg_locale LOCALE
Returns a customer-viewable string representing this package for the given
-locale, from the part_pkg_msgcat table. If no localized string is found,
-returns the base pkg field.
+locale, from the part_pkg_msgcat table. If the given locale is empty or no
+localized string is found, returns the base pkg field.
=cut
sub pkg_locale {
my( $self, $locale ) = @_;
+ return $self->pkg unless $locale;
my $part_pkg_msgcat = $self->part_pkg_msgcat($locale) or return $self->pkg;
$part_pkg_msgcat->pkg;
}
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index d1d54fc..fadde35 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -339,7 +339,7 @@ my $agent_clone_extra_sql =
my $conf = new FS::Conf;
my $taxproducts = $conf->exists('enable_taxproducts');
-my @locales = grep { ! /^en_/i } $conf->config('available-locales');
+my @locales = grep { ! /^en_/i } $conf->config('available-locales'); #should filter from the default locale lang instead of en_
my %locale_labels = map {
( $_ => 'Package -- '. FS::Locales->description($_) )
} @locales;
-----------------------------------------------------------------------
Summary of changes:
FS/FS/TemplateItem_Mixin.pm | 4 ++--
FS/FS/Template_Mixin.pm | 3 ++-
FS/FS/part_pkg.pm | 5 +++--
httemplate/edit/part_pkg.cgi | 2 +-
4 files changed, 8 insertions(+), 6 deletions(-)
More information about the freeside-commits
mailing list