Bugzilla – Attachment 152563 Details for
Bug 33117
Patron checkout search not working if searching with second surname
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33117: Adding new PatronAutoCompleteSearchMethod system preference
Bug-33117-Adding-new-PatronAutoCompleteSearchMetho.patch (text/plain), 7.00 KB, created by
Martin Renvoize (ashimema)
on 2023-06-22 13:44:13 UTC
(
hide
)
Description:
Bug 33117: Adding new PatronAutoCompleteSearchMethod system preference
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-06-22 13:44:13 UTC
Size:
7.00 KB
patch
obsolete
>From 6a4cf3279252f7f46e7b345d02977709cf9d1d40 Mon Sep 17 00:00:00 2001 >From: Laura Escamilla <laura.escamilla@bywatersolutions.com> >Date: Fri, 26 May 2023 16:19:54 +0000 >Subject: [PATCH] Bug 33117: Adding new PatronAutoCompleteSearchMethod system > preference > >This patch adds a new system preference called "PatronAutoCompleteSearchMethod" >which allows staff to choose between "Starts with" or "Contains" when >searching for patrons. > >The "Contains" option should be useful when searching for patrons that have >multiple surnames or when searching using a patron's middle name. > >New Test Plan: > 0. Ensure system preference PatronAutoComplete is set to Try > 1. Create a patron that has a first name, middle name and two surnames. > (i.e. Adela Maria, Hernandez Acosta). > 2. In patron or checkout search, enter their first name and first > surname without submitting. > 3. Confirm that a record is found in the autocomplete results > 4. In patron or checkout search, enter their first name and second > surname without submitting. > 5. Confirm that no record is found. > 6. Enter their middle name and first surname. Confirm that no record is > found. > 7. Enter their middle name and second surname. Confirm that no record > is found. > 8. Apply the patch, update database > 9. Under Administration > Global System Preferences > search for > "PatronAutocompleteSearchMethod" >10. Choose "Contains" instead of "Starts with" for the system > preference, reload your search page >11. Repeat steps 2-4. The patron record should appear for all search > methods. >12. Sign off! > >Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > installer/data/mysql/atomicupdate/bug_33117.pl | 17 +++++++++++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../prog/en/includes/js_includes.inc | 1 + > .../modules/admin/preferences/circulation.pref | 6 ++++++ > .../prog/js/patron-autocomplete.js | 3 ++- > 5 files changed, 27 insertions(+), 1 deletion(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_33117.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_33117.pl b/installer/data/mysql/atomicupdate/bug_33117.pl >new file mode 100644 >index 0000000000..03e9ab6787 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_33117.pl >@@ -0,0 +1,17 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "33117", >+ description => "Patron checkout is not able to find patrons if using a second surname or other name during the search", >+ up => sub { >+ my ($args) = @_; >+ my ( $dbh, $out ) = @$args{qw(dbh out)}; >+ >+ $dbh->do(q{ >+ INSERT INTO systempreferences (`variable`,`value`,`explanation`,`options`,`type`) >+ VALUES ('PatronAutoCompleteSearchMethod','starts_with','Allows staff to set a default method when searching for patrons with autocomplete','starts_with|contains','Choice'); >+ }); >+ >+ say $out "Added new system preference 'PatronAutoCompleteSearchMethod'"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index b224c147fe..a417499c4f 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -552,6 +552,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('PassItemMarcToXSLT','0',NULL,'If enabled, item fields in the MARC record will be made avaiable to XSLT sheets. Otherwise they will be removed.','YesNo'), > ('PatronAnonymizeDelay','',NULL,'Delay for anonymizing patrons', 'Integer'), > ('PatronAutoComplete','1','Try|Don\'t try','to guess the patron being entered while typing a patron search for circulation or patron search. Only returns the first 10 results at a time.','YesNo'), >+('PatronAutoCompleteSearchMethod','starts_with','Choose which search method to use by default when searching with PatronAutoComplete','starts_with|choice','Choice'), > ('PatronDuplicateMatchingAddFields','surname|firstname|dateofbirth', NULL,'A list of fields separated by "|" to deduplicate patrons when created','Free'), > ('patronimages','0',NULL,'Enable patron images for the staff interface','YesNo'), > ('PatronRemovalDelay','',NULL,'Delay for removing anonymized patrons', 'Integer'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >index f1745d52e8..3ea7f705ff 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc >@@ -71,6 +71,7 @@ > > <script> > var defaultPatronSearchFields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' | html %]"; >+ var patronAutoCompleteSearchMethod = "[% Koha.Preference('PatronAutoCompleteSearchMethod') || 'contains' | html %]"; > var loggedInLibrary = '[% Branches.GetLoggedInBranchcode | html %]'; > var singleBranchMode = '[% singleBranchMode | html %]'; > </script> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >index ffe8481869..b79316a593 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref >@@ -26,6 +26,12 @@ Circulation: > 0: "Don't try" > - to guess the patron being entered while typing a patron search for circulation or patron search. > - Only returns the first 10 results at a time. >+ - >+ - pref: PatronAutoCompleteSearchMethod >+ choices: >+ starts_with: "Starts with" >+ contains: "Contains" >+ - Enable this search method to determine whether to use Starts with or Contains for autocomplete patron searches. > - > - pref: itemBarcodeInputFilter > choices: >diff --git a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js b/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js >index cc8ec068ae..167928dd3f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js >@@ -2,6 +2,7 @@ function patron_autocomplete(node, options) { > let link_to; > let url_params; > let on_select_callback; >+ let leading_wildcard = patronAutoCompleteSearchMethod === 'contains' ? '%' : ''; > if ( options ) { > if ( options['link-to'] ) { > link_to = options['link-to']; >@@ -22,7 +23,7 @@ function patron_autocomplete(node, options) { > let subquery_or = []; > defaultPatronSearchFields.split(',').forEach(function(field,i){ > subquery_or.push( >- {["me."+field]: {'like': pattern + '%'}} >+ {["me."+field]: {'like': leading_wildcard + pattern + '%'}} > ); > }); > subquery_and.push(subquery_or); >-- >2.41.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 33117
:
148018
|
148027
|
148095
|
148131
|
148138
|
148278
|
148279
|
148280
|
148282
|
148336
|
148383
|
148384
|
148443
|
148445
|
148467
|
148481
|
150781
|
150896
|
150897
|
150898
|
151090
|
151091
|
151302
|
151314
|
151317
|
151769
|
151771
|
151825
|
151845
|
152549
|
152552
|
152554
|
152555
|
152556
|
152562
| 152563 |
152564
|
152565
|
154309