From 2d66798b4aa2781304d612a1a6367c9b399f6a4d 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 --- .../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 b6e06f7bc9..c2fefee4ee 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.25.1