Bug 9395: Problem with callnumber and standard number searches
authorVitor FERNANDES <vfernandes@keep.pt>
Tue, 15 Jan 2013 17:19:59 +0000 (17:19 +0000)
committerJared Camins-Esakov <jcamins@cpbibliography.com>
Fri, 15 Feb 2013 23:30:15 +0000 (18:30 -0500)
This problem happens because there isn't a operator "phr" in the values
of callnumber and standard number search. So many results aren't the
corrects ones.

Test plan:

- Apply the patch
- In the dropbox search menu of OPAC main page header, the callnum
  should have only callnum
- In OPAC advanced search the callnumber and standard number options
  shouldn't have "phr"
- In staff client advanced search the callnumber and standard number
  options shouldn't have "phr"
- Change OPACNumbersPreferPhrase and IntranetNumbersPreferPhrase to "use"
- The options listed before should use now the operator "phr"
- This will resolve the problems with the searches of callnumbers and
  standard numbers in OPAC and staff client (spaces problems, no
  results, inconsistent results, etc...)

Sponsored-by: KEEP SOLUTIONS
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

I don't know how to reproduce the searching problems described in the
bug, but I can confirm that the patch works correctly to enable/disable
the use of 'phr' in the searches described in the test plan.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
System preferences work as described, switching indexes in
OPAC and staff.
All tests and QA script pass.
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>

catalogue/search.pl
installer/data/mysql/sysprefs.sql
installer/data/mysql/updatedatabase.pl
koha-tmpl/intranet-tmpl/prog/en/includes/search_indexes.inc
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref
koha-tmpl/opac-tmpl/prog/en/includes/masthead.inc
koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt
opac/opac-main.pl
opac/opac-search.pl

