use part_pkg_msgcat on invoice line items, RT#19906
authorIvan Kohler <ivan@freeside.biz>
Thu, 28 Mar 2013 02:45:19 +0000 (19:45 -0700)
committerIvan Kohler <ivan@freeside.biz>
Thu, 28 Mar 2013 02:45:19 +0000 (19:45 -0700)
FS/FS/TemplateItem_Mixin.pm
FS/FS/Template_Mixin.pm
FS/FS/part_pkg.pm
httemplate/edit/part_pkg.cgi

index 324f052..8b0e16a 100644 (file)
@@ -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/;
index e3958a4..2e78f12 100644 (file)
@@ -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;
 
index 40fb1dc..e788269 100644 (file)
@@ -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;
 }
index d1d54fc..fadde35 100755 (executable)
@@ -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;