Bug 30576: Use DefaultPatronSearchFields in patron search
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 21 Apr 2022 11:52:32 +0000 (12:52 +0100)
committerFridolin Somers <fridolin.somers@biblibre.com>
Thu, 28 Apr 2022 20:49:20 +0000 (10:49 -1000)
commita54646ff69a8ce954c12e5b9608117357501a4fb
tree77913e4d3b6f8c512a147ad41eb52852eb2490ae
parent976f893c06a299788b7cc936b06060412fce832b
Bug 30576: Use DefaultPatronSearchFields in patron search

This patch corrects the handling of the 'Standard' search field in
patron searches such that it accurately reflects the contents of the
DefaultPatronSearchFields system preference and falls back to a hard
coded list instead of always using the hard coded list.

To test:
1) Empty the contents of DefaultPatronSearchFields systempreference
2) Perform a patron search from the header search
3) Inspect the patrons API request and note that we search on the
   default fallback fields of firstname, surname, othernames,
   cardnumber and userid (and some extended attributes which are
   historically hard coded).
4) Navigate to the memebers-home by clicking the 'Patrons' button from
   the main page
5) Perform another search using the filters on the left with 'Standard'
   selected.
6) Note the same list of search fields used as above in the patrons API
   request.
7) Update the DefaultPatronSearchFields systempreference adding one or
   more borrower fields in a comma delimited list.
8) Repeat steps 2 -> 6 but this time upon inspecting the API request you
   should find that only the fields in your DefaultPatronSearchFields
   list are searched (along with the hard coded extended attributes
   list).
9) Signoff

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
koha-tmpl/intranet-tmpl/prog/en/includes/patron-search-header.inc
koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc
koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc