1 package FS::part_event::Condition::inactive_age;
4 use base qw( FS::part_event::Condition );
5 use FS::Record qw( qsearch );
7 sub description { 'Days without billing activity' }
11 'age' => { 'label' => 'No activity within',
14 # flags to select kinds of activity,
15 # like if you just want "no payments since"?
21 my( $self, $obj, %opt ) = @_;
22 my $custnum = $obj->custnum;
23 my $age = $self->option_age_from('age', $opt{'time'} );
25 foreach my $t (qw(cust_bill cust_pay cust_credit cust_refund)) {
27 return 0 if $class->count("custnum = $custnum AND _date >= $age");
33 my( $class, $table, %opt ) = @_;
34 my $age = $class->condition_sql_option_age_from('age', $opt{'time'});
36 for my $t (qw(cust_bill cust_pay cust_credit cust_refund)) {
38 "NOT EXISTS( SELECT 1 FROM $t ".
39 "WHERE $t.custnum = cust_main.custnum AND $t._date >= $age".