From db21e56eb1c65d0c3c6cd1061acfcc313148f304 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 30 May 2023 10:28:00 +0200 Subject: [PATCH] Bug 33568: Fix select/clear all links MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up for "Bug 33568: Preserve item selection across pagination and filtering" FIXME We should deal with the items selection in a better way, but I would not consider it blocker, that can be done later. Signed-off-by: Owen Leonard Signed-off-by: Laurence Rault Signed-off-by: Emily Lamancusa Signed-off-by: Tomás Cohen Arazi --- .../tables/items/catalogue_detail.inc | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc index fe410833bb1..5b389c90f62 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc @@ -105,11 +105,11 @@ function itemSelectionBuildActionLinks(tab_id) { var delete_link_ok = itemSelectionBuildDeleteLink(tab_id); var modify_link_ok = itemSelectionBuildModifyLink(tab_id); - var div = $("#" + tab_id); + var tab = $("#" + tab_id); if (modify_link_ok || delete_link_ok) { - $('.itemselection_actions', div).show(); + $('.itemselection_actions', tab).show(); } else { - $('.itemselection_actions', div).hide(); + $('.itemselection_actions', tab).hide(); } } @@ -117,16 +117,22 @@ $(".SelectAll").on("click",function(e){ e.preventDefault(); - var tab = $(this).data("tab"); - $("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', true); - itemSelectionBuildActionLinks(tab); + let tab_id = $(this).data("tab"); + let tab = $("#"+tab_id); + tab.find("input[name='itemnumber'][type='checkbox']").each( (i, input) => { + items_selection[tab_id].push($(input).val()); + $(input).prop('checked', true); + }); + itemSelectionBuildActionLinks(tab_id); }); $(".ClearAll").on("click",function(e){ e.preventDefault(); - var tab = $(this).data("tab"); - $("input[name='itemnumber'][type='checkbox']", $("#"+tab)).prop('checked', false); - itemSelectionBuildActionLinks(tab); + let tab_id = $(this).data("tab"); + let tab = $("#"+tab_id); + items_selection[tab_id] = []; + $("input[name='itemnumber'][type='checkbox']", tab).prop('checked', false); + itemSelectionBuildActionLinks(tab_id); }); $(".show_filters").on("click",function(e){ -- 2.34.1