RT# 76722 - added option to search on tags not selected in advanced customer report
[freeside.git] / FS / FS / cust_main / Search.pm
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 = '.
                        $_ . ')';
         }