}
);
+ #avoid queuing another job if there's one still waiting to run
next if @waiting && ! $opt{'q'};
#add job to queue that calls bill_and_collect with options
my $error = $queue->insert( 'custnum'=>$custnum, %args );
die $error if $error;
- foreach $waiting_queue (@waiting) {
+ #wait until the earler jobs complete
+ foreach my $waiting_queue (@waiting) {
$queue->depend_insert($waiting_queue->jobnum);
}