[freeside-commits] freeside/FS/FS/Cron bill.pm,1.8,1.9

Jason Hall jayce at wavetail.420.am
Thu Sep 27 11:24:35 PDT 2007


Update of /home/cvs/cvsroot/freeside/FS/FS/Cron
In directory wavetail:/tmp/cvs-serv4942/FS/Cron

Modified Files:
	bill.pm 
Log Message:
Multi-System Billing:
with a -m flag, daily will queue billing jobs instead of running each.  freeside-queued will then pick it up, allowing multiple simultaneous jobs to run, as well as multiple machines.
Also adds a 'Secure' column to the queue system, allowing for billing jobs to define themselves as 'secure only' in cases where a box might be using the encryption.  This allows you to
 run secure only jobs (such as a collect) on boxes that can.


Index: bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Cron/bill.pm,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- bill.pm	14 Aug 2007 20:18:20 -0000	1.8
+++ bill.pm	27 Sep 2007 18:24:33 -0000	1.9
@@ -44,7 +44,7 @@
                   )
         )
 END
-
+  
   my $where_event = join(' OR ', map {
     my $eventtable = $_;
 
@@ -76,7 +76,7 @@
 
   my $extra_sql = ( scalar(%search) ? ' AND ' : ' WHERE ' ).
                   "( $where_pkg OR $where_event )";
-
+  
   my @cust_main;
   if ( @ARGV ) {
     @cust_main = map { qsearchs('cust_main', { custnum => $_, %search } ) } @ARGV
@@ -95,12 +95,23 @@
 
   }
   
-  foreach my $cust_main ( @cust_main ) {
+  my($cust_main,%saw);
+  foreach $cust_main ( @cust_main ) {
 
     if ( $opt{'m'} ) {
 
-      die "XXX multi-process mode not yet completed";
       #add job to queue that calls bill_and_collect with options
+        my $queue = new FS::queue {
+          'job'    => 'FS::cust_main::queued_bill',
+          'secure' => 'Y',
+        };
+        my $error = $queue->insert(
+        'custnum'      =>  $cust_main->custnum,
+        'time'         => $time,
+        'invoice_time' => $invoice_time,
+        'check_freq'   => $check_freq,
+        'resetup'      => $opt{'s'} ? $opt{'s'} : 0,
+      );
 
     } else {
 
@@ -112,7 +123,7 @@
       );
 
     }
-
+  
   }
 
 }



More information about the freeside-commits mailing list