[freeside-commits] branch FREESIDE_4_BRANCH updated. b3b7e88c21a4acf8b70c1863e2c7c2b7b89f6696

Mark Wells mark at 420.am
Fri Oct 2 16:08:30 PDT 2015


The branch, FREESIDE_4_BRANCH has been updated
       via  b3b7e88c21a4acf8b70c1863e2c7c2b7b89f6696 (commit)
      from  40b9222778f9642c80b9a45c2f50b6012b098c48 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b3b7e88c21a4acf8b70c1863e2c7c2b7b89f6696
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Oct 2 16:05:41 2015 -0700

    fix unit setup fee on prorate-deferred packages, #31276

diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm
index 2d7b690..eee0958 100644
--- a/FS/FS/cust_main/Billing.pm
+++ b/FS/FS/cust_main/Billing.pm
@@ -1024,8 +1024,14 @@ sub _make_lines {
         return "$@ running calc_setup for $cust_pkg\n"
           if $@;
 
-        $unitsetup = $cust_pkg->base_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
+        }
 
         if ( $setup_param{'billed_currency'} ) {
           $setup_billed_currency = delete $setup_param{'billed_currency'};
@@ -1196,7 +1202,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++;
     }
 

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_main/Billing.pm |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)




More information about the freeside-commits mailing list