From 3c84023b845b11868fa875f75529a2ce8435ead7 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 Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 0b992dd12ed657a9af516bac6a507bab395e9add) Signed-off-by: Fridolin Somers (cherry picked from commit 19c940c2870820ee0da524f6a295b9d062cd2828) Signed-off-by: Matt Blenkinsop --- .../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 ebdc0fdfaa..0a9042d917 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); @@ -1039,7 +1046,7 @@ function PopupMARCFieldDoc(field) { [% innerloo.tag | html %] [% ELSE %] [% innerloo.tag | html %] -  ? +  ? [% END %] [% IF ( innerloo.fixedfield ) %] -- 2.39.2