From: mark Date: Fri, 18 Feb 2011 01:24:45 +0000 (+0000) Subject: option to include resolved tickets in search, RT#11658 X-Git-Tag: freeside_2_3_0~602 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=393804c70b9ed1e3acac49011e6e07d12988b960 option to include resolved tickets in search, RT#11658 --- diff --git a/rt/FREESIDE_MODIFIED b/rt/FREESIDE_MODIFIED index 60f9c0bb9..6bef539be 100644 --- a/rt/FREESIDE_MODIFIED +++ b/rt/FREESIDE_MODIFIED @@ -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 diff --git a/rt/etc/RT_Config.pm.in b/rt/etc/RT_Config.pm.in index 6b99b61a5..4fa08949e 100644 --- a/rt/etc/RT_Config.pm.in +++ b/rt/etc/RT_Config.pm.in @@ -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 (rt-server) Configuration diff --git a/rt/lib/RT/Search/Googleish.pm b/rt/lib/RT/Search/Googleish.pm index 4b73dd707..4232b434b 100644 --- a/rt/lib/RT/Search/Googleish.pm +++ b/rt/lib/RT/Search/Googleish.pm @@ -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;