Bug 32520: Use DefaultPatronSearchFields in patron_autocomplete
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Fri, 23 Dec 2022 11:32:12 +0000 (11:32 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 27 Jan 2023 19:20:54 +0000 (16:20 -0300)
commit6898f1f132b5a01eb4c406fa711b3d13324ef538
tree008d6b4b0e7d51daac4aab1fd7fa5b4df863809e
parenta99d188e78d42b7c2b9f2091a64142ba45909c70
Bug 32520: Use DefaultPatronSearchFields in patron_autocomplete

This patch updates js_includes.inc to set a new global js variable
`defaultPatronSearchFields` with the content of the corresponding system
preference.

We then update the patron_autocomplete function to use this new global
variable and iterate in the same way as
koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc.

NOTE: This changes the behaviour of the autocomplete from always
searching using contains on surname or firstname or starts with on
cardnumber to searching using 'contains' on any of the fields listed in
the DefaultPatronSearchFields system preference of defaulting to
'firstname,middle_name,surname,othernames,cardnumber,userid'.

Test plan
1. Ensure autocomplete still works everywhere
2. Confirm the system preference fields are being used.

Signed-off-by: Barbara Johnson <barbara.johnson@bedfordtx.gov>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc
koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js