From 7bdc2427b508b24269c09fcf59c57b71e8494c85 Mon Sep 17 00:00:00 2001
From: Galen Charlton <gmc@esilibrary.com>
Date: Mon, 19 Aug 2013 18:22:00 +0000
Subject: [PATCH] [SIGNED-OFF] Bug 10766: unbreak reservoir search when
 UseQueryParser is OFF
Content-Type: text/plain; charset="utf-8"

To test:

[1] Turn UseQueryParser off.
[2] Ensure that your database has records in the reservoir.  Performing
    a Z39.50 search will do this.
[3] Perform a broad cataloging (i.e., cataloguing/addbooks.pl search).
    Note that results are returned from the main catalog but that no
    reservoir results are returned.
[4] Apply the patch.
[5] Perform the search again.  This time, there should be both catalog
    and reservoir results.
[7] Enable QueryParser.  Perform the search again, and verify that the
    catalog and reservoir results are the same.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>
---
 cataloguing/addbooks.pl |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/cataloguing/addbooks.pl b/cataloguing/addbooks.pl
index f643599..b22a646 100755
--- a/cataloguing/addbooks.pl
+++ b/cataloguing/addbooks.pl
@@ -73,9 +73,12 @@ if ($query) {
 
     my $QParser;
     $QParser = C4::Context->queryparser if (C4::Context->preference('UseQueryParser'));
-    unless ($QParser) {
-        my ( $builterror,$builtquery,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(undef,\@operands);
-        $query = $builtquery;
+    my $builtquery;
+    if ($QParser) {
+        $builtquery = $query;
+    } else {
+        my ( $builterror,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type);
+        ( $builterror,$builtquery,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type) = buildQuery(undef,\@operands);
     }
 
     # find results
-- 
1.7.9.5