summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorlevinse <levinse>2010-11-05 03:56:07 +0000
committerlevinse <levinse>2010-11-05 03:56:07 +0000
commit042d37f557e3ad0cf2f02753d20e70dfbd1f73a9 (patch)
tree6378701fc2924e3233ce72cc61f95c3d5e9f1eb0 /FS
parentd86c2687d55370e9aee258b7ed9b34ab181ffbf1 (diff)
add a multi-select for tags to advanced customer search, RT6376
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cust_main/Search.pm15
1 files changed, 15 insertions, 0 deletions
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