[freeside-commits] freeside/FS/FS cust_bill.pm, 1.163.2.24, 1.163.2.25

Ivan,,, ivan at wavetail.420.am
Sat May 31 17:12:21 PDT 2008


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv29753

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	cust_bill.pm 
Log Message:
fix problems when service definition names contain chars that need to be latex escaped

Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.163.2.24
retrieving revision 1.163.2.25
diff -u -d -r1.163.2.24 -r1.163.2.25
--- cust_bill.pm	30 May 2008 03:55:52 -0000	1.163.2.24
+++ cust_bill.pm	1 Jun 2008 00:12:19 -0000	1.163.2.25
@@ -2388,11 +2388,14 @@
 
 sub _items {
   my $self = shift;
-  my @display = scalar(@_)
-                ? @_
-                : qw( _items_previous _items_pkg );
-                #: qw( _items_pkg );
-                #: qw( _items_previous _items_pkg _items_tax _items_credits _items_payments );
+
+  #my @display = scalar(@_)
+  #              ? @_
+  #              : qw( _items_previous _items_pkg );
+  #              #: qw( _items_pkg );
+  #              #: qw( _items_previous _items_pkg _items_tax _items_credits _items_payments );
+  my @display = qw( _items_previous _items_pkg );
+
   my @b = ();
   foreach my $display ( @display ) {
     push @b, $self->$display(@_);
@@ -2446,6 +2449,7 @@
   my $self = shift;
   my $cust_bill_pkg = shift;
   my %opt = @_;
+
   my $format = $opt{format} || '';
   my $escape_function = $opt{escape_function} || sub { shift };
 
@@ -2456,16 +2460,22 @@
 
     my $desc = $cust_bill_pkg->desc;
 
+    my %details_opt = ( 'format'          => $format,
+                        'escape_function' => $escape_function,
+                      );
+
     if ( $cust_bill_pkg->pkgnum > 0 ) {
 
       if ( $cust_bill_pkg->setup != 0 ) {
+
         my $description = $desc;
         $description .= ' Setup' if $cust_bill_pkg->recur != 0;
-        my @d = $cust_pkg->h_labels_short($self->_date);
-        push @d, $cust_bill_pkg->details( 'format'          => $format,
-                                          'escape_function' => $escape_function,
-                                        )
+
+        my @d = map &{$escape_function}($_),
+                       $cust_pkg->h_labels_short($self->_date);
+        push @d, $cust_bill_pkg->details(%details_opt)
           if $cust_bill_pkg->recur == 0;
+
         push @b, {
           description     => $description,
           #pkgpart         => $part_pkg->pkgpart,
@@ -2476,26 +2486,30 @@
       }
 
       if ( $cust_bill_pkg->recur != 0 ) {
+
+        my $description = $desc;
+        unless ( $conf->exists('disable_line_item_date_ranges') ) {
+          $desc .= " (" . time2str("%x", $cust_bill_pkg->sdate).
+                   " - ". time2str("%x", $cust_bill_pkg->edate). ")";
+        }
+
+        #at least until cust_bill_pkg has "past" ranges in addition to
+        #the "future" sdate/edate ones... see #3032
+        my @d = map &{$escape_function}($_),
+                    $cust_pkg->h_labels_short($self->_date);
+                                              #$cust_bill_pkg->edate,
+                                              #$cust_bill_pkg->sdate),
+        push @d, $cust_bill_pkg->details(%details_opt);
+
         push @b, {
-          description     => $desc .
-                             ( $conf->exists('disable_line_item_date_ranges')
-                               ? ''
-                               : " (" .time2str("%x", $cust_bill_pkg->sdate).
-                                 " - ".time2str("%x", $cust_bill_pkg->edate).")"
-                             ),
+          description     => $description,
           #pkgpart         => $part_pkg->pkgpart,
           pkgnum          => $cust_bill_pkg->pkgnum,
           amount          => sprintf("%.2f", $cust_bill_pkg->recur),
-          ext_description =>
-            #at least until cust_bill_pkg has "past" ranges in addition to
-            #the "future" sdate/edate ones... see #3032
-            [ $cust_pkg->h_labels_short( $self->_date ),
-                                         #$cust_bill_pkg->edate,
-                                         #$cust_bill_pkg->sdate),
-              $cust_bill_pkg->details( 'format'          => $format,
-                                       'escape_function' => $escape_function),
-            ],
+          ext_description => \@d,
+
         };
+
       }
 
     } else { #pkgnum tax or one-shot line item (??)



More information about the freeside-commits mailing list