From 83c04d1fd910cae224b44e9b2a726ac6add77f3c Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 17 Oct 2025 07:14:35 -0400 Subject: [PATCH] Bug 41039: Prevent patron search button from being spammed triggering multiple api requests Every click of the "Search" button on members/members-home.pl or other area that utilizes patrons searching, will trigger another patron search api request. This button should be disabled until the first searches results are displayed. To demonstrate, open the network tab of the developer console on your web browser. Note each click if the button show another patron search api request. Test Plan: 1) Browse to members-home.pl 2) Open the network tab of the developer console on your web browser 3) Double click the Search button 4) Note the two api requests in the network tab 5) Apply this patch 6) Reload the page 7) Double click the Search button 8) Note only one api request is made If your results come back too fast, you may perform an initial search, then change the number of results from the default 20 to "All" to create a search that will take longer. Signed-off-by: Kyle M Hall Signed-off-by: Caroline Cyr La Rose --- .../intranet-tmpl/prog/en/includes/patron-search.inc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc index a4f76e8e116..8ca22ec1999 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc @@ -16,7 +16,7 @@
Enter patron card number or partial name:
- +
[% END %] @@ -105,7 +105,7 @@
- +
@@ -789,6 +789,8 @@ patron_search_form.on('submit', update_search_type); patron_search_form.on('submit', function(){ parent_block.find(".searchheader").show(); + // Disable the search button until results are returned and displayed + patron_search_form.find(".search_patron_filter_btn").prop({disabled: true}); }); @@ -911,6 +913,9 @@ } patrons_table.data('loaded_from_state', false); first_draw = 1; // Only redirect if we are coming from here + table_dt.on('draw.dt', function () { + patron_search_form.find(".search_patron_filter_btn").prop({disabled: false}); + }); table_dt.draw(); return false; } @@ -924,6 +929,7 @@ patron_search_form.find(".branchcode_filter option:first").prop("selected", true); patron_search_form.find("select[name='sort1_filter']").val('').trigger("change"); patron_search_form.find("select[name='sort2_filter']").val('').trigger("change"); + patron_search_form.find(".search_patron_filter_btn").prop({disabled: false}); parent_block.find(".firstletter_filter").val(''); patron_search_form.find(".search_patron_filter").val(''); [% IF adjust_history %] -- 2.43.0