1 package FS::part_event::Condition::has_cust_tag;
5 use base qw( FS::part_event::Condition );
6 use FS::Record qw( qsearch );
12 sub eventtable_hashref {
17 'cust_pay_batch' => 1,
18 'cust_statement' => 1,
24 'tagnum' => { 'label' => 'Customer tag',
25 'type' => 'select-cust_tag',
32 my( $self, $object ) = @_;
34 my $cust_main = $self->cust_main($object);
36 my $hashref = $self->option('tagnum') || {};
37 grep $hashref->{ $_->tagnum }, $cust_main->cust_tag;
41 my( $self, $table ) = @_;
44 "SELECT tagnum FROM cust_tag WHERE cust_tag.custnum = $table.custnum".
45 " AND cust_tag.tagnum IN ".
46 $self->condition_sql_option_option_integer('tagnum');
48 "EXISTS($matching_tags)";