From c28e2fdbf10facbd17fe5ff37b860b30cc6348c3 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 27 Mar 2012 14:31:07 -0400 Subject: [PATCH] Bug 7441 - 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. --- C4/XSLT.pm | 7 +- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 8 ++ .../prog/en/modules/admin/preferences/opac.pref | 7 ++ .../prog/en/xslt/MARC21slim2OPACResults.xsl | 86 +++++++++++++------- 5 files changed, 78 insertions(+), 31 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 19ec162..7fab3f8 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -188,7 +188,7 @@ sub XSLTParse4Display { UseAuthoritiesForTracings TraceSubjectSubdivisions Display856uAsImage OPACDisplay856uAsImage UseControlNumber IntranetBiblioDefaultView BiblioDefaultView - singleBranchMode + singleBranchMode OPACResultsBranchXSLT AlternateHoldingsField AlternateHoldingsSeparator / ) { my $sp = C4::Context->preference( $syspref ); @@ -272,8 +272,9 @@ sub buildKohaItemsNamespace { $status = "available"; } my $homebranch = $item->{homebranch}? xml_escape($branches->{$item->{homebranch}}->{'branchname'}):''; - my $itemcallnumber = xml_escape($item->{itemcallnumber}); - $xml.= "$homebranch". + my $holdingbranch = $item->{holdingbranch}? xml_escape($branches->{$item->{holdingbranch}}->{'branchname'}):''; + my $itemcallnumber = xml_escape($item->{itemcallnumber}); + $xml.= "$homebranch$holdingbranch". "$status". "".$itemcallnumber."" . ""; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 0cc5a54..3d93468 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -388,3 +388,4 @@ INSERT INTO systempreferences (variable, value, options, explanation, type) VALU INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to pull list to this many days ago',NULL,'Integer'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('alphabet','A B C D E F G H I J K L M N O P Q R S T U V W X Y Z','Alphabet than can be expanded into browse links, e.g. on Home > Patrons',NULL,'free'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('RefundLostItemFeeOnReturn', '1', 'If enabled, the lost item fee charged to a borrower will be refunded when the lost item is returned.', NULL, '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 a6af263..a6e6bde 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5982,6 +5982,7 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +<<<<<<< HEAD $DBversion ="3.09.00.058"; if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { $dbh->do("INSERT INTO systempreferences (variable,value,explanation,type) VALUES('OPACdidyoumean',NULL,'Did you mean? configuration for the OPAC. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free');"); @@ -6114,6 +6115,13 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.09.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 2866f8d..a817680 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 @@ -73,6 +73,13 @@ OPAC: no: "don't show" - icons for itemtype and authorized values. - + - 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 cdc803e..8d8c036 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 @@ + @@ -1027,25 +1029,39 @@ - - - [] - ( - - ) - . , + + + [] + ( + + ) + . , + + + + + + + + [] + ( + + ) + . , - - - - - [] - ( - - ) - . , + + + + + [] + ( + + ) + . , - + + + @@ -1062,16 +1078,30 @@ Copies available for reference: - - - - [] - ( - - ) - . , - + + + + + + + [] + ( + + ) + . , + + + + + + [] + ( + + ) + . , + + + -- 1.7.2.5