Bugzilla – Attachment 35652 Details for
Bug 13650
Parenthesis in subject links problematic for search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 13650: Remove parens from links to fix searches
PASSED-QA-Bug-13650-Remove-parens-from-links-to-fi.patch (text/plain), 8.37 KB, created by
Katrin Fischer
on 2015-02-01 22:14:36 UTC
(
hide
)
Description:
[PASSED QA] Bug 13650: Remove parens from links to fix searches
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2015-02-01 22:14:36 UTC
Size:
8.37 KB
patch
obsolete
>From 73b9e7e654bdd9f54aa457958eb04b58669a8714 Mon Sep 17 00:00:00 2001 >From: Winona Salesky <wsalesky@gmail.com> >Date: Thu, 29 Jan 2015 14:13:37 -0600 >Subject: [PATCH] [PASSED QA] Bug 13650: Remove parens from links to fix > searches > >This patch will resolve the issue of not being able to >search with parens in a subject heading by editing the xslt > >To test: > >* Apply patch >* Search Koha for a title with ( ) in the subject >* Click the subject >* Results should be returned >* Repeat in OPAC and Staff client > >Signed-off-by: Nick <Nick@quechelibrary.org> >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >--- > .../prog/en/xslt/MARC21slim2intranetDetail.xsl | 28 ++++++++++++++++++++-- > .../bootstrap/en/xslt/MARC21slim2OPACDetail.xsl | 28 ++++++++++++++++++++-- > 2 files changed, 52 insertions(+), 4 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >index f96c0eb..fdb3dea 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >@@ -3,6 +3,7 @@ > <!DOCTYPE stylesheet [<!ENTITY nbsp " " >]> > > <!-- $Id: MARC21slim2DC.xsl,v 1.1 2003/01/06 08:20:27 adam Exp $ --> >+<!-- Edited: Bug 1807 [ENH] XSLT enhancements sponsored by bywater solutions 2015/01/19 WS wsalesky@gmail.com --> > <xsl:stylesheet version="1.0" > xmlns:marc="http://www.loc.gov/MARC21/slim" > xmlns:items="http://www.koha-community.org/items" >@@ -530,11 +531,12 @@ > <xsl:for-each select="marc:datafield[substring(@tag, 1, 1) = '6']"> > <a> > <xsl:choose> >+ <!-- #1807 Strip unwanted parenthesis from subjects for searching --> > <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'"> > <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute> > </xsl:when> > <xsl:when test="$TraceSubjectSubdivisions='1'"> >- <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelect"> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:call-template name="subfieldSelectSubject"> > <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param> > <xsl:with-param name="delimeter"> AND </xsl:with-param> > <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param> >@@ -542,8 +544,9 @@ > </xsl:call-template> > </xsl:attribute> > </xsl:when> >+ <!-- #1807 Strip unwanted parenthesis from subjects for searching --> > <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="marc:subfield[@code='a']"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="translate(marc:subfield[@code='a'],'()','')"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute> > </xsl:otherwise> > </xsl:choose> > <xsl:call-template name="chopPunctuation"> >@@ -985,4 +988,25 @@ > </xsl:if> > </xsl:template> > >+ <!-- #1807 Strip unwanted parenthesis from subjects for searching --> >+ <xsl:template name="subfieldSelectSubject"> >+ <xsl:param name="codes"/> >+ <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param> >+ <xsl:param name="subdivCodes"/> >+ <xsl:param name="subdivDelimiter"/> >+ <xsl:param name="prefix"/> >+ <xsl:param name="suffix"/> >+ <xsl:variable name="str"> >+ <xsl:for-each select="marc:subfield"> >+ <xsl:if test="contains($codes, @code)"> >+ <xsl:if test="contains($subdivCodes, @code)"> >+ <xsl:value-of select="$subdivDelimiter"/> >+ </xsl:if> >+ <xsl:value-of select="$prefix"/><xsl:value-of select="translate(text(),'()','')"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/> >+ </xsl:if> >+ </xsl:for-each> >+ </xsl:variable> >+ <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/> >+ </xsl:template> >+ > </xsl:stylesheet> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >index af9ac00..5f1311a 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >@@ -1,5 +1,6 @@ > <?xml version="1.0" encoding="UTF-8"?> > <!-- $Id: MARC21slim2DC.xsl,v 1.1 2003/01/06 08:20:27 adam Exp $ --> >+<!-- Edited: Bug 1807 [ENH] XSLT enhancements sponsored by bywater solutions 2015/01/19 WS wsalesky@gmail.com --> > <!DOCTYPE stylesheet [<!ENTITY nbsp " " >]> > <xsl:stylesheet version="1.0" > xmlns:marc="http://www.loc.gov/MARC21/slim" >@@ -581,8 +582,9 @@ > <xsl:when test="marc:subfield[@code=9] and $UseAuthoritiesForTracings='1'"> > <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=an:<xsl:value-of select="marc:subfield[@code=9]"/></xsl:attribute> > </xsl:when> >+ <!-- #1807 Strip unwanted parenthesis from subjects for searching --> > <xsl:when test="$TraceSubjectSubdivisions='1'"> >- <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:call-template name="subfieldSelect"> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:call-template name="subfieldSelectSubject"> > <xsl:with-param name="codes">abcdfgklmnopqrstvxyz</xsl:with-param> > <xsl:with-param name="delimeter"> AND </xsl:with-param> > <xsl:with-param name="prefix">(su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/></xsl:with-param> >@@ -590,8 +592,9 @@ > </xsl:call-template> > </xsl:attribute> > </xsl:when> >+ <!-- #1807 Strip unwanted parenthesis from subjects for searching --> > <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="marc:subfield[@code='a']"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=su<xsl:value-of select="$SubjectModifier"/>:<xsl:value-of select="$TracingQuotesLeft"/><xsl:value-of select="translate(marc:subfield[@code='a'],'()','')"/><xsl:value-of select="$TracingQuotesRight"/></xsl:attribute> > </xsl:otherwise> > </xsl:choose> > <xsl:call-template name="chopPunctuation"> >@@ -1173,4 +1176,25 @@ > </xsl:variable> > <xsl:value-of select="substring($str,1,string-length($str)-1)"/> > </xsl:template> >+ >+ <!-- #1807 Strip unwanted parenthesis from subjects for searching --> >+ <xsl:template name="subfieldSelectSubject"> >+ <xsl:param name="codes"/> >+ <xsl:param name="delimeter"><xsl:text> </xsl:text></xsl:param> >+ <xsl:param name="subdivCodes"/> >+ <xsl:param name="subdivDelimiter"/> >+ <xsl:param name="prefix"/> >+ <xsl:param name="suffix"/> >+ <xsl:variable name="str"> >+ <xsl:for-each select="marc:subfield"> >+ <xsl:if test="contains($codes, @code)"> >+ <xsl:if test="contains($subdivCodes, @code)"> >+ <xsl:value-of select="$subdivDelimiter"/> >+ </xsl:if> >+ <xsl:value-of select="$prefix"/><xsl:value-of select="translate(text(),'()','')"/><xsl:value-of select="$suffix"/><xsl:value-of select="$delimeter"/> >+ </xsl:if> >+ </xsl:for-each> >+ </xsl:variable> >+ <xsl:value-of select="substring($str,1,string-length($str)-string-length($delimeter))"/> >+ </xsl:template> > </xsl:stylesheet> >-- >1.9.1
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 13650
: 35652