Bugzilla – Attachment 193287 Details for
Bug 6892
If a URL has been entered without http://, it isn't correctly linked
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6892: (follow-up) Fix urls in OPAC when TrackClicks is enabled
1d49dbd.patch (text/plain), 4.90 KB, created by
David Nind
on 2026-02-17 03:41:10 UTC
(
hide
)
Description:
Bug 6892: (follow-up) Fix urls in OPAC when TrackClicks is enabled
Filename:
MIME Type:
Creator:
David Nind
Created:
2026-02-17 03:41:10 UTC
Size:
4.90 KB
patch
obsolete
>From 1d49dbdf962c1f083e597a64cbadb5c4beb95bdc Mon Sep 17 00:00:00 2001 >From: Jan Kissig <bibliothek@th-wildau.de> >Date: Mon, 16 Feb 2026 09:27:07 +0000 >Subject: [PATCH] Bug 6892: (follow-up) Fix urls in OPAC when TrackClicks is > enabled > >This patch fixes outgoing links from 856$u when system preference 'TrackClicks' is set and the URL is lacking the protocol prefix. > >Test plan: > >a) set system pref TrackClicks to 'Track' or 'Track anonymously' >b) edit a record (f.e. 262) and set the following 856 fields (the record from 1st patch is sufficient though): > 1. 856 ind1=4 $u = example.com > 2. 856 $u = example.com > 3. 856 $u = https://example.com >b) save and search for that record in OPAC. >c) on search results list (opac-search.pl) please check the links on that record: > 1. links to http://main.localhost/cgi-bin/koha/tracklinks.pl?uri=example.com&biblionumber=262 and does not work > 2. links to http://main.localhost/cgi-bin/koha/tracklinks.pl?uri=example.com&biblionumber=262 and does not work > 3. links to http://main.localhost/cgi-bin/koha/tracklinks.pl?uri=https://example.com&biblionumber=262 and works >d) click on the record to get to the detail page (opac-detail.pl) and check the links again (Online resources). They should be the same as in step c) > >e) apply patch, call restart_all and redo step b) until d) verifying that > 1. is now prefixed with http:// and links to http://main.localhost/cgi-bin/koha/tracklinks.pl?uri=http://example.com&biblionumber=262 (works now) > 2. is now prefixed with http:// and links to http://main.localhost/cgi-bin/koha/tracklinks.pl?uri=http://example.com&biblionumber=262 (works now) > 3. still links to http://main.localhost/cgi-bin/koha/tracklinks.pl?uri=https://example.com&biblionumber=262 > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../bootstrap/en/xslt/MARC21slimUtils.xsl | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >index 4f49f8661b..a93b5da5d8 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slimUtils.xsl >@@ -705,23 +705,26 @@ > > <xsl:for-each select="marc:datafield[@tag=$MARCOnlineResourceField and marc:subfield[@code='u']]"> > <xsl:variable name="SubqText"><xsl:value-of select="marc:subfield[@code='q']" /></xsl:variable> >+ <xsl:variable name="URL"> >+ <xsl:call-template name="AddMissingProtocol"> >+ <xsl:with-param name="resourceLocation" select="marc:subfield[@code='u']" /> >+ <xsl:with-param name="indicator1" select="@ind1" /> >+ <xsl:with-param name="accessMethod" select="marc:subfield[@code='2']" /> >+ </xsl:call-template> >+ <xsl:value-of select="normalize-space(marc:subfield[@code='u'])"/> >+ </xsl:variable> > <li> > <a property="url"> > <xsl:choose> > <xsl:when test="$OPACTrackClicks='track'"> >- <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())"/>&biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri($URL, true())"/>&biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute> > </xsl:when> > <xsl:when test="$OPACTrackClicks='anonymous'"> >- <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri(marc:subfield[@code='u'], true())" />&biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute> >+ <xsl:attribute name="href">/cgi-bin/koha/tracklinks.pl?uri=<xsl:value-of select="str:encode-uri($URL, true())" />&biblionumber=<xsl:value-of select="$biblionumber"/></xsl:attribute> > </xsl:when> > <xsl:otherwise> > <xsl:attribute name="href"> >- <xsl:call-template name="AddMissingProtocol"> >- <xsl:with-param name="resourceLocation" select="marc:subfield[@code='u']" /> >- <xsl:with-param name="indicator1" select="@ind1" /> >- <xsl:with-param name="accessMethod" select="marc:subfield[@code='2']" /> >- </xsl:call-template> >- <xsl:value-of select="normalize-space(marc:subfield[@code='u'])"/> >+ <xsl:value-of select="$URL"/> > </xsl:attribute> > </xsl:otherwise> > </xsl:choose> >-- >2.39.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 6892
:
192923
|
193146
|
193169
|
193170
|
193286
| 193287