[Rt-commit] [rtir] 02/02: avoid unnecessary parens when $BaseQuery and $Query are not both set

? 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 3068ab7c9ce3b016ef9cf7c391efc6b42aacd370
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Thu Jul 25 22:11:27 2013 +0800

    avoid unnecessary parens when $BaseQuery and $Query are not both set
---
 html/RTIR/Search/Elements/ShowResults | 7 ++++++-
 html/RTIR/Search/Reporting.html       | 9 ++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/html/RTIR/Search/Elements/ShowResults b/html/RTIR/Search/Elements/ShowResults
index b9db21e..117acd5 100644
--- a/html/RTIR/Search/Elements/ShowResults
+++ b/html/RTIR/Search/Elements/ShowResults
@@ -47,7 +47,12 @@
 %# END BPS TAGGED BLOCK }}}
 <%INIT>
 
-$Query = join ' AND ', map "( $_ )", grep $_, $BaseQuery, $Query;
+if ( $BaseQuery && $Query ) {
+    $Query = join ' AND ', map "( $_ )", $BaseQuery, $Query;
+}
+else {
+    $Query ||= $BaseQuery;
+}
 
 $BaseURL = RT->Config->Get('WebPath')."/$BaseURL" unless $BaseURL =~ m{^/};
 $BaseURL .= ( $BaseURL =~ /\?/ )? '&': '?' unless $BaseURL =~ m{[&?]$};
diff --git a/html/RTIR/Search/Reporting.html b/html/RTIR/Search/Reporting.html
index 922e9fb..69bd4c5 100644
--- a/html/RTIR/Search/Reporting.html
+++ b/html/RTIR/Search/Reporting.html
@@ -71,7 +71,14 @@
 <%INIT>
 my $title = loc('Reporting');
 
-my $FullQuery = join ' AND ', map "( $_ )", grep $_, $BaseQuery, $Query;
+my $FullQuery;
+
+if ( $BaseQuery && $Query ) {
+    $FullQuery = join ' AND ', map "( $_ )", $BaseQuery, $Query;
+}
+else {
+    $FullQuery = $BaseQuery || $Query;
+}
 
 </%INIT>
 

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


More information about the Rt-commit mailing list