From 409aecf321eeb9395b45541130640509692604a7 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 2 Jun 2016 14:01:56 +0000 Subject: [PATCH] Bug 7441 - search results showing wrong branch? MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When you search in the OPAC it shows you the HOME branch on the location in XSLT, but if you click through to the detail page it shows you the CURRENT BRANCH in the holdings table which is very confusing to patrons. I don't know what's the right solution - home or holding branch, but they should be the same in both places for the patron's sake. If you do the same search in the staff client you see the right branch info on the search results and on the detail page. Test Plan: 1) Apply this patch 2) Run updatedatabase.pl 3) Search the catalog, you search should include results with items that have different home and holding libraries. 4) The results should look the same as before the patch 5) Change the system preference OPACResultsLibrary to "current location" 6) Refresh your page of search results 7) The results show now show the holding library instead of the home library Signed-off-by: Barbara Walters Signed-off-by: Nick Clemens Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall (cherry picked from commit 4db2e745e244bfc9e8315b4903c30e21142d9cb4) Signed-off-by: Frédéric Demians (cherry picked from commit 17a103d8a06345ad39e3af9c0d3a50c3f24ce5e7) Signed-off-by: Julian Maurice --- C4/XSLT.pm | 19 ++-- .../data/mysql/atomicupdate/bug_7441.sql | 2 + installer/data/mysql/sysprefs.sql | 1 + .../en/modules/admin/preferences/opac.pref | 6 ++ .../en/xslt/MARC21slim2OPACResults.xsl | 89 ++++++++++++------- 5 files changed, 75 insertions(+), 42 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_7441.sql diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 7a94f2c612..f0bedfd9a8 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -206,7 +206,8 @@ sub XSLTParse4Display { UseControlNumber IntranetBiblioDefaultView BiblioDefaultView singleBranchMode OPACItemLocation DisplayIconsXSLT AlternateHoldingsField AlternateHoldingsSeparator - TrackClicks opacthemes IdRef / ) + TrackClicks opacthemes IdRef + OPACResultsLibrary / ) { my $sp = C4::Context->preference( $syspref ); next unless defined($sp); @@ -293,13 +294,15 @@ sub buildKohaItemsNamespace { $location = $item->{location}? xml_escape($shelflocations->{$item->{location}}||$item->{location}):''; $ccode = $item->{ccode}? xml_escape($ccodes->{$item->{ccode}}||$item->{ccode}):''; my $itemcallnumber = xml_escape($item->{itemcallnumber}); - $xml.= "$homebranch". - "$holdingbranch". - "$location". - "$ccode". - "$status". - "".$itemcallnumber."". - ""; + $xml .= + "" + . "$homebranch" + . "$holdingbranch" + . "$location" + . "$ccode" + . "$status" + . "$itemcallnumber" + . ""; } $xml = "".$xml.""; return $xml; diff --git a/installer/data/mysql/atomicupdate/bug_7441.sql b/installer/data/mysql/atomicupdate/bug_7441.sql new file mode 100644 index 0000000000..0177a7962c --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_7441.sql @@ -0,0 +1,2 @@ +INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES +('OPACResultsLibrary', 'homebranch', 'homebranch|holdingbranch', 'Defines whether the OPAC displays the holding or home branch in search results when using XSLT', 'Choice'); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index efd95fd466..ac742ba12d 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -311,6 +311,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('opacreadinghistory','1','','If ON, enables display of Patron Circulation History in OPAC','YesNo'), ('OpacRenewalAllowed','0',NULL,'If ON, users can renew their issues directly from their OPAC account','YesNo'), ('OpacRenewalBranch','checkoutbranch','itemhomebranch|patronhomebranch|checkoutbranch|null','Choose how the branch for an OPAC renewal is recorded in statistics','Choice'), +('OPACResultsLibrary', 'homebranch', 'homebranch|holdingbranch', 'Defines whether the OPAC displays the holding or home branch in search results when using XSLT', 'Choice'), ('OPACResultsSidebar','','70|10','Define HTML to be included on the search results page, underneath the facets sidebar','Textarea'), ('OPACSearchForTitleIn','
  • Other Libraries (WorldCat)
  • \n
  • Other Databases (Google Scholar)
  • \n
  • Online Stores (Bookfinder.com)
  • \n
  • Open Library (openlibrary.org)
  • ','70|10','Enter the HTML that will appear in the \'Search for this title in\' box on the detail page in the OPAC. Enter {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the URL. Leave blank to disable \'More Searches\' menu.','Textarea'), ('OpacSeparateHoldings','0',NULL,'Separate current branch holdings from other holdings (OPAC)','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index c7943afd6e..e84b365e77 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -1,5 +1,11 @@ OPAC: Appearance: + - + - For search results in the OPAC, show the item's + - pref: OPACResultsLibrary + choices: + holdingbranch: "current location" + homebranch: "home library" - - Use the - pref: opacthemes diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl index 9b22fd58d9..dc66b3e5ba 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl @@ -10,7 +10,8 @@ - + + @@ -20,6 +21,7 @@ + @@ -1166,35 +1168,54 @@ - - - - [Call number: ] - ( - - ) - - . - , - - - - - - - - - [Call number: ] - ( - - ) - - . - , - - - - + + + + [Call number: ] + ( + + ) + + . + , + + + + + + + + + + + [Call number: ] + ( + + ) + + . + , + + + + + + + + + [Call number: ] + ( + + ) + + . + , + + + + + + @@ -1206,14 +1227,14 @@ Items available for reference: - + [Call number: ] ( - + ) . , @@ -1280,7 +1301,7 @@ - + @@ -1293,7 +1314,7 @@ - + -- 2.39.5