From 4e65e7ca4ae2082a67efcedcbfecf584b88d01f5 Mon Sep 17 00:00:00 2001 From: Petro Vashchuk Date: Mon, 27 Oct 2025 16:46:54 +0200 Subject: [PATCH] Bug 41108: Scroll to form on use of "Add and duplicate" button This patch gets you to the Add item form directly after you press "Add and duplicate" button to duplicate the item. Steps to reproduce: 1. Find a biblio with many items or make one yourself. 2. Use the "New" dropdown and go to the add item interface. 3. Use "Add and duplicate" button to duplicate the item. 4. Apply the patch. 5. Reload the page and use "Add and duplicate" button to duplicate the item again. It should take you to the Add item form directly. --- .../intranet-tmpl/prog/en/modules/cataloguing/additem.tt | 2 +- koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt index 76758d3deb6..14eff94bd11 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -342,7 +342,7 @@ --> - + diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js index 1de2bda6e12..f23f1edff35 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js @@ -55,6 +55,11 @@ $(document).ready(function () { } }); + $("#add_duplicate_submit").click(function () { + // force to scroll to form if we're in duplicate action + $("#f").attr('action', $("#f").attr('action').replace(/(#\w+)?$/g, '#additema')); + }); + // Skip the first column table_settings["columns"].unshift({ cannot_be_toggled: "1" }); -- 2.51.1