1 package FS::part_event::Condition::has_cust_tag;
2 use base qw( FS::part_event::Condition );
5 #use FS::Record qw( qsearch );
11 sub eventtable_hashref {
16 'cust_pay_batch' => 1,
17 'cust_statement' => 1,
23 'tagnum' => { 'label' => 'Customer tag',
24 'type' => 'select-cust_tag',
31 my( $self, $object ) = @_;
33 my $cust_main = $self->cust_main($object);
35 my $hashref = $self->option('tagnum') || {};
36 grep $hashref->{ $_->tagnum }, $cust_main->cust_tag;
40 my( $self, $table ) = @_;
43 "SELECT tagnum FROM cust_tag WHERE cust_tag.custnum = $table.custnum".
44 " AND cust_tag.tagnum IN ".
45 $self->condition_sql_option_option_integer('tagnum');
47 "EXISTS($matching_tags)";