X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FCron%2Fbill.pm;h=807d5cfec867d78b1cead77f3fd27f5627dc4f9f;hb=5475cf83f8e41c4202906635d9cc90d3d895ca89;hp=a9df376dceb890b03288720acd0dc225c4c60dbf;hpb=905f2144894749fc95baab979e176dddac9073c2;p=freeside.git diff --git a/FS/FS/Cron/bill.pm b/FS/FS/Cron/bill.pm index a9df376dc..807d5cfec 100644 --- a/FS/FS/Cron/bill.pm +++ b/FS/FS/Cron/bill.pm @@ -13,6 +13,8 @@ use FS::cust_main; use FS::part_event; use FS::part_event_condition; +use FS::Log; + @ISA = qw( Exporter ); @EXPORT_OK = qw ( bill bill_where ); @@ -27,6 +29,9 @@ use FS::part_event_condition; sub bill { my %opt = @_; + my $log = FS::Log->new('Cron::bill'); + $log->info('start'); + my $check_freq = $opt{'check_freq'} || '1d'; my $debug = 0; @@ -36,9 +41,10 @@ sub bill { #$FS::cust_event::DEBUG = $opt{'l'} if $opt{'l'}; my $conf = new FS::Conf; + my $disable_bill = 0; if ( $conf->exists('disable_cron_billing') ) { warn "disable_cron_billing set, skipping billing\n" if $debug; - return; + $disable_bill = 1; } #we're at now now (and later). @@ -94,6 +100,7 @@ sub bill { 'resetup' => ( $opt{'s'} ? $opt{'s'} : 0 ), 'not_pkgpart' => $opt{'g'}, #$not_pkgpart, 'one_recur' => $opt{'o'}, + 'no_prepaid' => 1, ); if ( $opt{'m'} ) { @@ -122,7 +129,11 @@ sub bill { } else { my $cust_main = qsearchs( 'cust_main', { 'custnum' => $custnum } ); - $cust_main->bill_and_collect( %args, 'debug' => $debug ); + if ( $disable_bill ) { + $cust_main->collect( %args, 'debug' => $debug ); + } else { + $cust_main->bill_and_collect( %args, 'debug' => $debug ); + } } @@ -134,6 +145,7 @@ sub bill { $cursor_dbh->commit or die $cursor_dbh->errstr; + $log->info('finish'); } # freeside-daily %opt: @@ -195,7 +207,8 @@ sub bill_where { # generate where_pkg/where_event search clause ### - my $billtime = day_end($time); + my $conf = new FS::Conf; + my $billtime = $conf->exists('next-bill-ignore-time') ? day_end($time) : $time; # select * from cust_main where my $where_pkg = <<"END";