1 package FS::part_event::Condition::cust_bill_past_due;
5 use Time::Local 'timelocal';
7 use base qw( FS::part_event::Condition );
10 'Invoice due date has passed';
13 sub eventtable_hashref {
21 my($self, $cust_bill, %opt) = @_;
23 # If the invoice date is 1/1 at noon and the terms are Net 15,
24 # the due_date will be 1/16 at noon. Past due events will not
25 # trigger until after the start of 1/17.
26 my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($opt{'time'}))[0..5];
27 my $start_of_today = timelocal(0,0,0,$mday,$mon,$year)+1;
28 ($cust_bill->due_date || $cust_bill->_date) < $start_of_today;
32 return 'true' if $FS::UID::driver_name ne 'Pg';
33 my( $class, $table, %opt ) = @_;
34 my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($opt{'time'}))[0..5];
35 my $start_of_today = timelocal(0,0,0,$mday,$mon,$year)+1;
37 FS::cust_bill->due_date_sql . " < $start_of_today";