From 41fbf9607956ce6a77032bc5ae327f36b4f2f86e Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Fri, 21 Mar 2025 06:09:10 -0700 Subject: [PATCH] Bug 39400: "Jump to add item form" doesn't work while editing an existing item The link at the top of the item editor page to "Jump to add item form" tries to scrollIntoView the element with id="additema", but that element only exists while you are adding a new item. While you are editing an existing item, it is replaced by an element with id="edititem". Whichever element you have at the moment is always just below the form with id="f", so we can just scroll that into view instead. Test plan: 1. Without the patch, go to the details page for any bib record with at least one item, and click the Edit button on the row for an item in the holdings table. 2. You should be scrolled down to the form for editing that item 3. Scroll up to the top of the page, click the Jump to add item form link 4. You will not be scrolled back down to the form 5. Apply patch, shift+reload page 6. Now the link should scroll you back down to the form 7. Return to the biblio details page, click Edit - Manage items and verify that the Jump to add item form link still works when you are not editing an existing item 8. Click the Add multiple copies of this item button and add 30 items 9. Make sure that the link still scrolls the form into view both while you are editing an existing item, and while you are adding a new item Sponsored-by: Chetco Community Public Library --- koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt | 2 +- koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 90fe28057e..e622ab2300 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -87,7 +87,7 @@ [% END %]

Items for [% biblio.title | html %] [% IF ( biblio.author ) %]by [% biblio.author | html %][% END %] (Record #[% biblio.biblionumber | html %])

- Jump to add item form + Jump to add item form [% IF ( barcode_not_unique ) %]
Error saving item: Barcode must be unique.
[% END %] [% IF ( no_next_barcode ) %]
Error saving items: Unable to automatically determine values for barcodes. No item has been inserted.
[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js b/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js index cfe10df1d8..065d400e34 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js +++ b/koha-tmpl/intranet-tmpl/prog/js/cataloging_additem.js @@ -168,7 +168,7 @@ $(document).ready(function () { $("#newitem_jump").on("click", function (e) { e.preventDefault(); - document.getElementById("additema").scrollIntoView(); + document.getElementById("f").scrollIntoView(); }); }); -- 2.48.1