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