diff options
author | Mark Wells <mark@freeside.biz> | 2014-05-09 12:25:44 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2014-05-09 12:25:44 -0700 |
commit | 7c1cc70e0d76ab8a26fc3b9dca8f20978c71e3d8 (patch) | |
tree | be4a60354b9dcbe30e837ed2000b0bb98fc426ed | |
parent | d3aa3f6d535a70bfe9a6b9ceeaf98127982824a9 (diff) |
improve late fee descriptions, #25899
-rw-r--r-- | FS/FS/Template_Mixin.pm | 18 | ||||
-rw-r--r-- | FS/FS/cust_bill_pkg.pm | 12 |
2 files changed, 29 insertions, 1 deletions
diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm index 27817486c..e0ea6ab2f 100644 --- a/FS/FS/Template_Mixin.pm +++ b/FS/FS/Template_Mixin.pm @@ -2291,12 +2291,28 @@ sub _items_fee { } } # otherwise include them all in the main section # XXX what to do when sectioning by location? + + my @ext_desc; + my %base_invnums; # invnum => invoice date + foreach ($cust_bill_pkg->cust_bill_pkg_fee) { + if ($_->base_invnum) { + my $base_bill = FS::cust_bill->by_key($_->base_invnum); + my $base_date = $self->time2str_local('short', $base_bill->_date) + if $base_bill; + $base_invnums{$_->base_invnum} = $base_date || ''; + } + } + foreach (sort keys(%base_invnums)) { + next if $_ == $self->invnum; + push @ext_desc, + $self->mt('from invoice \\#[_1] on [_2]', $_, $base_invnums{$_}); + } push @items, { feepart => $cust_bill_pkg->feepart, amount => sprintf('%.2f', $cust_bill_pkg->setup + $cust_bill_pkg->recur), description => $part_fee->itemdesc_locale($self->cust_main->locale), + ext_description => \@ext_desc # sdate/edate? - # ext_description referencing the base_invnum? }; } @items; diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm index f1267d391..4b85d303b 100644 --- a/FS/FS/cust_bill_pkg.pm +++ b/FS/FS/cust_bill_pkg.pm @@ -906,6 +906,18 @@ sub cust_tax_exempt_pkg { $self->{Hash}->{cust_tax_exempt_pkg} ||= []; } +=item cust_bill_pkg_fee + +Returns the list of associated cust_bill_pkg_fee objects, if this is +a fee-type item. + +=cut + +sub cust_bill_pkg_fee { + my $self = shift; + qsearch('cust_bill_pkg_fee', { billpkgnum => $self->billpkgnum }); +} + =item cust_bill_pkg_tax_Xlocation Returns the list of associated cust_bill_pkg_tax_location and/or |