X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_pay.pm;h=d98d11ecb38162a4b39c087e261510b630e5f386;hb=61947a4be34e9610e71311d5d386b52a2f429297;hp=60c437a9216fa1836018ace8431157a519ae6e87;hpb=f5749f6de299149275f555a147f3428b7592d14b;p=freeside.git diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm index 60c437a92..d98d11ecb 100644 --- a/FS/FS/cust_pay.pm +++ b/FS/FS/cust_pay.pm @@ -194,7 +194,14 @@ sub insert { 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 ) {