[freeside-commits] freeside/FS/FS/cust_main Billing.pm,1.33,1.34

Mark Wells mark at wavetail.420.am
Mon May 9 13:31:12 PDT 2011


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

Modified Files:
	Billing.pm 
Log Message:
bill recurring packages up to current date, #12569

Index: Billing.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main/Billing.pm,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -w -d -r1.33 -r1.34
--- Billing.pm	6 May 2011 00:30:07 -0000	1.33
+++ Billing.pm	9 May 2011 20:31:10 -0000	1.34
@@ -416,7 +416,10 @@
 
       my $pass = ($cust_pkg->no_auto || $part_pkg->no_auto) ? 'no_auto' : '';
 
-      my $error =
+      my $next_bill = $cust_pkg->getfield('bill') || 0;
+      my $error;
+      while ( $next_bill <= $time ) {
+        $error =
         $self->_make_lines( 'part_pkg'            => $part_pkg,
                             'cust_pkg'            => $cust_pkg,
                             'precommit_hooks'     => \@precommit_hooks,
@@ -428,6 +431,12 @@
                             'real_pkgpart'        => $real_pkgpart,
                             'options'             => \%options,
                           );
+        # Stop if anything goes wrong, or if we're not incrementing 
+        # the bill date.
+        last if $error;
+        last if ($cust_pkg->getfield('bill') || 0) == $next_bill;
+        $next_bill = $cust_pkg->getfield('bill') || 0;
+      }
       if ($error) {
         $dbh->rollback if $oldAutoCommit && !$options{no_commit};
         return $error;



More information about the freeside-commits mailing list