Bug 42441: Remove event attributes from authority merge template

This patch moves a couple of "onclick" event attributes from the
authority merge template, moving the event handling to the JS block.

This patch also fixes the behavior that I assume the click handlers are
meant to have, changing the framework selection. A mismatch of IDs in
the code meant that clicking the radio buttons didn't do anything.

To test, apply the patch and go to Authorities.

- Perform a search for authority records which will return multiple
  results, including records with different heading types (e.g. Personal
  Name, Topical Term, etc.)
- In the "Actions" menu for one of the search results, click "Merge"
- Do the same with another result which has a different heading type.
- On the "Merging records" page you should see a frameowrk dropdown.
- When you click the radio buttons next to your two records to merge the
  framework selection should change to match your selection.

Sponsored-by: Athens County Public Libraries
Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org>

Amended-by: Jonathan Druart
Tidy

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 71559d0909)
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
This commit is contained in:
Owen Leonard 2026-04-22 10:06:47 -04:00 committed by Wainui Witika-Park
parent 9c685ef0eb
commit e8fffb0535
No known key found for this signature in database
GPG Key ID: 2D0A6AB5DAF1B78D
1 changed files with 7 additions and 3 deletions

View File

@ -72,7 +72,7 @@
<legend>Merge reference</legend>
<ol>
<li class="radio"
><input type="radio" value="[% recordid1 | uri %]" checked="checked" id="mergereference1" name="mergereference" onclick="changeFramework('[% frameworkcode1 | html %]')" /><label for="mergereference1"
><input type="radio" value="[% recordid1 | uri %]" checked="checked" id="mergereference1" name="mergereference" class="change_framework" data-framework="[% frameworkcode1 | html %]" /><label for="mergereference1"
>[% title1 | html %] [% FOREACH subtitl1 IN subtitle1 %][% subtitl1 | html %][% END %] (<a
href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 | uri %]"
title="MARC"
@ -83,7 +83,7 @@
></li
>
<li class="radio"
><input type="radio" value="[% recordid2 | uri %]" id="mergereference2" name="mergereference" onclick="changeFramework('[% frameworkcode2 | html %]')" /><label for="mergereference2"
><input type="radio" value="[% recordid2 | uri %]" id="mergereference2" name="mergereference" class="change_framework" data-framework="[% frameworkcode2 | html %]" /><label for="mergereference2"
>[% title2 | html %] [% FOREACH subtitl2 IN subtitle2 %][% subtitl2 | html %][% END %] (<a
href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid2 | uri %]"
title="MARC"
@ -166,11 +166,15 @@
if( $("#tabs .tab-pane.active").length < 1 ){
$("#tabs a:first").tab("show");
}
$(".change_framework").on("click", function () {
let framework = $(this).data("framework");
changeFramework(framework);
});
});
function changeFramework(fw) {
$("#Frameworks").val(fw);
$("#frameworkcode").val(fw);
}
</script>
[% END %]