1 package FS::part_event::Condition::pkg_class;
5 use base qw( FS::part_event::Condition );
6 use FS::Record qw( qsearch );
13 sub eventtable_hashref {
23 'pkgclass' => { 'label' => 'Package Class',
24 'type' => 'select-pkg_class',
31 my( $self, $object ) = @_;
33 # interpretation depends on the eventtable
34 my $hashref = $self->option('pkgclass') || {};
35 if ( $object->isa('FS::cust_pkg') ) {
36 # is this package in that class?
37 $hashref->{ $object->part_pkg->classnum };
39 elsif ( $object->isa('FS::cust_main') ) {
40 # does this customer have an active package in that class?
41 grep { $hashref->{ $_->part_pkg->classnum } } $object->ncancelled_pkgs;
43 elsif ( $object->isa('FS::cust_bill') ) {
44 # does a package of that class appear on this invoice?
45 grep { $hashref->{ $_->part_pkg->classnum } } $object->cust_pkg;