Bugzilla – Attachment 188063 Details for
Bug 41039
Patron search button can be spammed and trigger many API patron searches
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41039: Prevent patron search button from being spammed triggering multiple api requests
Bug-41039-Prevent-patron-search-button-from-being-.patch (text/plain), 3.90 KB, created by
Kyle M Hall (khall)
on 2025-10-17 11:20:49 UTC
(
hide
)
Description:
Bug 41039: Prevent patron search button from being spammed triggering multiple api requests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2025-10-17 11:20:49 UTC
Size:
3.90 KB
patch
obsolete
>From b8156db61327b5cee54403cf452e654c3f250c01 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >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 <kyle@bywatersolutions.com> >--- > .../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 @@ > <form method="get" class="patron_search_form"> > <div class="hint">Enter patron card number or partial name:</div> > <input type="text" size="40" id="search_patron_filter_simple" class="search_patron_filter focus" autocomplete="off" /> >- <input type="submit" class="btn btn-primary" value="Search" /> >+ <input type="submit" class="btn btn-primary search_patron_filter_btn" value="Search" /> > </form> > [% END %] > >@@ -105,7 +105,7 @@ > </ol> > </fieldset> > <fieldset class="action"> >- <input type="submit" class="btn btn-primary" value="Search" /> >+ <input type="submit" class="btn btn-primary search_patron_filter_btn" value="Search" /> > <input type="button" value="Clear" class="btn btn-default clear_search" /> > </fieldset> > </form> >@@ -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.39.5 (Apple Git-154)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41039
:
188063
|
188123