1 package FS::part_event::Condition::hasnt_pkg_class_cancelled;
2 use base qw( FS::part_event::Condition );
7 'Customer does not have canceled package with class';
10 sub eventtable_hashref {
20 'pkgclass' => { 'label' => 'Package Class',
21 'type' => 'select-pkg_class',
24 'age_newest' => { 'label' => 'Cancelled more than',
26 'post_text' => ' ago (blank for no limit)',
29 'age' => { 'label' => 'Cancelled less than',
31 'post_text' => ' ago (blank for no limit)',
38 my( $self, $object, %opt ) = @_;
40 my $cust_main = $self->cust_main($object);
42 my $oldest = length($self->option('age')) ? $self->option_age_from('age', $opt{'time'} ) : 0;
43 my $newest = $self->option_age_from('age_newest', $opt{'time'} );
45 my $pkgclass = $self->option('pkgclass') || {};
47 ! grep { $pkgclass->{ $_->part_pkg->classnum } && ($_->get('cancel') > $oldest) && ($_->get('cancel') <= $newest) }
48 $cust_main->cancelled_pkgs;