[freeside-commits] branch FREESIDE_3_BRANCH updated. 8de3467a4f96ac5bac8d2ed77be5c5bf8261f6c5

Mark Wells mark at 420.am
Fri Jul 10 18:18:05 PDT 2015


The branch, FREESIDE_3_BRANCH has been updated
       via  8de3467a4f96ac5bac8d2ed77be5c5bf8261f6c5 (commit)
      from  aa9537af853969b34d2da6ca855f1d2fcdec16d4 (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 8de3467a4f96ac5bac8d2ed77be5c5bf8261f6c5
Author: Mark Wells <mark at freeside.biz>
Date:   Fri Jul 10 18:14:40 2015 -0700

    avoid generating spurious zero-amount bills on cancellation, #37229, from #16066

diff --git a/FS/FS/cust_main/Billing.pm b/FS/FS/cust_main/Billing.pm
index 08ec6dd..6444675 100644
--- a/FS/FS/cust_main/Billing.pm
+++ b/FS/FS/cust_main/Billing.pm
@@ -1305,6 +1305,14 @@ sub _make_lines {
     return "$@ running $method for $cust_pkg\n"
       if ( $@ );
 
+    if ($recur eq 'NOTHING') {
+      # then calc_cancel (or calc_recur but that's not used) has declined to
+      # generate a recurring lineitem at all. treat this as zero, but also 
+      # try not to generate a lineitem.
+      $recur = 0;
+      $lineitems--;
+    }
+
     #base_cancel???
     $unitrecur = $cust_pkg->base_recur( \$sdate ) || $recur; #XXX uuh, better
 
diff --git a/FS/FS/part_pkg/flat.pm b/FS/FS/part_pkg/flat.pm
index 2201384..3192f2f 100644
--- a/FS/FS/part_pkg/flat.pm
+++ b/FS/FS/part_pkg/flat.pm
@@ -203,13 +203,13 @@ sub calc_cancel {
        and $self->option('bill_recur_on_cancel', 1) ) {
     # run another recurring cycle
     return $self->calc_recur(@_);
-  }
-  elsif ( $conf->exists('bill_usage_on_cancel') # should be a package option?
+  } elsif ( $conf->exists('bill_usage_on_cancel') # should be a package option?
           and $self->can('calc_usage') ) {
     # bill for outstanding usage
     return $self->calc_usage(@_);
+  } else {
+    return 'NOTHING'; # numerically zero, but has special meaning
   }
-  0;
 }
 
 sub calc_remain {

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

Summary of changes:
 FS/FS/cust_main/Billing.pm |    8 ++++++++
 FS/FS/part_pkg/flat.pm     |    6 +++---
 2 files changed, 11 insertions(+), 3 deletions(-)




More information about the freeside-commits mailing list