minor cleanup
[freeside.git] / FS / FS / part_event / Condition / has_pkg_class.pm
1 package FS::part_event::Condition::has_pkg_class;
2 use base qw( FS::part_event::Condition );
3
4 use strict;
5
6 sub description {
7   'Customer has uncancelled package with class';
8 }
9
10 sub eventtable_hashref {
11     { 'cust_main' => 1,
12       'cust_bill' => 1,
13       'cust_pkg'  => 1,
14     };
15 }
16
17 #something like this
18 sub option_fields {
19   (
20     'pkgclass'  => { 'label'    => 'Package Class',
21                      'type'     => 'select-pkg_class',
22                      'multiple' => 1,
23                    },
24   );
25 }
26
27 sub condition {
28   my( $self, $object ) = @_;
29
30   my $cust_main = $self->cust_main($object);
31
32   #XXX test
33   my $hashref = $self->option('pkgclass') || {};
34   grep $hashref->{ $_->part_pkg->classnum }, $cust_main->ncancelled_pkgs;
35 }
36
37 1;