1 package FS::part_event::Condition::hasnt_pkgpart_cancelled;
2 use base qw( FS::part_event::Condition );
6 sub description { 'Customer does not have canceled specific package(s)'; }
8 sub eventtable_hashref {
17 'if_pkgpart' => { 'label' => 'Packages: ',
18 'type' => 'select-part_pkg',
21 'age_newest' => { 'label' => 'Cancelled more than',
23 'post_text' => ' ago (blank for no limit)',
26 'age' => { 'label' => 'Cancelled less than',
28 'post_text' => ' ago (blank for no limit)',
35 my( $self, $object, %opt ) = @_;
37 my $cust_main = $self->cust_main($object);
39 my $oldest = length($self->option('age')) ? $self->option_age_from('age', $opt{'time'} ) : 0;
40 my $newest = $self->option_age_from('age_newest', $opt{'time'} );
42 my $if_pkgpart = $self->option('if_pkgpart') || {};
44 ! grep { $if_pkgpart->{ $_->pkgpart } && ($_->get('cancel') > $oldest) && ($_->get('cancel') <= $newest) }
45 $cust_main->cancelled_pkgs;