From 042d37f557e3ad0cf2f02753d20e70dfbd1f73a9 Mon Sep 17 00:00:00 2001 From: levinse Date: Fri, 5 Nov 2010 03:56:07 +0000 Subject: add a multi-select for tags to advanced customer search, RT6376 --- FS/FS/cust_main/Search.pm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'FS') diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm index ac170ff1f..ad24ff86e 100644 --- a/FS/FS/cust_main/Search.pm +++ b/FS/FS/cust_main/Search.pm @@ -658,6 +658,21 @@ sub search { push @where, "cust_main.custbatch = '$1'"; } + + if ( $params->{'tagnum'} ) { + my @tagnums = ref( $params->{'tagnum'} ) ? @{ $params->{'tagnum'} } : ( $params->{'tagnum'} ); + + @tagnums = grep /^(\d+)$/, @tagnums; + + if ( @tagnums ) { + my $tags_where = "0 < (select count(1) from cust_tag where " + . " cust_tag.custnum = cust_main.custnum and tagnum in (" + . join(',', @tagnums) . "))"; + + push @where, $tags_where; + } + } + ## # setup queries, subs, etc. for the search -- cgit v1.2.1