X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=FS%2FFS%2FCron%2Fbill.pm;h=5de2ee30efa23f65053972465e7d0ae3bb3f6359;hb=74a3083375ccc3a0dc8b74f9b39392989d088656;hp=2bdb12025202f8d181a61cba11872c895a0c9a41;hpb=5c35f5323f1cdcf7eabe6632d0352ea417d3047e;p=freeside.git diff --git a/FS/FS/Cron/bill.pm b/FS/FS/Cron/bill.pm index 2bdb12025..5de2ee30e 100644 --- a/FS/FS/Cron/bill.pm +++ b/FS/FS/Cron/bill.pm @@ -34,14 +34,21 @@ sub bill { $FS::cust_main::DEBUG = $debug; #$FS::cust_event::DEBUG = $opt{'l'} if $opt{'l'}; + my $conf = new FS::Conf; + if ( $conf->exists('disable_cron_billing') ) { + warn "disable_cron_billing set, skipping billing\n" if $debug; + return; + } + #we're at now now (and later). $opt{'time'} = $opt{'d'} ? str2time($opt{'d'}) : $^T; $opt{'time'} += $opt{'y'} * 86400 if $opt{'y'}; $opt{'invoice_time'} = $opt{'n'} ? $^T : $opt{'time'}; - my $not_pkgpart = $opt{g} ? { map { $_=>1 } split(/,\s*/, $opt{g}) } - : {}; + #hashref here doesn't work with -m + #my $not_pkgpart = $opt{g} ? { map { $_=>1 } split(/,\s*/, $opt{g}) } + # : {}; ### # get a list of custnums @@ -78,7 +85,7 @@ sub bill { #(not, when using -m, freeside-queued) 'check_freq' => $check_freq, 'resetup' => ( $opt{'s'} ? $opt{'s'} : 0 ), - 'not_pkgpart' => $not_pkgpart, + 'not_pkgpart' => $opt{'g'}, #$not_pkgpart, ); if ( $opt{'m'} ) { @@ -154,7 +161,7 @@ sub bill_where { push @search, "cust_main.payby = '". $opt{'p'}. "'" if $opt{'p'}; - push @search, "cust_main.agentnum = ". $opt{'a'} + push @search, "cust_main.agentnum IN ( ". $opt{'a'}. " ) " if $opt{'a'}; #it would be useful if i recognized $opt{g} / $not_pkgpart... @@ -187,6 +194,7 @@ sub bill_where { ) END + #some false laziness w/cust_main::Billing due_cust_event my $where_event = join(' OR ', map { my $eventtable = $_; @@ -194,7 +202,7 @@ END my $where = FS::part_event_condition->where_conditions_sql( $eventtable, 'time'=>$time, ); - my $where = "AND $where" if $where; + $where = $where ? "AND $where" : ''; my $are_part_event = "EXISTS ( SELECT 1 FROM part_event $join