[freeside-commits] branch FREESIDE_3_BRANCH updated. 83a67f4751c0ffe5a176a1a2043ad9f1f5a33c5c

Mark Wells mark at 420.am
Wed Dec 16 20:36:25 PST 2015


The branch, FREESIDE_3_BRANCH has been updated
       via  83a67f4751c0ffe5a176a1a2043ad9f1f5a33c5c (commit)
      from  aba308a52b4cf39e9bd84301514b45734f540260 (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 83a67f4751c0ffe5a176a1a2043ad9f1f5a33c5c
Author: Mark Wells <mark at freeside.biz>
Date:   Wed Dec 16 20:25:23 2015 -0800

    avoid billing packages that will have expired before the billing date, #30049 and #38017

diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm
index 333b07f..37d7872 100644
--- a/FS/FS/cust_main/Billing.pm
+++ b/FS/FS/cust_main/Billing.pm
@@ -1205,9 +1205,10 @@ sub _make_lines {
   #   - it doesn't already HAVE a setup date
   #   - or a start date in the future
   #   - and it's not suspended
+  # - and it doesn't have an expire date in the past
   #
-  # The last condition used to check the "disable_setup_suspended" option but 
-  # that's obsolete. We now never set the setup date on a suspended package.
+  # The "disable_setup_suspended" option is now obsolete; we never set the
+  # setup date on a suspended package.
   if (     ! $options{recurring_only}
        and ! $options{cancel}
        and ( $options{'resetup'}
@@ -1218,6 +1219,8 @@ sub _make_lines {
                   && ( ! $cust_pkg->getfield('susp') )
               )
            )
+       and ( ! $cust_pkg->expire
+             || $cust_pkg->expire > $cmp_time )
      )
   {
     
@@ -1258,6 +1261,20 @@ sub _make_lines {
   my $unitrecur = 0;
   my @recur_discounts = ();
   my $sdate;
+  # Conditions for billing the recurring fee:
+  # - the package doesn't have a future start date
+  # - and it's not suspended
+  #   - unless suspend_bill is enabled on the package or package def
+  #     - but still not, if the package is on hold
+  #   - or it's suspended for a delayed cancellation
+  # - and its next bill date is in the past
+  #   - or it doesn't have a next bill date yet
+  #   - or it's a one-time charge
+  #   - or it's a CDR plan with the "bill_every_call" option
+  #   - or it's being canceled
+  # - and it doesn't have an expire date in the past (this can happen with
+  #   advance billing)
+  #   - again, unless it's being canceled
   if (     ! $cust_pkg->start_date
        and 
            ( ! $cust_pkg->susp
@@ -1276,6 +1293,12 @@ sub _make_lines {
                && $part_pkg->option('bill_every_call')
             )
          || $options{cancel}
+
+       and
+          ( ! $cust_pkg->expire
+            || $cust_pkg->expire > $cmp_time
+            || $options{cancel}
+          )
   ) {
 
     # XXX should this be a package event?  probably.  events are called

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

Summary of changes:
 FS/FS/cust_main/Billing.pm |   27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list