diff options
author | Mark Wells <mark@freeside.biz> | 2013-03-25 16:35:52 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2013-03-25 16:35:52 -0700 |
commit | 97356847f631d26f42a8fe0ea7adac580e41549c (patch) | |
tree | 8361ad62c91c0af23179260cdeea1a457567ce33 /FS/FS/cust_main/Search.pm | |
parent | dfc85a4245f2d15f258d840b98f0508c50228e40 (diff) |
ANY/ALL customer tag search option, #19166
Diffstat (limited to 'FS/FS/cust_main/Search.pm')
-rw-r--r-- | FS/FS/cust_main/Search.pm | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm index 2c7c04669..f799b519e 100644 --- a/FS/FS/cust_main/Search.pm +++ b/FS/FS/cust_main/Search.pm @@ -794,11 +794,19 @@ sub search { @tagnums = grep /^(\d+)$/, @tagnums; if ( @tagnums ) { + if ( $params->{'all_tags'} ) { + foreach ( @tagnums ) { + push @where, 'exists(select 1 from cust_tag where '. + 'cust_tag.custnum = cust_main.custnum and tagnum = '. + $_ . ')'; + } + } else { # matching any tag, not all 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; + } } } |