[Koha-patches] [PATCH] Bug 4852 - rewrite the query to include limits if using ccl=

Frédéric Demians f.demians at tamil.fr
Fri Feb 25 09:09:05 CET 2011


From: Robin Sheat <robin at catalyst.net.nz>

It applies on 3.2.x.

Signed-off-by: Jared Camins-Esakov <jcamins at bywatersolutions.com>
Signed-off-by: Frédéric Demians <f.demians at tamil.fr>
---
 C4/Search.pm |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/C4/Search.pm b/C4/Search.pm
index a469948..45ebb24 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -1043,7 +1043,13 @@ sub buildQuery {
 # for handling ccl, cql, pqf queries in diagnostic mode, skip the rest of the steps
 # DIAGNOSTIC ONLY!!
     if ( $query =~ /^ccl=/ ) {
-        return ( undef, $', $', "q=ccl=$'", $', '', '', '', '', 'ccl' );
+        my $q=$';
+        # This is needed otherwise ccl= and &limit won't work together, and
+        # this happens when selecting a subject on the opac-detail page
+        if (@limits) {
+            $q .= ' and '.join(' and ', @limits);
+        }
+        return ( undef, $q, $q, "q=ccl=$q", $q, '', '', '', '', 'ccl' );
     }
     if ( $query =~ /^cql=/ ) {
         return ( undef, $', $', "q=cql=$'", $', '', '', '', '', 'cql' );
-- 
1.7.4



More information about the Koha-patches mailing list