[freeside-commits] freeside/FS/FS cust_bill.pm, 1.362, 1.363 cust_pay.pm, 1.95, 1.96
Mark Wells
mark at wavetail.420.am
Sat Nov 26 16:46:13 PST 2011
Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv32224/FS/FS
Modified Files:
cust_bill.pm cust_pay.pm
Log Message:
correct display of prepay discount info with non-monthly packages, #15040
Index: cust_pay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pay.pm,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -w -d -r1.95 -r1.96
--- cust_pay.pm 13 Oct 2011 07:55:59 -0000 1.95
+++ cust_pay.pm 27 Nov 2011 00:46:11 -0000 1.96
@@ -194,7 +194,14 @@
my ($cust_bill) = ($cust_main->cust_bill)[-1]; # most recent invoice
return "can't accept prepayment for an unbilled customer" if !$cust_bill;
- my %billing_pkgs = map { $_->pkgnum => $_ } $cust_main->billing_pkgs;
+ # %billing_pkgs contains this customer's active monthly packages.
+ # Recurring fees for those packages will be credited and then rebilled
+ # for the full discount term. Other packages on the last invoice
+ # (canceled, non-monthly recurring, or one-time charges) will be
+ # left as they are.
+ my %billing_pkgs = map { $_->pkgnum => $_ }
+ grep { $_->part_pkg->freq eq '1' }
+ $cust_main->billing_pkgs;
my $credit = 0; # sum of recurring charges from that invoice
my $last_bill_date = 0; # the real bill date
foreach my $item ( $cust_bill->cust_bill_pkg ) {
Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.362
retrieving revision 1.363
diff -u -w -d -r1.362 -r1.363
--- cust_bill.pm 15 Nov 2011 19:41:43 -0000 1.362
+++ cust_bill.pm 27 Nov 2011 00:46:10 -0000 1.363
@@ -5203,16 +5203,18 @@
foreach my $cust_bill_pkg ( $self->cust_bill_pkg ) {
my $cust_pkg = $cust_bill_pkg->cust_pkg or next;
my $part_pkg = $cust_pkg->part_pkg or next;
-
- next if $part_pkg->freq ne '1';
+ my $freq = $part_pkg->freq;
my $setup = $cust_bill_pkg->setup || 0;
my $recur = $cust_bill_pkg->recur || 0;
+
+ if ( $freq eq '1' ) { #monthly
my $permonth = $part_pkg->base_recur_permonth || 0;
my ($discount) = grep { $_->months == $months }
map { $_->discount } $part_pkg->part_pkg_discount;
$hash->{base} += $setup + $recur + ($months - 1) * $permonth;
+
if ($discount) {
my $discountable;
@@ -5243,6 +5245,12 @@
$hash->{discounted} += $setup + $recur + ($months - 1) * $permonth;
$hash->{list_pkgnums} = 1;
}
+ } #if $freq eq '1'
+ else { # all non-monthly packages: include current charges only
+ $hash->{discounted} += $setup + $recur;
+ $hash->{base} += $setup + $recur;
+ $hash->{list_pkgnums} = 1;
+ }
} #foreach $cust_bill_pkg
# don't show this line if no packages have discounts at this term
More information about the freeside-commits
mailing list