diff options
| author | ivan <ivan> | 2008-06-01 00:12:19 +0000 | 
|---|---|---|
| committer | ivan <ivan> | 2008-06-01 00:12:19 +0000 | 
| commit | 2d80630393cea3c959d2d0ae2d7e6fcc6e1d82c8 (patch) | |
| tree | 6e06d590037a6b5173f7a88d7edcf6cdc08b673d | |
| parent | e1cf70a6fade4c393739300d26b1e69bc954689b (diff) | |
fix problems when service definition names contain chars that need to be latex escaped
| -rw-r--r-- | FS/FS/cust_bill.pm | 62 | 
1 files changed, 38 insertions, 24 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 8c17efa19..844204d02 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -2388,11 +2388,14 @@ sub balance_due_msg {  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 @@ sub _items_cust_bill_pkg {    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 @@ sub _items_cust_bill_pkg {      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 @@ sub _items_cust_bill_pkg {        }        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 (??)  | 
