Bug 42442: Remove event attributes from bibliographic record merge template

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

This patch also makes a minor change to make sure that the
framework code dropdown preselects the framework of the first of
the records to merge. This brings it in line with the authority
merge template.

To test, apply the patch and perform a catalog search which will return
multiple results including results with different frameworks. In the
standard test data a search for "green" will return two results with two
different frameworks.

- Check the checkbox for at least two records in your search results.
- Click "Edit -> Merge records" in the toolbar at the top of the
  results.
- On the "Merging records" page you should see a frameowrk dropdown. It
  should have preselected the framework corresponding to the first of
  the records you selected.
- When you click the radio buttons next to your 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>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 01a1696058)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
Signed-off-by: Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz>
This commit is contained in:
Owen Leonard 2026-04-22 11:20:25 -04:00 committed by Wainui Witika-Park
parent dc7c885f70
commit 86b2e1f181
No known key found for this signature in database
GPG Key ID: 2D0A6AB5DAF1B78D
1 changed files with 16 additions and 3 deletions

View File

@ -132,10 +132,19 @@
checked="checked"
id="ref_biblionumber[% record.biblionumber | html %]"
name="ref_biblionumber"
onclick="changeFramework('[% record.frameworkcode | html %]')"
class="change_framework"
data-framework="[% record.frameworkcode | html %]"
/>
[% SET selected_frameworkcode = record.frameworkcode %]
[% ELSE %]
<input type="radio" value="[% record.biblionumber | html %]" id="ref_biblionumber[% record.biblionumber | html %]" name="ref_biblionumber" onclick="changeFramework('[% record.frameworkcode | html %]')" />
<input
type="radio"
value="[% record.biblionumber | html %]"
id="ref_biblionumber[% record.biblionumber | html %]"
name="ref_biblionumber"
class="change_framework"
data-framework="[% record.frameworkcode | html %]"
/>
[% END %]
<label for="ref_biblionumber[% record.biblionumber | html %]">
[% INCLUDE 'biblio-title.inc' biblio=record.data link = 1 %] ([% record.biblionumber | uri %])
@ -149,7 +158,7 @@
<select name="frameworkcode" id="frameworkcode">
<option value="">Default</option>
[% FOREACH framework IN frameworks %]
<option value="[% framework.frameworkcode | html %]">[% framework.frameworktext | html %]</option>
<option value="[% framework.frameworkcode | html %]" [% IF framework.frameworkcode == selected_frameworkcode %]selected="selected"[% END %]>[% framework.frameworktext | html %]</option>
[% END %]
</select>
</li>
@ -235,6 +244,10 @@
$("#dataPreviewLabel").html("");
$("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
});
$(".change_framework").on("click", function(){
let framework = $(this).data("framework");
changeFramework( framework );
});
});
[% ELSE %]
function check_mandatory () {