Bugzilla – Attachment 18857 Details for
Bug 7441
Search results showing wrong branch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7441 - search results showing wrong branch
Bug-7441---search-results-showing-wrong-branch.patch (text/plain), 16.69 KB, created by
Kyle M Hall (khall)
on 2013-06-11 19:14:43 UTC
(
hide
)
Description:
Bug 7441 - search results showing wrong branch
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-06-11 19:14:43 UTC
Size:
16.69 KB
patch
obsolete
>From 382e7cabd6039ea2ff27da0d50635d083848b30a Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >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. > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> > >Rebased on current master (2013-01-31). >--- > 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.= "<item><homebranch>$homebranch</homebranch>". >- "<holdingbranch>$holdingbranch</holdingbranch>". >- "<location>$location</location>". >- "<ccode>$ccode</ccode>". >- "<status>$status</status>". >- "<itemcallnumber>".$itemcallnumber."</itemcallnumber>" >- . "</item>"; >+ $xml .= >+ "<item>" >+ . "<homebranch>$homebranch</homebranch>" >+ . "<holdingbranch>$holdingbranch</holdingbranch>" >+ . "<location>$location</location>" >+ . "<ccode>$ccode</ccode>" >+ . "<status>$status</status>" >+ . "<itemcallnumber>$itemcallnumber</itemcallnumber>" >+ . "</item>"; > > } > $xml = "<items xmlns=\"http://www.koha-community.org/items\">".$xml."</items>"; >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index fbd0387..9ec8a49 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -427,3 +427,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' > INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('UseCourseReserves', '0', 'Enable the course reserves feature.', NULL, 'YesNo'); > 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, 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 648e161..318ca33 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -6991,6 +6991,13 @@ if ( CheckVersion($DBversion) ) { > } > > >+$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 @@ > <xsl:import href="MARC21slimUtils.xsl"/> > <xsl:output method = "html" indent="yes" omit-xml-declaration = "yes" encoding="UTF-8"/> > <xsl:key name="item-by-status" match="items:item" use="items:status"/> >- <xsl:key name="item-by-status-and-branch" match="items:item" use="concat(items:status, ' ', items:homebranch)"/> >+ <xsl:key name="item-by-status-and-branch-holding" match="items:item" use="concat(items:status, ' ', items:holdingbranch)"/> >+ <xsl:key name="item-by-status-and-branch-home" match="items:item" use="concat(items:status, ' ', items:homebranch)"/> > > <xsl:template match="/"> > <xsl:apply-templates/> >@@ -19,6 +20,7 @@ > <!-- Option: Display Alternate Graphic Representation (MARC 880) --> > <xsl:variable name="display880" select="boolean(marc:datafield[@tag=880])"/> > >+ <xsl:variable name="OPACResultsBranchXSLT" select="marc:sysprefs/marc:syspref[@name='OPACResultsBranchXSLT']"/> > <xsl:variable name="hidelostitems" select="marc:sysprefs/marc:syspref[@name='hidelostitems']"/> > <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/> > <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/> >@@ -1051,53 +1053,76 @@ > <xsl:variable name="available_items" > select="key('item-by-status', 'available')"/> > <xsl:choose> >- <xsl:when test="$singleBranchMode=1"> >- <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]"> >- <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >- <xsl:text> (</xsl:text> >- <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/> >- <xsl:text>)</xsl:text> >- <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> >+ <xsl:when test="$singleBranchMode=1"> >+ <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]"> >+ <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >+ <xsl:text> (</xsl:text> >+ <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/> >+ <xsl:text>)</xsl:text> >+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> >+ </xsl:for-each> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:choose> >+ <xsl:when test="$OPACResultsBranchXSLT='homebranch'"> >+ <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]"> >+ <xsl:value-of select="items:homebranch"/> >+ <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >+ <xsl:text> (</xsl:text> >+ <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/> >+ <xsl:text>)</xsl:text> >+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> > </xsl:for-each> >- </xsl:when> >- <xsl:otherwise> >- <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]"> >- <xsl:value-of select="items:homebranch"/> >- <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber and $OPACItemLocation='callnum'"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >- <xsl:text> (</xsl:text> >- <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/> >- <xsl:text>)</xsl:text> >- <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> >+ </xsl:when> >+ <xsl:when test="$OPACResultsBranchXSLT='holdingbranch'"> >+ <xsl:for-each select="$available_items[generate-id() = generate-id(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch))[1])]"> >+ <xsl:value-of select="items:holdingbranch"/> >+ <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >+ <xsl:text> (</xsl:text> >+ <xsl:value-of select="count(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch)))"/> >+ <xsl:text>)</xsl:text> >+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> > </xsl:for-each> >- </xsl:otherwise> >+ </xsl:when> >+ </xsl:choose> >+ </xsl:otherwise> > </xsl:choose> > > </span> > </xsl:when> > </xsl:choose> > >- <xsl:choose> >- <xsl:when test="count(key('item-by-status', 'reference'))>0"> >- <span class="available"> >- <b><xsl:text>Copies available for reference: </xsl:text></b> >- <xsl:variable name="reference_items" select="key('item-by-status', 'reference')"/> >- <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch))[1])]"> >- <xsl:value-of select="items:homebranch"/> >- <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >- <xsl:text> (</xsl:text> >- <xsl:value-of select="count(key('item-by-status-and-branch', concat(items:status, ' ', items:homebranch)))"/> >- <xsl:text> )</xsl:text> >- <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> >- </xsl:for-each> >- </span> >- </xsl:when> >- </xsl:choose> >+ <xsl:choose> >+ <xsl:when test="count(key('item-by-status', 'reference'))>0"> >+ <span class="available"> >+ <b><xsl:text>Copies available for reference: </xsl:text></b> >+ <xsl:variable name="reference_items" select="key('item-by-status', 'reference')"/> > >- <xsl:choose> <xsl:when test="count(key('item-by-status', 'available'))>0"> >- <xsl:choose><xsl:when test="count(key('item-by-status', 'reference'))>0"> >- <br/> >- </xsl:when></xsl:choose> >- </xsl:when> </xsl:choose> >+ <xsl:choose> >+ <xsl:when test="$OPACResultsBranchXSLT='homebranch'"> >+ <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch))[1])]"> >+ <xsl:value-of select="items:homebranch"/> >+ <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >+ <xsl:text> (</xsl:text> >+ <xsl:value-of select="count(key('item-by-status-and-branch-home', concat(items:status, ' ', items:homebranch)))"/> >+ <xsl:text>)</xsl:text> >+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> >+ </xsl:for-each> >+ </xsl:when> >+ <xsl:when test="$OPACResultsBranchXSLT='holdingbranch'"> >+ <xsl:for-each select="$reference_items[generate-id() = generate-id(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch))[1])]"> >+ <xsl:value-of select="items:holdingbranch"/> >+ <xsl:if test="items:itemcallnumber != '' and items:itemcallnumber"> [<xsl:value-of select="items:itemcallnumber"/>]</xsl:if> >+ <xsl:text> (</xsl:text> >+ <xsl:value-of select="count(key('item-by-status-and-branch-holding', concat(items:status, ' ', items:holdingbranch)))"/> >+ <xsl:text>)</xsl:text> >+ <xsl:choose><xsl:when test="position()=last()"><xsl:text>. </xsl:text></xsl:when><xsl:otherwise><xsl:text>, </xsl:text></xsl:otherwise></xsl:choose> >+ </xsl:for-each> >+ </xsl:when> >+ </xsl:choose> >+ </span> >+ </xsl:when> >+ </xsl:choose> > > <xsl:if test="count(key('item-by-status', 'Checked out'))>0"> > <span class="unavailable"> >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7441
:
8656
|
8657
|
9700
|
9701
|
12550
|
12551
|
12552
|
12553
|
13856
|
13888
|
14229
|
14361
|
14362
|
14977
|
14978
|
14979
|
17901
|
17902
|
17903
|
17968
|
18151
|
18152
|
18153
|
18154
|
18857
|
18858
|
18859
|
18942
|
19089
|
19090
|
19091
|
19470
|
19471
|
19472
|
19473
|
19474
|
19475
|
51963
|
52746
|
52747
|
52810
|
52811
|
54058
|
54101
|
54102
|
54250