fix invoice for cust_bill_pkg missing cust_pkg, RT#27745
authorIvan Kohler <ivan@freeside.biz>
Thu, 27 Feb 2014 02:43:44 +0000 (18:43 -0800)
committerIvan Kohler <ivan@freeside.biz>
Thu, 27 Feb 2014 02:43:44 +0000 (18:43 -0800)
FS/FS/TemplateItem_Mixin.pm

index bf857a9..fa20c24 100644 (file)
@@ -61,14 +61,19 @@ sub desc {
   my( $self, $locale ) = @_;
 
   if ( $self->pkgnum > 0 ) {
   my( $self, $locale ) = @_;
 
   if ( $self->pkgnum > 0 ) {
-    $self->itemdesc || $self->part_pkg->pkg_locale($locale);
+    return $self->itemdesc if $self->itemdesc;
+    my $part_pkg = $self->part_pkg or return 'UNKNOWN';
+    return $part_pkg->pkg_locale($locale);
+
   } elsif ( $self->feepart ) {
   } elsif ( $self->feepart ) {
-    $self->part_fee->itemdesc_locale($locale);
+    return $self->part_fee->itemdesc_locale($locale);
+
   } else { # by the process of elimination it must be a tax
     my $desc = $self->itemdesc || 'Tax';
     $desc .= ' '. $self->itemcomment if $self->itemcomment =~ /\S/;
   } else { # by the process of elimination it must be a tax
     my $desc = $self->itemdesc || 'Tax';
     $desc .= ' '. $self->itemcomment if $self->itemcomment =~ /\S/;
-    $desc;
+    return $desc;
   }
   }
+
 }
 
 =item time_period_pretty PART_PKG, AGENTNUM
 }
 
 =item time_period_pretty PART_PKG, AGENTNUM