From 45f091cbce46a889a39cb2d6d1b5ac3c953add9e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 19 Mar 2026 11:05:08 +0100 Subject: [PATCH] Bug 42133: Restore plugins when editing items in batch It has been broken then fixed then broken again, several times... This patch fixes 2 problems: 1. The CSRF fix (I think it's coming from there) didn't adjust the 'if show' test and the JS code from plugins was not injected into the template 2. The selector to call the plugin didn't include this view, only the add/edit items Test plan: Confirm that you can now use cataloging plugins when editing items in batch Signed-off-by: Emmi Takkinen Signed-off-by: Marcel de Rooy Signed-off-by: Pedro Amorim --- .../intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt | 2 +- koha-tmpl/intranet-tmpl/prog/js/cataloging.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt index 3b44b61cfa..f6b0fca145 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt @@ -349,7 +349,7 @@ }); }); - [% IF ( show ) %] + [% IF op == 'cud-action' %] [%- # Loop over fields which may have plugin JavaScript -%] [%- UNLESS (too_many_items_process) -%] [%- FOREACH subfield IN subfields -%] diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js index a730e10861..39bcf6f150 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cataloging.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging.js @@ -843,12 +843,12 @@ $(document).ready(function () { // We use delegated event handlers here so that dynamically added elements // (like when cloning a field or a subfield) respond to these events // without having to re-attach events manually - $(".marc_editor").on( + $(".marc_editor, .item_edit_form").on( "click", ".tag_editor.framework_plugin", callClickPluginEventHandler ); - $(".marc_editor").on( + $(".marc_editor, .item_edit_form").on( "focusin focusout change mousedown mouseup keydown keyup", "input.input_marceditor.framework_plugin", callPluginEventHandler