From aa49b1bed9d131a6081b17e8217c8e9ed4b849e6 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 23 Sep 2022 15:22:34 +0000 Subject: [PATCH] Bug 31566: 'Patrons selected' counter doubles on 'Select all' This patch refines the JavaScript which is run when the "Select all" or "Clear all" controls are clicked. The script now checks to see whether the checkbox is checked before triggering the change function. To test, apply the patch and perform a patron search in the staff interface which will return multiple results. - After the patron search results are displayed, test the "Select all" control. The visible search results should all be checked, and the "Patrons selected" counter at the top should be incremented correctly. - Clicking the "Select all" control again should have no effect. The "Patrons selected" counter should not increment again. - Test the "Clear all" control to confirm that checkboxes are unchecked and the counter updates correctly. - Test with multiple pages of patron search results to confirm that the controls work correctly on any page of results.. Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../intranet-tmpl/prog/en/modules/members/member.tt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt index 747920f760..4fee56f65f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/member.tt @@ -252,11 +252,19 @@ $("#select_all").on("click",function(e){ e.preventDefault(); - $(".selection").prop("checked", true).change(); + $(".selection").each(function(){ + if( $(this).prop("checked") == false ){ + $(this).prop( "checked", true ).change(); + } + }); }); $("#clear_all").on("click",function(e){ e.preventDefault(); - $(".selection").prop("checked", false).change(); + $(".selection").each(function(){ + if( $(this).prop("checked") ){ + $(this).prop("checked", false ).change(); + } + }); }); [% IF searchmember %] -- 2.39.5