[freeside-commits] freeside/FS/FS/cust_main Billing.pm,1.47,1.48

Mark Wells mark at wavetail.420.am
Tue Jan 24 14:25:15 PST 2012


Update of /home/cvs/cvsroot/freeside/FS/FS/cust_main
In directory wavetail.420.am:/tmp/cvs-serv3013/FS/FS/cust_main

Modified Files:
	Billing.pm 
Log Message:
option to bill partial period on cancel/suspend, #16066

Index: Billing.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main/Billing.pm,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -w -d -r1.47 -r1.48
--- Billing.pm	13 Jan 2012 10:13:56 -0000	1.47
+++ Billing.pm	24 Jan 2012 22:25:13 -0000	1.48
@@ -177,7 +177,8 @@
   foreach my $cust_pkg ( @cancel_pkgs ) {
     my $cpr = $cust_pkg->last_cust_pkg_reason('expire');
     my $error = $cust_pkg->cancel($cpr ? ( 'reason'        => $cpr->reasonnum,
-                                           'reason_otaker' => $cpr->otaker
+                                           'reason_otaker' => $cpr->otaker,
+                                           'time'          => $time,
                                          )
                                        : ()
                                  );
@@ -407,7 +408,8 @@
 
       my $next_bill = $cust_pkg->getfield('bill') || 0;
       my $error;
-      while ( $next_bill <= $time ) {
+      # let this run once if this is the last bill upon cancellation
+      while ( $next_bill <= $time or $options{cancel} ) {
         $error =
           $self->_make_lines( 'part_pkg'            => $part_pkg,
                               'cust_pkg'            => $cust_pkg,
@@ -427,6 +429,9 @@
         # or if we're not incrementing the bill date.
         last if ($cust_pkg->getfield('bill') || 0) == $next_bill;
 
+        # or if we're letting it run only once
+        last if $options{cancel};
+
         $next_bill = $cust_pkg->getfield('bill') || 0;
 
         #stop if -o was passed to freeside-daily



More information about the freeside-commits mailing list