X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_bill.pm;h=f536c972c9ff934908d7d063d85c03b31e78837a;hb=6626dc2a13c809092aa539c5a72bc72a0c56afdc;hp=11e198d7e91f392b2cc44937aa03c6c933aaacf9;hpb=18aac042442f4ad51e22dc5ffd070865eb92d38b;p=freeside.git diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 11e198d7e..f536c972c 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -1876,8 +1876,8 @@ sub print_generic { my $convert_map = $convert_maps{$format}{$include}; - @inc_src = map { s/\[@--/$delimiters{$format}[0]/g; - s/--@\]/$delimiters{$format}[1]/g; + @inc_src = map { s/\[\@--/$delimiters{$format}[0]/g; + s/--\@\]/$delimiters{$format}[1]/g; $_; } &$convert_map( $conf->config($inc_file) ); @@ -2486,9 +2486,18 @@ sub _items_pkg { $self->_items_cust_bill_pkg(\@cust_bill_pkg, %options); } +sub _taxsort { + return 0 unless $a cmp $b; + return -1 if $b eq 'Tax'; + return 1 if $a eq 'Tax'; + return -1 if $b eq 'Other surcharges'; + return 1 if $a eq 'Other surcharges'; + $a cmp $b; +} + sub _items_tax { my $self = shift; - my @cust_bill_pkg = grep { ! $_->pkgnum } $self->cust_bill_pkg; + my @cust_bill_pkg = sort _taxsort grep { ! $_->pkgnum } $self->cust_bill_pkg; $self->_items_cust_bill_pkg(\@cust_bill_pkg, @_); } @@ -2499,6 +2508,8 @@ sub _items_cust_bill_pkg { my @b = (); foreach my $cust_bill_pkg ( @$cust_bill_pkg ) { + my $cust_pkg = $cust_bill_pkg->cust_pkg; + my $desc = $cust_bill_pkg->desc; if ( $cust_bill_pkg->pkgnum > 0 ) { @@ -2506,7 +2517,7 @@ sub _items_cust_bill_pkg { if ( $cust_bill_pkg->setup != 0 ) { my $description = $desc; $description .= ' Setup' if $cust_bill_pkg->recur != 0; - my @d = $cust_bill_pkg->cust_pkg->h_labels_short($self->_date); + my @d = $cust_pkg->h_labels_short($self->_date); push @d, $cust_bill_pkg->details if $cust_bill_pkg->recur == 0; push @b, { description => $description, @@ -2529,8 +2540,11 @@ sub _items_cust_bill_pkg { pkgnum => $cust_bill_pkg->pkgnum, amount => sprintf("%.2f", $cust_bill_pkg->recur), ext_description => - [ $cust_bill_pkg->cust_pkg->h_labels_short( $cust_bill_pkg->edate, - $cust_bill_pkg->sdate), + #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, ], };