From e906c2b85da3fa57569c241a25475f82bb7c0e7d Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Wed, 1 Jun 2022 15:06:52 +0000 Subject: [PATCH] Bug 30878: Avoid resetting waiting reserves tab When canceling holds waiting over X days in "Holds awaiting pickup" view, form submission resets the selected tab to "Holds waiting". This tab reset may cause confusion for the user and lead to unwanted actions. Instead, the user should be returned to the same tab that they began with. To test: 1. Apply patch 2. Navigate to /cgi-bin/koha/circ/waitingreserves.pl 3. Select "Holds waiting over X days" tab 4. Refresh page 5. Observe "Holds waiting over X days" is still selected 6. Have some holds waiting over X days 7. Select one of them and press "Cancel selected (1)" and confirm 8. Observe "Holds waiting over X days" is still selected after form submission Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall --- .../prog/en/modules/circ/waitingreserves.tt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt index bccefdb7f1f..2f3c956a9bb 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/waitingreserves.tt @@ -261,6 +261,15 @@ }); }); + var activeTab = localStorage.getItem("waitingreserves_activetab"); + if( activeTab ){ + $("div#resultlist li:eq(" + activeTab + ") a").tab("show"); + } + $("div#resultlist a[data-toggle='tab']").on("shown.bs.tab", function (e) { + var thisTab = $(e.target).parent(); + var activeTab = thisTab.index(); + localStorage.setItem("waitingreserves_activetab", activeTab ); + }); }); -- 2.30.2