1 package FS::part_event::Condition::cust_paydate_within;
4 use base qw( FS::part_event::Condition );
5 use FS::Record qw( str2time_sql str2time_sql_closing );
6 use Time::Local 'timelocal';
9 'Credit card expires within upcoming interval';
12 # Run the event when the customer's credit card expiration
13 # date is less than X days in the future.
14 # Combine this with a "once_every" condition so that the event
15 # won't repeat every day until the expiration date.
17 sub eventtable_hashref {
26 'within' => { 'label' => 'Expiration date within',
33 my( $self, $cust_main, %opt ) = @_;
34 my $expire_time = $cust_main->paydate_epoch or return 0;
35 $opt{'time'} >= $self->option_age_from('within', $expire_time);
39 my ($self, $table, %opt) = @_;
40 my $expire_time = FS::cust_main->paydate_epoch_sql or return 'true';
41 $opt{'time'} . ' >= ' .
42 $self->condition_sql_option_age_from('within', $expire_time);