From 44e2b3d2e22e871b6bd4e81050153ce4afbba077 Mon Sep 17 00:00:00 2001 From: Jan Kissig 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 --- .../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 ) %][% subfiel.marc_subfield | html %][% END %] [% subfiel.short_desc | html %] - [% IF ( subfiel.is_url ) %][% subfiel.marc_value | html %][% ELSE %][% subfiel.marc_value | html %][% END %] + [% IF ( subfiel.is_url ) %] + [% IF ( subfiel.marc_value.trim().substr(0, 4).lower() == "http" ) %] + [% subfiel.marc_value | html %] + [% ELSE %] + [% IF ( tab0X.tag == '856' && tab0X.tag_ind && tab0X.tag_ind.substr(0, 1) == '4') %] + [% subfiel.marc_value | html %] + [% ELSE %] + [% subfiel.marc_value | html %] + [% END %] + [% END %] + [% ELSE %] + [% subfiel.marc_value | html %] + [% END %] [% IF ( subfiel.link ) %] -- 2.39.5