From bc9dfbb1f241f554d2b3cd87b6cc6b7bff4bc977 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Fri, 4 Apr 2025 14:48:43 -0700 Subject: [PATCH] Bug 31323: Don't highlight an item when it isn't being edited The thing that tells us whether we are editing an item or adding a new item in additem.tt is whether or not the op is cud-saveitem: if it isn't, the heading on the form is 'Add item', if it is it's 'Edit item', and the same for which set of buttons are at the bottom of the form. We should check that before deciding to highlight an item as being edited, rather than just counting on the script to not pass an itemnumber param unless that itemnumber is being edited. Test plan: 1. Without the patch, find any biblio with one or more items attached 2. Click the Edit button for an item in the holdings table 3. Scroll up, and verify that the item you are editing has a yellow background in the list of items 4. Click Save changes (no need to make any changes) 5. When the page reloads, you'll have an Add item form at the bottom, but the item that you just edited, and are no longer editing, will have a yellow background 6. Apply patch, return to the bib details page 7. Repeat steps 2-4, but this time verify that the item you just edited is now not highlighted while you have an Add item form. Sponsored-by: Chetco Community Public Library --- koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt | 2 +- 1 file changed, 1 insertion(+), 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 90fe28057e..4861b2d500 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/additem.tt @@ -117,7 +117,7 @@ [% FOREACH item IN items %] [% SET can_be_edited = ! ( Koha.Preference('IndependentBranches') && ! logged_in_user.is_superlibrarian && item.homebranch != Branches.GetLoggedInBranchname() ) %] [% SET tr_class = '' %] - [% IF item.itemnumber == itemnumber %] + [% IF item.itemnumber == itemnumber AND op == 'cud-saveitem' %] [% UNLESS can_be_edited %] [% SET tr_class='active' %] [% ELSE %] -- 2.48.1