Bugzilla – Attachment 189197 Details for
Bug 41040
Empty patron search from the header should not trigger a patron search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41040: Prevent form submission if no filters have been selected
Bug-41040-Prevent-form-submission-if-no-filters-ha.patch (text/plain), 3.76 KB, created by
Owen Leonard
on 2025-11-06 18:13:19 UTC
(
hide
)
Description:
Bug 41040: Prevent form submission if no filters have been selected
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2025-11-06 18:13:19 UTC
Size:
3.76 KB
patch
obsolete
>From 7acc3da51e1645c9069f31c7daa5f0d2c376823e Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 4 Nov 2025 08:54:02 -0500 >Subject: [PATCH] Bug 41040: Prevent form submission if no filters have been > selected > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >--- > .../prog/en/includes/member-search-box.inc | 17 +++++++++++++++-- > members/member.pl | 9 ++++++--- > 2 files changed, 21 insertions(+), 5 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/member-search-box.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/member-search-box.inc >index 43ece025704..5f13fd2f3c7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/member-search-box.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/member-search-box.inc >@@ -6,7 +6,20 @@ > [% IF CAN_user_borrowers_edit_borrowers || CAN_user_borrowers_list_borrowers %] > [%- SET searchtype = searchtype || Koha.Preference('DefaultPatronSearchMethod') -%] > [% WRAPPER tab_panel tabname="patron_search" bt_active= bs_tab_active %] >- <form method="get" action="/cgi-bin/koha/members/member.pl"> >+ <form method="get" action="/cgi-bin/koha/members/member.pl" onsubmit="return validatePatronSearch(this);"> >+ <script> >+ function validatePatronSearch(form) { >+ const searchTerm = form.searchmember.value.trim(); >+ const branchSelected = form.branchcode_filter && form.branchcode_filter.value !== ""; >+ const categorySelected = form.categorycode_filter && form.categorycode_filter.value !== ""; >+ >+ if (!searchTerm && !branchSelected && !categorySelected) { >+ alert("Please enter a search term or select a library/category"); >+ return false; >+ } >+ return true; >+ } >+ </script> > <input type="hidden" name="quicksearch" value="1" /> > > <div class="form-title"> >@@ -23,7 +36,7 @@ > <button type="button" class="form-extra-content-toggle" title="More options"><i class="form-extra-content-icon fa-solid fa-sliders" aria-hidden="true"></i></button> > </div> > >- <button type="submit" aria-label="Search"><i class="fa fa-arrow-right"></i></button> >+ <button type="submit" class="btn btn-primary" aria-label="Search"><i class="fa fa-arrow-right"></i></button> > > <div class="form-extra-content"> > <div> [% INCLUDE patron_fields_dropdown search_box=1 %] </div> >diff --git a/members/member.pl b/members/member.pl >index f0b68ade6ff..c247461fe91 100755 >--- a/members/member.pl >+++ b/members/member.pl >@@ -69,16 +69,19 @@ my $searchtype = $input->param('searchtype'); > > $template->param( 'alphabet' => C4::Context->preference('alphabet') || join ' ', 'A' .. 'Z' ); > >+my $branchcode_filter = scalar $input->param('branchcode_filter'); >+my $categorycode_filter = scalar $input->param('categorycode_filter'); >+ > $template->param( > patron_lists => [ GetPatronLists() ], > searchmember => $searchmember, >- branchcode_filter => scalar $input->param('branchcode_filter'), >- categorycode_filter => scalar $input->param('categorycode_filter'), >+ branchcode_filter => $branchcode_filter, >+ categorycode_filter => $categorycode_filter, > searchtype => $searchtype, > searchfieldstype => $searchfieldstype, > PatronsPerPage => C4::Context->preference("PatronsPerPage") || 20, > circsearch => $circsearch, >- defer_loading => $searchmember ? 0 : 1, >+ defer_loading => ( $searchmember || $branchcode_filter || $categorycode_filter ) ? 0 : 1, > ); > > output_html_with_http_headers $input, $cookie, $template->output; >-- >2.39.5
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 41040
:
188062
|
189016
|
189017
|
189018
|
189197
|
189198
|
189199
|
189508
|
189509
|
189510
|
189511
|
189517
|
189518
|
189519
|
189520