[freeside-commits] branch FREESIDE_3_BRANCH updated. 89eff2af607109c7e8f3afd779622ce17a419d13

Mark Wells mark at 420.am
Fri Sep 6 17:32:30 PDT 2013


The branch, FREESIDE_3_BRANCH has been updated
       via  89eff2af607109c7e8f3afd779622ce17a419d13 (commit)
      from  d67217095193ef9b977b907a256a90befd7be493 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 89eff2af607109c7e8f3afd779622ce17a419d13
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Sep 6 17:32:03 2013 -0700

    fix usage summary line for bundled packages in some cases, #13909

diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm
index dc3b93d..db38854 100644
--- a/FS/FS/Template_Mixin.pm
+++ b/FS/FS/Template_Mixin.pm
@@ -2542,8 +2542,10 @@ sub _items_cust_bill_pkg {
             if $DEBUG > 1;
 
           my $is_summary = $display->summary;
-          my $description = ($is_summary && $type && $type eq 'U')
-                            ? "Usage charges" : $desc;
+          my $description = $desc;
+          if ( $type eq 'U' and ($is_summary or $cust_bill_pkg->hidden) ) {
+            $description = $self->mt('Usage charges');
+          }
 
           my $part_pkg = $cust_pkg->part_pkg;
 
@@ -2701,11 +2703,15 @@ sub _items_cust_bill_pkg {
             warn "$me _items_cust_bill_pkg adding usage\n"
               if $DEBUG > 1;
 
-            if ( $cust_bill_pkg->hidden ) {
+            if ( $cust_bill_pkg->hidden and defined($u) ) {
+              # if this is a hidden package and there's already a usage
+              # line for the bundle, add this package's total amount and
+              # usage details to it
               $u->{amount}      += $amount;
               $u->{unit_amount} += $unit_amount,
               push @{ $u->{ext_description} }, @d;
-            } else {
+            } elsif ( $amount ) {
+              # create a new usage line
               $u = {
                 description     => $description,
                 pkgpart         => $pkgpart,
@@ -2717,7 +2723,7 @@ sub _items_cust_bill_pkg {
                 %item_dates,
                 ext_description => \@d,
               };
-            }
+            } # else this has no usage, so don't create a usage section
           }
 
         } # recurring or usage with recurring charge

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Template_Mixin.pm |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)




More information about the freeside-commits mailing list