summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2013-09-06 17:32:12 -0700
committerMark Wells <mark@freeside.biz>2013-09-06 17:32:12 -0700
commitcbb4e35133ff70b5be47660b0ed2f0fde22ddc19 (patch)
tree8c06612b2ff776a3ecd550def8a1736266369c4d /FS
parent57d9974e8e0164453ad7e6b5df4cd8cd78897ef0 (diff)
fix usage summary line for bundled packages in some cases, #13909
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/Template_Mixin.pm16
1 files changed, 11 insertions, 5 deletions
diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm
index dc3b93dd7..db3885443 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