Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / FS / FS / part_event / Condition / pkg_pkgpart.pm
1 package FS::part_event::Condition::pkg_pkgpart;
2
3 use strict;
4
5 use base qw( FS::part_event::Condition );
6
7 sub description { 'Package definitions'; }
8
9 sub eventtable_hashref {
10     { 'cust_main' => 0,
11       'cust_bill' => 0,
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, $cust_pkg) = @_;
27
28   my $if_pkgpart = $self->option('if_pkgpart') || {};
29   $if_pkgpart->{ $cust_pkg->pkgpart };
30
31 }
32
33 sub condition_sql {
34   my( $self, $table ) = @_;
35   
36   'cust_pkg.pkgpart IN '.
37     $self->condition_sql_option_option_integer('if_pkgpart');
38 }
39
40 1;