additional due_cust_event debugging
[freeside.git] / FS / FS / Cron / bill.pm
index 1a6c4a7..e4ba118 100644 (file)
@@ -18,10 +18,13 @@ sub bill {
 
   my $check_freq = $opt{'check_freq'} || '1d';
 
-  $FS::cust_main::DEBUG = 1 if $opt{'v'};
-  $FS::cust_main::DEBUG = $opt{'l'} if $opt{'l'};
+  my $debug = 0;
+  $debug = 1 if $opt{'v'};
+  $debug = $opt{'l'} if $opt{'l'};
+  $FS::cust_main::DEBUG = $debug;
   #$FS::cust_event::DEBUG = $opt{'l'} if $opt{'l'};
-  
+
   my %search = ();
   $search{'payby'}    = $opt{'p'} if $opt{'p'};
   $search{'agentnum'} = $opt{'a'} if $opt{'a'};
@@ -99,8 +102,18 @@ END
 
     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 {
 
@@ -109,6 +122,7 @@ END
         'invoice_time' => $invoice_time,
         'check_freq'   => $check_freq,
         'resetup'      => $opt{'s'},
+        'debug'        => $debug,
       );
 
     }