diff options
author | Mark Wells <mark@freeside.biz> | 2015-10-02 16:05:41 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-10-02 16:07:53 -0700 |
commit | 453d0509426c36f94868c06823327bb58871a763 (patch) | |
tree | 906fa8fb9ba1376785848932abcec519555c89f2 | |
parent | ddfa1b3070f48aacfeb380dd2624040d2daaac8e (diff) |
fix unit setup fee on prorate-deferred packages, #31276
-rw-r--r-- | FS/FS/cust_main/Billing.pm | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm index 014d71529..b7837c598 100644 --- a/FS/FS/cust_main/Billing.pm +++ b/FS/FS/cust_main/Billing.pm @@ -1230,7 +1230,14 @@ sub _make_lines { return "$@ running calc_setup for $cust_pkg\n" if $@; - $unitsetup = $cust_pkg->part_pkg->unit_setup || $setup; #XXX uuh + # Only increment unitsetup here if there IS a setup fee. + # prorate_defer_bill may cause calc_setup on a setup-stage package + # to return zero, and the setup fee to be charged later. (This happens + # when it's first billed on the prorate cutoff day. RT#31276.) + if ( $setup ) { + $unitsetup = $cust_pkg->base_setup() + || $setup; #XXX uuh + } } $cust_pkg->setfield('setup', $time) @@ -1369,7 +1376,7 @@ sub _make_lines { # Add an additional setup fee at the billing stage. # Used for prorate_defer_bill. $setup += $param{'setup_fee'}; - $unitsetup += $param{'setup_fee'}; + $unitsetup = $cust_pkg->base_setup(); $lineitems++; } |