Bug 34256: Fix regression from 34092

It appears search_fields variable got lost somewhere in my own rebases.
search_fields variable was not being considered as it should, in the function.
I think this patch fixes it.

This showed in the borrowernumer no longer being searchable:

* Use search filters in patron search
* Set 'Search field' to borrowernumber
* Search for 19 (Henry) or 41 (koha) in sample data
* No results :(
* Apply patch
* Search leads to the patron record again

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Pedro Amorim 2023-07-14 08:37:27 +00:00 committed by Tomas Cohen Arazi
parent 0992769f6e
commit bcabb5d247
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -554,7 +554,7 @@ function buildPatronSearchQuery(term, options) {
let pattern_subquery_and = [];
patterns.forEach(function (pattern, i) {
let pattern_subquery_or = [];
defaultPatronSearchFields.split(',').forEach(function (field, i) {
search_fields.split(',').forEach(function (field, i) {
pattern_subquery_or.push(
{ ["me." + field]: { 'like': leading_wildcard + pattern + '%' } }
);
@ -573,7 +573,7 @@ function buildPatronSearchQuery(term, options) {
// Add full search term for each search field
let term_subquery_or = [];
defaultPatronSearchFields.split(',').forEach(function (field, i) {
search_fields.split(',').forEach(function (field, i) {
term_subquery_or.push(
{ ["me." + field]: { 'like': leading_wildcard + term + '%' } }
);