1 package FS::part_event::Condition::pkg_age;
4 use base qw( FS::part_event::Condition );
5 use FS::Record qw( qsearch );
11 sub eventtable_hashref {
21 'age' => { 'label' => 'Package date age',
24 'field' => { 'label' => 'Compare date',
27 [qw( setup last_bill bill adjourn susp expire cancel )],
29 'setup' => 'Setup date',
30 'last_bill' => 'Last bill date',
31 'bill' => 'Next bill date',
32 'adjourn' => 'Adjournment date',
33 'susp' => 'Suspension date',
34 'expire' => 'Expiration date',
35 'cancel' => 'Cancellation date',
42 my( $self, $cust_pkg, %opt ) = @_;
44 my $age = $self->option_age_from('age', $opt{'time'} );
46 my $pkg_date = $cust_pkg->get( $self->option('field') );
48 $pkg_date && $pkg_date <= $age;
52 #XXX write me for efficiency