From 2a106c04f90904780f6a3c12f74a713a598d6795 Mon Sep 17 00:00:00 2001 From: John Doe Date: Fri, 26 May 2023 21:02:00 +0000 Subject: [PATCH] Bug 33117: New system preference - PatronAutoCompleteSearchMethod --- installer/data/mysql/atomicupdate/bug_33117.pl | 2 +- installer/data/mysql/mandatory/sysprefs.sql | 2 +- koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc | 2 +- .../prog/en/modules/admin/preferences/circulation.pref | 8 ++++---- koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/installer/data/mysql/atomicupdate/bug_33117.pl b/installer/data/mysql/atomicupdate/bug_33117.pl index 26abf6b87a..67879e0e51 100644 --- a/installer/data/mysql/atomicupdate/bug_33117.pl +++ b/installer/data/mysql/atomicupdate/bug_33117.pl @@ -8,7 +8,7 @@ return { my ($dbh, $out) = @$args{qw(dbh out)}; # Do you stuffs here $dbh->do(q{INSERT INTO systempreferences (`variable`,`value`,`explanation`,`options`,`type`) VALUES - ('PatronAutoCompleteSearchMethod','1','Allows staff to search for patrons using the method','Starts with|Contains','YesNo'}); + ('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 36dcb956f1..822fae4726 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -555,7 +555,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','1','Allows staff to search for patrons using the method','Starts with|Contains','YesNo'), +('PatronAutoCompleteSearchMethod','starts_with','Choose which search method to use by default when searching with Patron autocomplete','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 6cbfb5db56..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,7 +71,7 @@ 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 373210aa3e..fb33897362 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 @@ -27,10 +27,10 @@ Circulation: - 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: - 1: Starts with - 0: "Contains" + - pref: PatronAutoCompleteSearchMethod + choices: + 1: Starts with + 0: "Contains" - Enable this search method to determine whether to use Starts with or Contains for autocomplete patron searches. - - pref: itemBarcodeInputFilter diff --git a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js b/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js index e05c659f32..167928dd3f 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js +++ b/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js @@ -2,7 +2,7 @@ function patron_autocomplete(node, options) { let link_to; let url_params; let on_select_callback; - let leading_wildcard = patronAutoCompleteSearchMethod === '1' ? '%' : ''; + let leading_wildcard = patronAutoCompleteSearchMethod === 'contains' ? '%' : ''; if ( options ) { if ( options['link-to'] ) { link_to = options['link-to']; -- 2.30.2