Bugzilla – Attachment 137174 Details for
Bug 29418
Error searching for analytics in detail view
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29418: (follow-up) Fix links generated in XSLTs
Bug-29418-follow-up-Fix-links-generated-in-XSLTs.patch (text/plain), 9.08 KB, created by
Martin Renvoize (ashimema)
on 2022-07-05 13:51:03 UTC
(
hide
)
Description:
Bug 29418: (follow-up) Fix links generated in XSLTs
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-07-05 13:51:03 UTC
Size:
9.08 KB
patch
obsolete
>From 26c41a8463cd0614627fd9f19fe49c961f391510 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 4 Jul 2022 21:09:05 -0300 >Subject: [PATCH] Bug 29418: (follow-up) Fix links generated in XSLTs > >This patch addresses the case of links that are generated on the XSLT >side, those linking to host records using 773$t and 773$a. > >To test: >1. Repeat the test plan from the other patches >2. When sitting on the detail view of the host record, click on the link > to open the child. >=> SUCCESS: The link works, because of the previous patches >3. Click on the 'In:' link so the search takes you to the host record >=> FAIL: The link leads no results >4. Apply this patch >5. Restart all >6. Reload the child record page and click on the link >=> SUCCESS: Voila! The host record is retrieved! >7. Bonus points: Retry the full test plan, but add a " or ? to the > author in both host and child records >=> SUCCESS: Things don't work before this patch, and work afterwards. >8. Sign off :-D > >Sponsored-by: Theke Solutions >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../en/xslt/MARC21slim2intranetDetail.xsl | 17 ++++++++++- > .../prog/en/xslt/MARC21slimUtils.xsl | 30 +++++++++++++++++++ > .../en/xslt/MARC21slim2OPACDetail.xsl | 17 ++++++++++- > .../bootstrap/en/xslt/MARC21slimUtils.xsl | 30 +++++++++++++++++++ > 4 files changed, 92 insertions(+), 2 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >index e0dcfe4fbb..1fda2eaaa2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl >@@ -1087,8 +1087,23 @@ > </a> > </xsl:when> > <xsl:otherwise> >+ <xsl:variable name="title_query"> >+ <xsl:call-template name="fix_query_term"> >+ <xsl:with-param name="term"><xsl:value-of select="marc:subfield[@code='t']"/></xsl:with-param> >+ </xsl:call-template> >+ </xsl:variable> >+ <xsl:variable name="author_query"> >+ <xsl:if test="marc:subfield[@code='a']"> >+ <xsl:call-template name="fix_query_term"> >+ <xsl:with-param name="term"> >+ <xsl:value-of select="marc:subfield[@code='a']"/> >+ </xsl:with-param> >+ </xsl:call-template> >+ </xsl:if> >+ </xsl:variable> > <a> >- <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='t'], '()', ''), true())"/><xsl:if test="marc:subfield[@code='a']">+AND+au:<xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='a'], '()', ''), true())"/></xsl:if></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/catalogue/search.pl?q=ti,phr:("<xsl:value-of select="$title_query" />")<xsl:if test="$author_query">+AND+au:("<xsl:value-of select="$author_query"/>")</xsl:if> >+ </xsl:attribute> > <xsl:value-of select="$f773"/> > </a> > </xsl:otherwise> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl >index dfc9cc0186..814bcc93fc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl >+++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slimUtils.xsl >@@ -578,6 +578,36 @@ > </xsl:if> > </xsl:template> > >+ <xsl:template name="fix_query_term"> >+ <xsl:param name="term" /> >+ <xsl:variable name="fixed_term"> >+ <xsl:call-template name="remove_quotes"> >+ <xsl:with-param name="text"> >+ <xsl:value-of select="$term"/> >+ </xsl:with-param> >+ </xsl:call-template> >+ </xsl:variable> >+ <xsl:value-of select="str:encode-uri(translate($fixed_term, '()', ''), true())"/> >+ </xsl:template> >+ >+ <xsl:template name="remove_quotes"> >+ <xsl:param name="text"/> >+ <xsl:choose> >+ <xsl:when test="contains($text, '"')"> >+ <xsl:variable name="before" select="substring-before($text,'"')"/> >+ <xsl:variable name="next" select="substring-after($text,'"')"/> >+ <xsl:value-of select="$before"/> >+ <xsl:text></xsl:text> >+ <xsl:call-template name="remove_quotes"> >+ <xsl:with-param name="text" select="$next"/> >+ </xsl:call-template> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:value-of select="$text"/> >+ </xsl:otherwise> >+ </xsl:choose> >+ </xsl:template> >+ > </xsl:stylesheet> > > <!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp. >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >index 172a5a0698..1ec7eb42b6 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACDetail.xsl >@@ -1175,8 +1175,23 @@ > </a> > </xsl:when> > <xsl:otherwise> >+ <xsl:variable name="title_query"> >+ <xsl:call-template name="fix_query_term"> >+ <xsl:with-param name="term"><xsl:value-of select="marc:subfield[@code='t']"/></xsl:with-param> >+ </xsl:call-template> >+ </xsl:variable> >+ <xsl:variable name="author_query"> >+ <xsl:if test="marc:subfield[@code='a']"> >+ <xsl:call-template name="fix_query_term"> >+ <xsl:with-param name="term"> >+ <xsl:value-of select="marc:subfield[@code='a']"/> >+ </xsl:with-param> >+ </xsl:call-template> >+ </xsl:if> >+ </xsl:variable> > <a> >- <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:<xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='t'], '()', ''), true())"/><xsl:if test="marc:subfield[@code='a']">+AND+au:<xsl:value-of select="str:encode-uri(translate(marc:subfield[@code='a'], '()', ''), true())"/></xsl:if></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/opac-search.pl?q=ti,phr:("<xsl:value-of select="$title_query" />")<xsl:if test="$author_query">+AND+au:("<xsl:value-of select="$author_query"/>")</xsl:if> >+ </xsl:attribute> > <xsl:value-of select="$f773"/> > </a> > </xsl:otherwise> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >index 105da508c7..eb2b6b2bc4 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >@@ -542,6 +542,36 @@ > </xsl:if> > </xsl:template> > >+ <xsl:template name="fix_query_term"> >+ <xsl:param name="term" /> >+ <xsl:variable name="fixed_term"> >+ <xsl:call-template name="remove_quotes"> >+ <xsl:with-param name="text"> >+ <xsl:value-of select="$term"/> >+ </xsl:with-param> >+ </xsl:call-template> >+ </xsl:variable> >+ <xsl:value-of select="str:encode-uri(translate($fixed_term, '()', ''), true())"/> >+ </xsl:template> >+ >+ <xsl:template name="remove_quotes"> >+ <xsl:param name="text"/> >+ <xsl:choose> >+ <xsl:when test="contains($text, '"')"> >+ <xsl:variable name="before" select="substring-before($text,'"')"/> >+ <xsl:variable name="next" select="substring-after($text,'"')"/> >+ <xsl:value-of select="$before"/> >+ <xsl:text></xsl:text> >+ <xsl:call-template name="remove_quotes"> >+ <xsl:with-param name="text" select="$next"/> >+ </xsl:call-template> >+ </xsl:when> >+ <xsl:otherwise> >+ <xsl:value-of select="$text"/> >+ </xsl:otherwise> >+ </xsl:choose> >+ </xsl:template> >+ > </xsl:stylesheet> > > <!-- Stylus Studio meta-information - (c)1998-2002 eXcelon Corp. >-- >2.20.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 29418
:
127325
|
127326
|
134865
|
134866
|
137023
|
137048
|
137135
|
137136
|
137137
|
137138
|
137139
|
137140
|
137142
|
137171
|
137172
|
137173
| 137174