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