From: Ivan Kohler Date: Thu, 28 Mar 2013 02:45:19 +0000 (-0700) Subject: use part_pkg_msgcat on invoice line items, RT#19906 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=1724266692e1e3ebe8d71a540077ddee92118bb2 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 324f05248..8b0e16a2d 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 e3958a436..2e78f12f4 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 40fb1dcb4..e788269f7 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 d1d54fc4c..fadde354e 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;