https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41048

--- Comment #25 from Kyle M Hall (khall) <[email protected]> ---
Created attachment 199766
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199766&action=edit
Bug 41048: Add ability to disallow empty patron searches

In high traffic environments with large numbers of patrons, empty patron
searches can take a very long time and cause over-use of resources. It
would be nice to have the option to require search criteria for patron
searches.

This patch adds a new system preference EmptyPatronSearches. When set to
"Don't allow", a patron search with no criteria is rejected, both in the
staff interface and via the REST API.

In the staff interface the "Search for patron" button in the sidebar is
disabled until a search term is entered or a library, category or sort
filter is selected, and the header "Search patrons" form refuses an empty
search. Filters like category and library count as search criteria, so a
search limited only by those is still allowed.

On the REST API, a request to /api/v1/patrons with no query is rejected
with a 422 and the error_code 'empty_search_not_allowed'.

Test Plan:
1) Apply this patch
2) Run updatedatabase.pl
3) Restart all the things!
4) Browse to Administration and note the new EmptyPatronSearches
   system preference, set it to "Don't allow"
5) Browse to the patrons home page ( members-home.pl )
6) Note the sidebar "Search for patron" button is disabled when the form
   is empty, and enabled once you enter a term or pick a library,
   category or sort filter
7) Note the header "Search patrons" search refuses an empty search
8) Set EmptyPatronSearches to "Allow"
9) Note empty searches are allowed again in both the sidebar and header!

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to