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 <oleonard@myacpl.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 0b992dd12e)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
David Cook 2023-08-18 03:02:30 +00:00 committed by Fridolin Somers
parent e24304ccd5
commit 19c940c287
1 changed files with 9 additions and 2 deletions

View File

@ -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('"','&quot;') | 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) {
<a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib | html %] - Click to expand this tag" onclick="ExpandField('tag_[% innerloo.tag | html %]_[% innerloo.index | html %][% innerloo.random | html %]'); return false;">[% innerloo.tag | html %]</a>
[% ELSE %]
<span class="tagnum" title="[% innerloo.tag_lib | html %]">[% innerloo.tag | html %]</span>
<a href="#" class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag | html %]'); return false;">&nbsp;?</a>
<a href="#" class="marcdocs" data-tag="[% innerloo.tag | html %]">&nbsp;?</a>
[% END %]
[% IF ( innerloo.fixedfield ) %]