Bugzilla – Attachment 165365 Details for
Bug 32695
Search string for various 7xx linking fields is incorrectly formed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32695: Fix search strings for 775, 780, 785 and 787
Bug-32695-Fix-search-strings-for-775-780-785-and-7.patch (text/plain), 25.52 KB, created by
Martin Renvoize (ashimema)
on 2024-04-23 10:09:09 UTC
(
hide
)
Description:
Bug 32695: Fix search strings for 775, 780, 785 and 787
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-04-23 10:09:09 UTC
Size:
25.52 KB
patch
obsolete
>From bb87f77b4736e2343507186ca1df8e3ed24e3d49 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Fri, 26 May 2023 19:00:13 +0000 >Subject: [PATCH] Bug 32695: Fix search strings for 775, 780, 785 and 787 >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >In the past due to some misunderstanding of the MARC standard >we built the search links for these fields using $a and $t with >the title index. But we actually need to search $t as title >and $a as author. >This patch fixes the templates for the MARC 7xx fields: >* 775 >* 780 >* 785 >* 787 > >To test: >* Ensure systme preference 'UseControlNumber' is set to don't >* Create a record with the linking fields above >* Look at the OPAC and staff interface detail views >* Verify the content of your fields shows and the links combine a+t as a title search >* Apply patch >* Verify you have nicely formatted links now > >Example: >775 _ _ â¡asomeoneâ¡ttitle775 >780 0 2 â¡asomeoneâ¡ttitle780 >785 0 2 â¡asomeoneâ¡ttitle785 >787 _ _ â¡ilabel:â¡ttitle787â¡asomeone > >Signed-off-by: Sabrina Kiehl <kiehl@mpis.mpg.de> >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../en/xslt/MARC21slim2intranetDetail.xsl | 109 ++++++++++++----- > .../en/xslt/MARC21slim2OPACDetail.xsl | 115 ++++++++++++------ > 2 files changed, 158 insertions(+), 66 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >index 48439f3a241..36b01059b06 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >@@ -1321,16 +1321,29 @@ > <xsl:if test="marc:datafield[@tag=775]"> > <span class="results_summary other_editions"><span class="label">Other editions: </span> > <xsl:for-each select="marc:datafield[@tag=775]"> >- <xsl:variable name="f775"> >- <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect"> >- <xsl:with-param name="codes">a_t</xsl:with-param> >- </xsl:call-template></xsl:with-param></xsl:call-template> >+ >+ <xsl:variable name="relation_query"> >+ <xsl:text>ti,phr:(</xsl:text> >+ <xsl:call-template name="quote_search_term"> >+ <xsl:with-param name="term"><xsl:value-of select="marc:subfield[@code='t']"/></xsl:with-param> >+ </xsl:call-template> >+ <xsl:text>)</xsl:text> >+ <xsl:if test="marc:subfield[@code='a']"> >+ <xsl:text> AND au:(</xsl:text> >+ <xsl:call-template name="quote_search_term"> >+ <xsl:with-param name="term"> >+ <xsl:value-of select="marc:subfield[@code='a']"/> >+ </xsl:with-param> >+ </xsl:call-template> >+ <xsl:text>)</xsl:text> >+ </xsl:if> > </xsl:variable> >+ > <xsl:if test="marc:subfield[@code='i']"> > <xsl:call-template name="subfieldSelect"> > <xsl:with-param name="codes">i</xsl:with-param> > </xsl:call-template> >- <xsl:text>: </xsl:text> >+ <xsl:text> </xsl:text> > </xsl:if> > <a> > <xsl:choose> >@@ -1338,7 +1351,7 @@ > <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute> > </xsl:when> > <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f775, '()', ''), true())"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="str:encode-uri($relation_query, true())" /></xsl:attribute> > </xsl:otherwise> > </xsl:choose> > <xsl:call-template name="subfieldSelect"> >@@ -1393,20 +1406,38 @@ > </span> > </xsl:if> > >- <xsl:variable name="f780"> >- <xsl:call-template name="subfieldSelect"> >- <xsl:with-param name="codes">a_t</xsl:with-param> >+ <xsl:variable name="relation_query"> >+ <xsl:text>ti,phr:(</xsl:text> >+ <xsl:call-template name="quote_search_term"> >+ <xsl:with-param name="term"><xsl:value-of select="marc:subfield[@code='t']"/></xsl:with-param> > </xsl:call-template> >+ <xsl:text>)</xsl:text> >+ <xsl:if test="marc:subfield[@code='a']"> >+ <xsl:text> AND au:(</xsl:text> >+ <xsl:call-template name="quote_search_term"> >+ <xsl:with-param name="term"> >+ <xsl:value-of select="marc:subfield[@code='a']"/> >+ </xsl:with-param> >+ </xsl:call-template> >+ <xsl:text>)</xsl:text> >+ </xsl:if> > </xsl:variable> >+ > <xsl:choose> > <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']"> >- <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute> >- <xsl:value-of select="$f780"/> >+ <a> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes">a_t</xsl:with-param> >+ </xsl:call-template> > </a> > </xsl:when> > <xsl:otherwise> >- <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f780, '()', ''), true())"/></xsl:attribute> >- <xsl:value-of select="$f780"/> >+ <a> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="str:encode-uri($relation_query, true())" /></xsl:attribute> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes">a_t</xsl:with-param> >+ </xsl:call-template> > </a> > </xsl:otherwise> > </xsl:choose> >@@ -1463,21 +1494,38 @@ > </span> > </xsl:if> > >- <xsl:variable name="f785"> >- <xsl:call-template name="subfieldSelect"> >- <xsl:with-param name="codes">a_t</xsl:with-param> >+ <xsl:variable name="relation_query"> >+ <xsl:text>ti,phr:(</xsl:text> >+ <xsl:call-template name="quote_search_term"> >+ <xsl:with-param name="term"><xsl:value-of select="marc:subfield[@code='t']"/></xsl:with-param> > </xsl:call-template> >+ <xsl:text>)</xsl:text> >+ <xsl:if test="marc:subfield[@code='a']"> >+ <xsl:text> AND au:(</xsl:text> >+ <xsl:call-template name="quote_search_term"> >+ <xsl:with-param name="term"> >+ <xsl:value-of select="marc:subfield[@code='a']"/> >+ </xsl:with-param> >+ </xsl:call-template> >+ <xsl:text>)</xsl:text> >+ </xsl:if> > </xsl:variable> > > <xsl:choose> > <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']"> >- <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute> >- <xsl:value-of select="$f785"/> >+ <a> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes">a_t</xsl:with-param> >+ </xsl:call-template> > </a> > </xsl:when> > <xsl:otherwise> >- <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f785, '()', ''), true())"/></xsl:attribute> >- <xsl:value-of select="$f785"/> >+ <a> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="str:encode-uri($relation_query, true())" /></xsl:attribute> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes">a_t</xsl:with-param> >+ </xsl:call-template> > </a> > </xsl:otherwise> > </xsl:choose> >@@ -1492,21 +1540,19 @@ > <span class="results_summary other_relationship_entry"><span class="label">Other related works: </span> > <xsl:for-each select="marc:datafield[@tag=787]"> > <span class="other_relationship_entry"> >- <xsl:variable name="f787"> >- <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect"> >- <xsl:with-param name="codes">a_t</xsl:with-param> >- </xsl:call-template></xsl:with-param></xsl:call-template> >- </xsl:variable> > <xsl:if test="marc:subfield[@code='i']"> > <xsl:call-template name="subfieldSelect"> > <xsl:with-param name="codes">i</xsl:with-param> > </xsl:call-template> >- <xsl:text>: </xsl:text> >+ <xsl:text> </xsl:text> > </xsl:if> > <xsl:choose> > <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']"> >- <a><xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute> >- <xsl:value-of select="$f787"/> >+ <a> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes">a_t</xsl:with-param> >+ </xsl:call-template> > </a> > </xsl:when> > <xsl:otherwise> >@@ -1527,9 +1573,10 @@ > </xsl:if> > </xsl:variable> > <a> >- <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="str:encode-uri($relation_query, true())" /> >- </xsl:attribute> >- <xsl:value-of select="$f787"/> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=<xsl:value-of select="str:encode-uri($relation_query, true())" /></xsl:attribute> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes">a_t</xsl:with-param> >+ </xsl:call-template> > </a> > </xsl:otherwise> > </xsl:choose> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >index 3fe783b6152..515f9543456 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >@@ -1094,21 +1094,19 @@ > <span class="results_summary other_relationship_entry"><span class="label">Other related works: </span> > <xsl:for-each select="marc:datafield[@tag=787]"> > <span class="other_relationship_entry"> >- <xsl:variable name="f787"> >- <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect"> >- <xsl:with-param name="codes">a_t</xsl:with-param> >- </xsl:call-template></xsl:with-param></xsl:call-template> >- </xsl:variable> > <xsl:if test="marc:subfield[@code='i']"> > <xsl:call-template name="subfieldSelect"> > <xsl:with-param name="codes">i</xsl:with-param> > </xsl:call-template> >- <xsl:text>: </xsl:text> >+ <xsl:text> </xsl:text> > </xsl:if> > <xsl:choose> > <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']"> >- <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute> >- <xsl:value-of select="$f787"/> >+ <a> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes">a_t</xsl:with-param> >+ </xsl:call-template> > </a> > </xsl:when> > <xsl:otherwise> >@@ -1129,9 +1127,10 @@ > </xsl:if> > </xsl:variable> > <a> >- <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="str:encode-uri($relation_query, true())" /> >- </xsl:attribute> >- <xsl:value-of select="$f787"/> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="str:encode-uri($relation_query, true())" /></xsl:attribute> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes">a_t</xsl:with-param> >+ </xsl:call-template> > </a> > </xsl:otherwise> > </xsl:choose> >@@ -1532,25 +1531,38 @@ > <xsl:if test="marc:datafield[@tag=775]"> > <span class="results_summary other_editions"><span class="label">Other editions: </span> > <xsl:for-each select="marc:datafield[@tag=775]"> >- <xsl:variable name="f775"> >- <xsl:call-template name="chopPunctuation"><xsl:with-param name="chopString"><xsl:call-template name="subfieldSelect"> >- <xsl:with-param name="codes">a_t</xsl:with-param> >- </xsl:call-template></xsl:with-param></xsl:call-template> >+ >+ <xsl:variable name="relation_query"> >+ <xsl:text>ti,phr:(</xsl:text> >+ <xsl:call-template name="quote_search_term"> >+ <xsl:with-param name="term"><xsl:value-of select="marc:subfield[@code='t']"/></xsl:with-param> >+ </xsl:call-template> >+ <xsl:text>)</xsl:text> >+ <xsl:if test="marc:subfield[@code='a']"> >+ <xsl:text> AND au:(</xsl:text> >+ <xsl:call-template name="quote_search_term"> >+ <xsl:with-param name="term"> >+ <xsl:value-of select="marc:subfield[@code='a']"/> >+ </xsl:with-param> >+ </xsl:call-template> >+ <xsl:text>)</xsl:text> >+ </xsl:if> > </xsl:variable> >+ > <xsl:if test="marc:subfield[@code='i']"> > <xsl:call-template name="subfieldSelect"> > <xsl:with-param name="codes">i</xsl:with-param> > </xsl:call-template> >- <xsl:text>: </xsl:text> >+ <xsl:text> </xsl:text> > </xsl:if> > <a> > <xsl:choose> >- <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']"> >- <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute> >- </xsl:when> >- <xsl:otherwise> >- <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f775, '()', ''), true())"/></xsl:attribute> >- </xsl:otherwise> >+ <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']"> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="str:encode-uri($relation_query, true())" /></xsl:attribute> >+ </xsl:otherwise> > </xsl:choose> > <xsl:call-template name="subfieldSelect"> > <xsl:with-param name="codes">a_t</xsl:with-param> >@@ -1604,21 +1616,38 @@ > </span> > </xsl:if> > >- <xsl:variable name="f780"> >- <xsl:call-template name="subfieldSelect"> >- <xsl:with-param name="codes">a_t</xsl:with-param> >+ <xsl:variable name="relation_query"> >+ <xsl:text>ti,phr:(</xsl:text> >+ <xsl:call-template name="quote_search_term"> >+ <xsl:with-param name="term"><xsl:value-of select="marc:subfield[@code='t']"/></xsl:with-param> > </xsl:call-template> >+ <xsl:text>)</xsl:text> >+ <xsl:if test="marc:subfield[@code='a']"> >+ <xsl:text> AND au:(</xsl:text> >+ <xsl:call-template name="quote_search_term"> >+ <xsl:with-param name="term"> >+ <xsl:value-of select="marc:subfield[@code='a']"/> >+ </xsl:with-param> >+ </xsl:call-template> >+ <xsl:text>)</xsl:text> >+ </xsl:if> > </xsl:variable> > > <xsl:choose> > <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']"> >- <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute> >- <xsl:value-of select="$f780"/> >+ <a> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes">a_t</xsl:with-param> >+ </xsl:call-template> > </a> > </xsl:when> > <xsl:otherwise> >- <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f780, '()', ''), true())"/></xsl:attribute> >- <xsl:value-of select="$f780"/> >+ <a> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="str:encode-uri($relation_query, true())" /></xsl:attribute> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes">a_t</xsl:with-param> >+ </xsl:call-template> > </a> > </xsl:otherwise> > </xsl:choose> >@@ -1675,21 +1704,37 @@ > </span> > </xsl:if> > >- <xsl:variable name="f785"> >- <xsl:call-template name="subfieldSelect"> >- <xsl:with-param name="codes">a_t</xsl:with-param> >+ <xsl:variable name="relation_query"> >+ <xsl:text>ti,phr:(</xsl:text> >+ <xsl:call-template name="quote_search_term"> >+ <xsl:with-param name="term"><xsl:value-of select="marc:subfield[@code='t']"/></xsl:with-param> > </xsl:call-template> >+ <xsl:text>)</xsl:text> >+ <xsl:if test="marc:subfield[@code='a']"> >+ <xsl:text> AND au:(</xsl:text> >+ <xsl:call-template name="quote_search_term"> >+ <xsl:with-param name="term"> >+ <xsl:value-of select="marc:subfield[@code='a']"/> >+ </xsl:with-param> >+ </xsl:call-template> >+ <xsl:text>)</xsl:text> >+ </xsl:if> > </xsl:variable> > > <xsl:choose> > <xsl:when test="$UseControlNumber = '1' and marc:subfield[@code='w']"> > <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=Control-number:<xsl:call-template name="extractControlNumber"><xsl:with-param name="subfieldW" select="marc:subfield[@code='w']"/></xsl:call-template></xsl:attribute> >- <xsl:value-of select="$f785"/> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes">a_t</xsl:with-param> >+ </xsl:call-template> > </a> > </xsl:when> > <xsl:otherwise> >- <a><xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate($f785, '()', ''), true())"/></xsl:attribute> >- <xsl:value-of select="$f785"/> >+ <a> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=<xsl:value-of select="str:encode-uri($relation_query, true())" /></xsl:attribute> >+ <xsl:call-template name="subfieldSelect"> >+ <xsl:with-param name="codes">a_t</xsl:with-param> >+ </xsl:call-template> > </a> > </xsl:otherwise> > </xsl:choose> >-- >2.44.0
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 32695
:
151770
|
151860
|
151884
|
152239
|
152240
|
161167
|
161168
|
165147
|
165148
|
165234
| 165365