1 helps alot
[freeside.git] / FS / FS / Cron / bill.pm
index 7de2ff2..6334056 100644 (file)
@@ -115,36 +115,34 @@ END
   ###
   
   foreach my $custnum ( @custnums ) {
+  
+    my %args = (
+        'time'         => $time,
+        'invoice_time' => $invoice_time,
+        'actual_time'  => $^T, #when freeside-bill was started
+                               #(not, when using -m, freeside-queued)
+        'check_freq'   => $check_freq,
+        'resetup'      => ( $opt{'s'} ? $opt{'s'} : 0 ),
+    );
 
     if ( $opt{'m'} ) {
 
       #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'      => $custnum,
-        'time'         => $time,
-        'invoice_time' => $invoice_time,
-        'check_freq'   => $check_freq,
-        'resetup'      => $opt{'s'} ? $opt{'s'} : 0,
-      );
+      my $queue = new FS::queue {
+        'job'    => 'FS::cust_main::queued_bill',
+        'secure' => 'Y',
+      };
+      my $error = $queue->insert( 'custnum'=>$custnum, %args );
 
     } else {
 
       my $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } );
-
-      $cust_main->bill_and_collect(
-        'time'         => $time,
-        'invoice_time' => $invoice_time,
-        'check_freq'   => $check_freq,
-        'resetup'      => $opt{'s'},
-        'debug'        => $debug,
-      );
+      $cust_main->bill_and_collect( %args, 'debug' => $debug );
 
     }
 
   }
 
 }
+
+1;