index d1a3ca2..680f837 100755 (executable)
@@ -182,6 +182,9 @@ else {
 if (C4::Context->preference("marcflavour") eq "UNIMARC" ) {
     $template->param('UNIMARC' => 1);
 }
+if (C4::Context->preference("IntranetNumbersPreferPhrase")) {
+    $template->param('numbersphr' => 1);
+}
 
 if($cgi->cookie("holdfor")){ 
     my $holdfor_patron = GetMember('borrowernumber' => $cgi->cookie("holdfor"));
index 9032bfa..46c2371 100644 (file)
@@ -411,3 +411,5 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES (
 INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReviews','0','Display book review snippets from IDreamBooks.com','','YesNo');
 INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReadometer','0','Display Readometer from IDreamBooks.com','','YesNo');
 INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksResults','0','Display IDreamBooks.com rating in search results','','YesNo');
+INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('OPACNumbersPreferPhrase','0', NULL, 'Control the use of phr operator in callnumber and standard number OPAC searches', 'YesNo');
+INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('IntranetNumbersPreferPhrase','0', NULL, 'Control the use of phr operator in callnumber and standard number staff client searches', 'YesNo');
index ed922b8..f609efd 100755 (executable)
@@ -6399,6 +6399,13 @@ if ( CheckVersion($DBversion) ) {
     SetVersion($DBversion);
 }
 
+$DBversion = "3.11.00.XXX";
+if ( CheckVersion($DBversion) ) {
+   $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('OPACNumbersPreferPhrase','0', NULL, 'Control the use of phr operator in callnumber and standard number OPAC searches', 'YesNo')");
+   $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ('IntranetNumbersPreferPhrase','0', NULL, 'Control the use of phr operator in callnumber and standard number staff client searches', 'YesNo')");
+   print "Upgrade to $DBversion done (Bug 9395: Problem with callnumber and standard number search in OPAC and Staff Client)\n";
+   SetVersion ($DBversion);
+}
 
 =head1 FUNCTIONS
 
index 8102201..faabc42 100644 (file)
     [% END %]
     <option value="bc">Barcode</option>
     <option value="location">Shelving location</option>
+    [% IF (numbersphr) %]
+    <option value="sn,phr">Standard number</option>
+    [% ELSE %]
     <option value="sn">Standard number</option>
+    [% END %]
     <option value="nb">&nbsp;&nbsp;&nbsp;&nbsp; ISBN</option>
     <option value="ns">&nbsp;&nbsp;&nbsp;&nbsp; ISSN</option>
+    [% IF (numbersphr) %]
+    <option value="callnum,phr">&nbsp;&nbsp;&nbsp;&nbsp; Call number</option>
+    [% ELSE %]
     <option value="callnum">&nbsp;&nbsp;&nbsp;&nbsp; Call number</option>
+    [% END %]
     <option value="ln,rtrn">Language</option>
     <option value="nt">Notes/Comments</option>
     [% IF (marcflavour != 'UNIMARC' ) %]
index 7b99173..451cbc9 100644 (file)
@@ -79,6 +79,22 @@ Searching:
                   yes: show
                   no: "don't show"
             - '"More options" on the OPAC and staff advanced search pages.'
+        -
+            - By default,
+            - pref: OPACNumbersPreferPhrase
+              type: boolean
+              choices:
+                  yes: use
+                  no: "don't use"
+            - 'the operator "phr" in the callnumber and standard number OPAC searches'
+        -
+            - By default,
+            - pref: IntranetNumbersPreferPhrase
+              type: boolean
+              choices:
+                  yes: use
+                  no: "don't use"
+            - 'the operator "phr" in the callnumber and standard number staff client searches'
     Results Display:
         -
             - By default, sort search results in the staff client by
index 87e35a6..35db422 100644 (file)
                [% ELSE %]
         <option value="se">Series</option>
                [% END %]
-               [% IF ( ms_callnum ) %]
+                [% IF ( numbersphr ) %]
+                [% IF ( ms_callnum ) %]
+        <option selected="selected" value="callnum,phr">Call number</option>
+                [% ELSE %]
+        <option value="callnum,phr">Call number</option>
+                [% END %]
+                [% ELSE %]
+                [% IF ( ms_callnum ) %]
         <option selected="selected" value="callnum">Call number</option>
-               [% ELSE %]
+                [% ELSE %]
         <option value="callnum">Call number</option>
-               [% END %]</select>
+                [% END %]
+                [% END %]</select>
 [% IF ( ms_value ) %]
         <input type="text" title="Type search term" id = "transl1" name="q" value="[% ms_value |html %]" class="left" style="width: 35%; font-size: 111%;"/><div id="translControl"></div>
 [% ELSE %]
index be2a6f7..825e8be 100644 (file)
 [% IF ( expanded_options ) %]
             <option value="ti,phr">&nbsp;&nbsp;&nbsp;&nbsp; Title phrase</option>
             <option value="se,wrdl">Series title</option>
+            [% IF ( numbersphr) %]
+            <option value="callnum,phr">Call number</option>
+            [% ELSE %]
             <option value="callnum">Call number</option>
+            [% END %]
             <option value="location">Shelving location</option>
 [% END %]
             <option value="au,wrdl">Author</option>
             <option value="pb,wrdl">Publisher</option>
             <option value="pl,wrdl">Publisher location</option>
 [% IF ( expanded_options ) %]
+            [% IF ( numbersphr) %]
+            <option value="sn,phr">Standard number</option>
+            [% ELSE %]
+            <option value="sn">Standard number</option>
+            [% END %]
             <option value="sn">Standard number</option>
             <option value="nb">&nbsp;&nbsp;&nbsp;&nbsp; ISBN</option>
             <option value="ns">&nbsp;&nbsp;&nbsp;&nbsp; ISSN</option>
+            [% IF ( numbersphr) %]
             <option value="lcn,phr">&nbsp;&nbsp;&nbsp;&nbsp; Call number</option>
+            [% ELSE %]
+            <option value="lcn">&nbsp;&nbsp;&nbsp;&nbsp; Call number</option>
+            [% END %]
 [% ELSE %]
             <option value="nb">ISBN</option>
 [% END %]
index c716c60..7c6ee36 100755 (executable)
@@ -65,4 +65,8 @@ if (C4::Context->preference('GoogleIndicTransliteration')) {
         $template->param('GoogleIndicTransliteration' => 1);
 }
 
+if (C4::Context->preference('OPACNumbersPreferPhrase')) {
+        $template->param('numbersphr' => 1);
+}
+
 output_html_with_http_headers $input, $cookie, $template->output;
index 97a7bc4..4744ac6 100755 (executable)
@@ -293,6 +293,11 @@ if ( $template_type && $template_type eq 'advsearch' ) {
             $template->param( expanded_options => $cgi->param('expanded_options'));
         }
     }
+
+    if (C4::Context->preference('OPACNumbersPreferPhrase')) {
+        $template->param('numbersphr' => 1);
+    }
+
     output_html_with_http_headers $cgi, $cookie, $template->output;
     exit;
 }