From 8b0fcb8a4529e9bbd0f308b85436c38f376ba966 Mon Sep 17 00:00:00 2001 From: David Cook Date: Fri, 18 Aug 2023 03:02:30 +0000 Subject: [PATCH] Bug 34570: Remove use of "onclick" for PopupMARCFieldDoc() This change removes the "onclick" attribute for the MARC doc link in the cataloguing editor. Test plan: 0. Apply patch 1. Go to http://localhost:8081/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=# 2. Click on the question mark (?) next to any of the MARC fields 3. Press the "Repeat this tag" button 4. Click on the question mark (?) on the cloned MARC field 5. Note that both times it worked Signed-off-by: Owen Leonard --- .../prog/en/modules/cataloguing/addbiblio.tt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt index 1c1e7db0a3e..7e88dd9d7c7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -435,7 +435,8 @@ function AutomaticLinker() { } -function PopupMARCFieldDoc(field) { +function PopupMARCFieldDoc() { + let field = this.dataset.tag; [% IF Koha.Preference('marcfielddocurl') %] var docurl = "[% Koha.Preference('marcfielddocurl').replace('"','"') | html %]"; docurl = docurl.replace("{MARC}", "[% marcflavour | html %]"); @@ -447,7 +448,13 @@ function PopupMARCFieldDoc(field) { [% ELSIF ( marcflavour == 'UNIMARC' ) %] _UNIMARCFieldDoc(field); [% END %] + return false; } +[%# Attach to body, so that cloned nodes will still have the event listener %] +$(document).ready(function(){ + $('body').on('click','.marcdocs',PopupMARCFieldDoc); +}); + function confirmnotdup(redirect){ $("#confirm_not_duplicate").attr("value","1"); $("#redirect").attr("value",redirect); @@ -1040,7 +1047,7 @@ function PopupMARCFieldDoc(field) { [% innerloo.tag | html %] [% ELSE %] [% innerloo.tag | html %] -  ? +  ? [% END %] [% IF ( innerloo.fixedfield ) %] -- 2.30.2