1 package FS::part_event::Condition::has_pkgpart_cancelled;
2 use base qw( FS::part_event::Condition );
6 sub description { 'Customer has canceled specific package(s)'; }
8 sub eventtable_hashref {
17 'if_pkgpart' => { 'label' => 'Only packages: ',
18 'type' => 'select-part_pkg',
21 'age' => { 'label' => 'Cancellation in last',
28 my( $self, $object, %opt ) = @_;
30 my $cust_main = $self->cust_main($object);
32 my $age = $self->option_age_from('age', $opt{'time'} );
34 my $if_pkgpart = $self->option('if_pkgpart') || {};
35 grep { $if_pkgpart->{ $_->pkgpart } && $_->get('cancel') > $age }
36 $cust_main->cancelled_pkgs;