[Rt-commit] [rtir] 01/02: in case $Query already includes $BaseQuery

? sunnavy sunnavy at bestpractical.com
Thu Jul 25 10:35:47 EDT 2013


This is an automated email from the git hooks/post-receive script.

sunnavy pushed a commit to branch 4.0/search-query-tweak
in repository rtir.

commit 7f997dd6e037159143fd500b79999b0b9283482f
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Jul 25 21:40:03 2013 +0800

    in case $Query already includes $BaseQuery
    
    here is the old code:
    
    $BaseQuery ||= RT::IR->Query( Queue => $Queue );
    $Query     ||= RT::IR->ActiveQuery( Queue => $Queue );
    
    if both $BaseQuery and $Query are empty before, they will be set to
    RT::IR->Query(...) and RT::IR->ActiveQuery(...) here, respectively.
    
    but ->ActiveQuery already includes ->Query, so the finaly query will be for
    example(combined by BaseQuery AND Query):
    
    ( ( Queue = 'Incidents' ) ) AND ( ( Queue = 'Incidents' ) AND Status = 'open' )
    
    so we don't need to set $BaseQuery in this case.
    
    you can reproduce it by accessing "/RTIR/Search/Results.html?Queue=Incidents"
    and then clicking the "Edit Search" menu
---
 html/RTIR/Search/Results.html | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/html/RTIR/Search/Results.html b/html/RTIR/Search/Results.html
index b815731..e73b016 100644
--- a/html/RTIR/Search/Results.html
+++ b/html/RTIR/Search/Results.html
@@ -82,8 +82,12 @@ RT::IR::Config::CheckObsoleteCFSyntax($Format,$location);
 RT::IR::Config::CheckObsoleteCFSyntax($Query,$location);
 
 if ( $Type ) {
-    $BaseQuery ||= RT::IR->Query( Queue => $Queue );
-    $Query     ||= RT::IR->ActiveQuery( Queue => $Queue );
+    if ( $Query ) {
+        $BaseQuery ||= RT::IR->Query( Queue => $Queue );
+    }
+    else {
+        $Query = RT::IR->ActiveQuery( Queue => $Queue );
+    }
 }
 
 my $BaseURL = "RTIR/Search/Results.html";

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Rt-commit mailing list