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 15:45:01 +0000 (11:45 -0400)
FS/FS/cust_main/Search.pm
httemplate/search/report_cust_main.html

index 1a19ea3..58bdd88 100644 (file)
@@ -1049,8 +1049,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 e1ce26d..9edd3ee 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>