Bugzilla – Attachment 152559 Details for
Bug 34083
Patron auto-complete fails if organization patron full name is in a single field separated by a space
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34083: Add searching for full term on patron auto-complete
Bug-34083-Add-searching-for-full-term-on-patron-au.patch (text/plain), 2.93 KB, created by
Pedro Amorim
on 2023-06-22 12:23:45 UTC
(
hide
)
Description:
Bug 34083: Add searching for full term on patron auto-complete
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2023-06-22 12:23:45 UTC
Size:
2.93 KB
patch
obsolete
>From 895faa9c2a8b9b6e818c654cb07d0c31a4238bc8 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Wed, 21 Jun 2023 16:10:17 +0000 >Subject: [PATCH] Bug 34083: Add searching for full term on patron > auto-complete > >To reproduce, on k-t-d: >1) Create a new patron of category 'School' >2) Enter 'Middle school high school' on the mandatory 'Name' field and put something in 'Card number:' >3) Visit patron lists at /cgi-bin/koha/patron_lists/lists.pl and click 'New patron list' >4) Put something in 'Name:' and click 'Save' >5) On the 'Patron search' input, enter 'middle school high school' slowly and observe the auto-complete behaviour >6) Notice how after you start typing the second word, the auto complete results vanish. >7) Apply patch, repeat plan and verify it now works as expected. > >Signed-off-by: Sam Lau <samalau@gmail.com> >--- > .../prog/js/patron-autocomplete.js | 25 ++++++++++++++----- > 1 file changed, 19 insertions(+), 6 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js b/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js >index caed62ba8e..cff6a257fd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js >@@ -16,19 +16,32 @@ function patron_autocomplete(node, options) { > } > return node.autocomplete({ > source: function( request, response ) { >- let subquery_and = []; >+ let q = [] >+ >+ // Add each pattern in search term for each search field >+ let pattern_subquery_and = []; > request.term.split(/[\s,]+/) > .filter(function(s){ return s.length }) > .forEach(function(pattern,i){ >- let subquery_or = []; >+ let pattern_subquery_or = []; > defaultPatronSearchFields.split(',').forEach(function(field,i){ >- subquery_or.push( >- {["me."+field]: {'like': leading_wildcard + pattern + '%'}} >+ pattern_subquery_or.push( >+ { ["me." + field]: { 'like': leading_wildcard + pattern + '%' } } > ); > }); >- subquery_and.push(subquery_or); >+ pattern_subquery_and.push(pattern_subquery_or); > }); >- let q = {"-and": subquery_and}; >+ q.push({ "-and": pattern_subquery_and }); >+ >+ // Add full search term for each search field >+ let term_subquery_or = []; >+ defaultPatronSearchFields.split(',').forEach(function (field, i) { >+ term_subquery_or.push( >+ { ["me." + field]: { 'like': leading_wildcard + request.term + '%' } } >+ ); >+ }); >+ q.push({ "-or": term_subquery_or }); >+ > let params = { > '_page': 1, > '_per_page': 10, >-- >2.30.2
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 34083
:
152532
|
152534
|
152544
|
152559
|
152560
|
152593
|
152594