option to include resolved tickets in search, RT#11658
authormark <mark>
Fri, 18 Feb 2011 01:24:45 +0000 (01:24 +0000)
committermark <mark>
Fri, 18 Feb 2011 01:24:45 +0000 (01:24 +0000)
rt/FREESIDE_MODIFIED
rt/etc/RT_Config.pm.in
rt/lib/RT/Search/Googleish.pm

index 60f9c0b..6bef539 100644 (file)
@@ -26,6 +26,7 @@ lib/RT/Interface/Web_Vendor.pm
  lib/RT/Interface/Web/Handler.pm #freeside comp_root for dashboard emails
  lib/RT/Record.pm #and customfield date patch #fix transaction custom fields
 lib/RT/SavedSearches_Local.pm #saved searches
+lib/RT/Search/Googleish.pm #option to include resolved tickets
 lib/RT/SearchBuilder.pm #need DBIx::SearchBuilder >= 1.36 for Pg 8.1+
 lib/RT/Transaction_Overlay.pm #fix transaction custom fields
 lib/RT/Tickets_Overlay.pm #customfield date patch #SearchCustomerFields #this-month condition 
index 6b99b61..4fa0894 100644 (file)
@@ -1559,6 +1559,16 @@ Use this to set the default units for time entry to hours instead of minutes.
 
 Set($DefaultTimeUnitsToHours, 0);
 
+=item C<$SimpleSearchIncludeResolved>
+
+By default, the simple ticket search in the top bar excludes "resolved" tickets
+unless a status argument is specified.  Set this to a true value to include 
+them.
+
+=cut
+
+Set($SimpleSearchIncludeResolve, 0);
+
 =back
 
 =head1 L<Net::Server> (rt-server) Configuration
index 4b73dd7..4232b43 100644 (file)
@@ -176,13 +176,15 @@ sub QueryToSQL {
         push @queue_clauses, "Queue = '$quoted_queue'";
     }
 
+    if ( ! @status_clauses 
+        and ! RT->Config->Get('SimpleSearchIncludeResolved') ) {
+        # implicitly exclude resolved status
+        @status_clauses = map "Status = '$_'", RT::Queue->ActiveStatusArray();
+    }
+
     push @tql_clauses, join( " OR ", sort @id_clauses );
     push @tql_clauses, join( " OR ", sort @owner_clauses );
-    if ( ! @status_clauses ) {
-        push @tql_clauses, join( " OR ", map "Status = '$_'", RT::Queue->ActiveStatusArray());
-    } else {
-        push @tql_clauses, join( " OR ", sort @status_clauses );
-    }
+    push @tql_clauses, join( " OR ", sort @status_clauses );
     push @tql_clauses, join( " OR ", sort @user_clauses );
     push @tql_clauses, join( " OR ", sort @queue_clauses );
     @tql_clauses = grep { $_ ? $_ = "( $_ )" : undef } @tql_clauses;