X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FCron%2Fbill.pm;h=e4ba118a798dcf60802e95e09db850bebcd7dce0;hb=c26c4fa9449ef6b91620c3b994db8d5242b3d4ad;hp=1576edcb4be31bf2a765b07dc274bc7be496e20f;hpb=9509e5bfb7f9331303153cac24d7bfecbe2ea9f1;p=freeside.git diff --git a/FS/FS/Cron/bill.pm b/FS/FS/Cron/bill.pm index 1576edcb4..e4ba118a7 100644 --- a/FS/FS/Cron/bill.pm +++ b/FS/FS/Cron/bill.pm @@ -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'}; @@ -95,13 +98,22 @@ END } - my($cust_main,%saw); - foreach $cust_main ( @cust_main ) { + foreach my $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 { @@ -110,6 +122,7 @@ END 'invoice_time' => $invoice_time, 'check_freq' => $check_freq, 'resetup' => $opt{'s'}, + 'debug' => $debug, ); }