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 {
22 'delay' => { label => 'Delay additional days',
30 my($self, $cust_bill, %opt) = @_;
32 my $delay = $self->option('delay') || 0;
33 my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($opt{'time'}))[0..5];
34 my $as_of = timelocal(0,0,0,$mday,$mon,$year) - $delay * 86400;
35 $as_of >= ($cust_bill->due_date || $cust_bill->_date);
39 my( $class, $table, %opt ) = @_;
40 return 'true' if $opt{'driver_name'} ne 'Pg';
41 my $delay = $class->condition_sql_option_integer('delay', 'Pg');
42 my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($opt{'time'}))[0..5];
43 my $as_of = timelocal(0,0,0,$mday,$mon,$year) . " - ($delay * 86400)";
44 "( $as_of ) >= ".FS::cust_bill->due_date_sql;