Bugzilla – Attachment 144816 Details for
Bug 32520
Patron autocomplete should respect DefaultPatronSearchFields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32520: Iterate search_fields
Bug-32520-Iterate-searchfields.patch (text/plain), 2.30 KB, created by
Martin Renvoize (ashimema)
on 2022-12-23 11:52:20 UTC
(
hide
)
Description:
Bug 32520: Iterate search_fields
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-12-23 11:52:20 UTC
Size:
2.30 KB
patch
obsolete
>From 88133a9408be1c6fcfee40e8050bf0a76f5be8b6 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 23 Dec 2022 11:32:12 +0000 >Subject: [PATCH] Bug 32520: Iterate search_fields > >This pretty much matches the iterators in >koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc. > >Now we need to work out the best way to pass the >DefaultPatronSearchFields preference into the search_fields variable.. > >Perhaps pass it as part of the options at function call time? >--- > .../prog/js/patron-autocomplete.js | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js b/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js >index 5f0aeb55592..43f1970a83a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js >@@ -13,22 +13,22 @@ function patron_autocomplete(node, options) { > on_select_callback = options['on-select-callback']; > } > } >- const search_fields = ['me.surname', 'me.firstname', 'me.cardnumber']; >+ const search_fields = ['surname', 'firstname', 'cardnumber']; > return node.autocomplete({ > source: function( request, response ) { > let subquery_and = []; > request.term.split(' ') > .filter(function(s){ return s.length }) > .forEach(function(pattern,i){ >- subquery_and.push( >- [ >- {'me.surname': {'like': '%' + pattern + '%'}}, >- {'me.firstname': {'like': '%' + pattern + '%'}}, >- {'me.cardnumber': {'like': pattern + '%'}}, >- ] >- ); >+ let subquery_or = []; >+ search_fields.forEach(function(field,i){ >+ subquery_or.push( >+ {["me."+field]: {'like': '%' + pattern + '%'}} >+ ); >+ }); >+ subquery_and.push(subquery_or); > }); >- let q = {"-and": subquery_and}; >+ let q = {"-and": subquery_and }; > let params = { > '_page': 1, > '_per_page': 10, >-- >2.39.0
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 32520
:
144816
|
144862
|
144868
|
144878
|
144879