From 82b6ba3d8056768aa3bef6b8dd96f1087e4f5870 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 27 Mar 2012 14:31:07 -0400 Subject: [PATCH] Bug 7441 - Part 1 - search results showing wrong branch 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 HOLDING branch in the holdings table which is very confusing to patrons. Fixed by adding a system preference to choose whether to display the holding branch or the home branch on the XSLT OPAC search results page. Signed-off-by: Bernardo Gonzalez Kriegel Rebased on current master (2013-01-31). Signed-off-by: Chris Rohde --- C4/XSLT.pm | 18 ++-- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 ++ .../prog/en/modules/admin/preferences/opac.pref | 7 ++ .../prog/en/xslt/MARC21slim2OPACResults.xsl | 103 ++++++++++++-------- 5 files changed, 89 insertions(+), 47 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 53f07d3..54aff60 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -207,7 +207,7 @@ sub XSLTParse4Display { UseControlNumber IntranetBiblioDefaultView BiblioDefaultView singleBranchMode OPACItemLocation DisplayIconsXSLT AlternateHoldingsField AlternateHoldingsSeparator - TrackClicks / ) + TrackClicks OPACResultsBranchXSLT / ) { my $sp = C4::Context->preference( $syspref ); next unless defined($sp); @@ -300,13 +300,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.""; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 0a3f20f..897632f 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -428,3 +428,4 @@ INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) V INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacHoldNotes',0,'Show hold notes on OPAC','','YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('CalculateFinesOnReturn','1','Switch to control if overdue fines are calculated on return or not', '', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('AcqWarnOnDuplicateInvoice','0','Warn librarians when they try to create a duplicate invoice', '', 'YesNo'); +INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('OPACResultsBranchXSLT', '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/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 08722cc..bc565d4 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -7030,6 +7030,13 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ( } +$DBversion = "3.13.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('OPACResultsBranchXSLT', 'homebranch', 'homebranch|holdingbranch', 'Defines whether the OPAC displays the holding or home branch in search results when using XSLT', 'Choice')"); + print "Upgrade to $DBversion done (Add syspref OPACResultsBranchXSLT)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) 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 90295ef..e377fd6 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 @@ -83,6 +83,13 @@ OPAC: no: "Don't show" - the format, audience, and material type icons in XSLT MARC21 results and detail pages in the OPAC. - + - On search result pages displayed with XSLT stylesheets on the OPAC, show the item's + - pref: OPACResultsBranchXSLT + choices: + holdingbranch: "holding branch" + homebranch: "home branch" + - icons for itemtype and authorized values. + - - pref: COinSinOPACResults choices: yes: Include diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl index 20fdabf..08a5139 100644 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl @@ -9,7 +9,8 @@ - + + @@ -19,6 +20,7 @@ + @@ -1051,53 +1053,76 @@ - - - [] - ( - - ) - . , + + + [] + ( + + ) + . , + + + + + + + + [] + ( + + ) + . , - - - - - [] - ( - - ) - . , + + + + + [] + ( + + ) + . , - + + + - - - - Copies available for reference: - - - - [] - ( - - ) - . , - - - - + + + + Copies available for reference: + - - -
-
-
+ + + + + [] + ( + + ) + . , + + + + + + [] + ( + + ) + . , + + + +
+
+
-- 1.7.2.5