RT# 76722 - added option to search on tags not selected in advanced customer report
authorChristopher Burger <burgerc@freeside.biz>
Wed, 24 Oct 2018 14:55:50 +0000 (10:55 -0400)
committerChristopher Burger <burgerc@freeside.biz>
Wed, 24 Oct 2018 14:55:50 +0000 (10:55 -0400)
FS/FS/cust_main/Search.pm
httemplate/search/report_cust_main.html

index bfaf621..3e77704 100644 (file)
@@ -1016,8 +1016,9 @@ sub search {
 
     if ( @tagnums ) {
       if ( $params->{'all_tags'} ) {
+        my $exists = $params->{'all_tags'} eq 'all' ? 'exists' : 'not exists';
         foreach ( @tagnums ) {
-          push @where, 'exists(select 1 from cust_tag where '.
+          push @where, $exists.'(select 1 from cust_tag where '.
                        'cust_tag.custnum = cust_main.custnum and tagnum = '.
                        $_ . ')';
         }
index 0a67262..da2f1a4 100755 (executable)
           <DIV STYLE="display:inline-block; vertical-align:baseline">
             <INPUT TYPE="radio" NAME="all_tags" VALUE="0" CHECKED> Any of these
             <BR>
-            <INPUT TYPE="radio" NAME="all_tags" VALUE="1"> All of these
+            <INPUT TYPE="radio" NAME="all_tags" VALUE="all"> All of these
+            <BR>
+            <INPUT TYPE="radio" NAME="all_tags" VALUE="none"> None of these
           </DIV>
         </TD>
       </TR>