Bugzilla – Attachment 193286 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: Fix links on MARCdetail.tt when protocol is missing
b4eb9a3.patch (text/plain), 3.96 KB, created by
David Nind
on 2026-02-17 03:41:07 UTC
(
hide
)
Description:
Bug 6892: Fix links on MARCdetail.tt when protocol is missing
Filename:
MIME Type:
Creator:
David Nind
Created:
2026-02-17 03:41:07 UTC
Size:
3.96 KB
patch
obsolete
>From b4eb9a364eab589755754e730106b05376d8db60 Mon Sep 17 00:00:00 2001 >From: Jan Kissig <bibliothek@th-wildau.de> >Date: Tue, 10 Feb 2026 18:58:57 +0000 >Subject: [PATCH] Bug 6892: Fix links on MARCdetail.tt when protocol is missing > >This patch will check for URLs in MARC21 data and in case of a missing protocol prefix >- either append a missing http prefix if tag=856 and indicator 1=4 is set, >- or omit the html anchor element >On other $u subfields (e.g. 505$u) the html anchor element is omitted when protocol is missing, regardless > >Test plan: > >a) edit a record set the following 856 fields: > 1. 856 ind1=4 $u = bugs.koha-community.org > 2. 856 $u = bugs.koha-community.org > 3. 856 $u = https://bugs.koha-community.org > 4. 505 $u = bugs.koha-community.org > 5. 505 $u = https://bugs.koha-community.org >b) save and go to records MARC view (MARCdetail.pl) and take a look at the links in tab 5 and 8 > 1. links to http://main-intra.localhost/cgi-bin/koha/catalogue/bugs.koha-community.org/ > 2. links to http://main-intra.localhost/cgi-bin/koha/catalogue/bugs.koha-community.org/ > 3. links to https://bugs.koha-community.org/ > 4. links to http://main-intra.localhost/cgi-bin/koha/catalogue/bugs.koha-community.org > 5. links to https://bugs.koha-community.org/ >c) apply patch and reload MARCdetail.pl (maybe a restart_all is required) >d) verify that > 1. links to http://bugs.koha-community.org/ (because of indicator1=4) > 2. bugs.koha-community.org/ is displayed but not inside an html anchor element > 3. links https://bugs.koha-community.org/ > 4. bugs.koha-community.org/ is displayed but not inside an html anchor element > 5. links to https://bugs.koha-community.org/ > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../prog/en/modules/catalogue/MARCdetail.tt | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt >index 66a5774709..4d8a3a42ed 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/MARCdetail.tt >@@ -92,7 +92,19 @@ > > [% UNLESS ( subfiel.hide_marc ) %]<span class="subfield-code">[% subfiel.marc_subfield | html %]</span>[% END %] > <span class="desc" title="[% subfiel.long_desc | html %]">[% subfiel.short_desc | html %]</span></span > > >- [% IF ( subfiel.is_url ) %]<a href="[% subfiel.marc_value | url %]">[% subfiel.marc_value | html %]</a>[% ELSE %][% subfiel.marc_value | html %][% END %] >+ [% IF ( subfiel.is_url ) %] >+ [% IF ( subfiel.marc_value.trim().substr(0, 4).lower() == "http" ) %] >+ <a href="[% subfiel.marc_value | trim | url %]">[% subfiel.marc_value | html %]</a> >+ [% ELSE %] >+ [% IF ( tab0X.tag == '856' && tab0X.tag_ind && tab0X.tag_ind.substr(0, 1) == '4') %] >+ <a href="http://[% subfiel.marc_value | trim | url %]">[% subfiel.marc_value | html %]</a> >+ [% ELSE %] >+ [% subfiel.marc_value | html %] >+ [% END %] >+ [% END %] >+ [% ELSE %] >+ [% subfiel.marc_value | html %] >+ [% END %] > [% IF ( subfiel.link ) %] > <a class="authlink" href="/cgi-bin/koha/catalogue/search.pl?op=do_search&idx=[% subfiel.link | uri %],phr&type=intranet&q=[% subfiel.marc_value |uri %]"> > <i class="fa fa-link" aria-label="Search on [% subfiel.marc_value | html %]" title="Search on [% subfiel.marc_value | html %]"></i> >-- >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