X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FCron%2Fbill.pm;h=a822654520b28cc2214fa3228244ce641088b8c7;hb=b51f95ce19785983728938439d1e2027b8e27569;hp=807d5cfec867d78b1cead77f3fd27f5627dc4f9f;hpb=5475cf83f8e41c4202906635d9cc90d3d895ca89;p=freeside.git diff --git a/FS/FS/Cron/bill.pm b/FS/FS/Cron/bill.pm index 807d5cfec..a82265452 100644 --- a/FS/FS/Cron/bill.pm +++ b/FS/FS/Cron/bill.pm @@ -190,8 +190,6 @@ sub bill_where { push @search, "( cust_main.archived != 'Y' OR archived IS NULL )"; #disable? - push @search, "cust_main.payby = '". $opt{'p'}. "'" - if $opt{'p'}; push @search, "cust_main.agentnum IN ( ". $opt{'a'}. " ) " if $opt{'a'}; @@ -210,6 +208,8 @@ sub bill_where { my $conf = new FS::Conf; my $billtime = $conf->exists('next-bill-ignore-time') ? day_end($time) : $time; + # corresponds to perl checks in FS::cust_main::Billing sub bill + # ("bill setup" and "bill recurring fee") # select * from cust_main where my $where_pkg = <<"END"; EXISTS( @@ -218,7 +218,7 @@ sub bill_where { AND ( cancel IS NULL OR cancel = 0 ) AND ( ( ( cust_pkg.setup IS NULL OR cust_pkg.setup = 0 ) AND ( start_date IS NULL OR start_date = 0 - OR ( start_date IS NOT NULL AND start_date <= $^T ) + OR ( start_date IS NOT NULL AND start_date <= $billtime ) ) ) OR ( freq != '0' AND ( bill IS NULL OR bill <= $billtime ) ) @@ -234,7 +234,8 @@ END my $eventtable = $_; # joins and where clauses to test event conditions - my $join = FS::part_event_condition->join_conditions_sql( $eventtable ); + my $join = FS::part_event_condition->join_conditions_sql( $eventtable, + 'time'=>$time ); my $where = FS::part_event_condition->where_conditions_sql( $eventtable, 'time'=>$time, );