Bug 29822: Update code to reference by pipe

Moving to modalselect also has the effect of moving from comma delimited
to pipe delimitation for the preference contents

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2023-02-10 15:22:04 +00:00 committed by Tomas Cohen Arazi
parent 0b4a37a29d
commit ffcfc13c7e
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
3 changed files with 5 additions and 4 deletions

View File

@ -69,7 +69,7 @@
[% END %]
<script>
var defaultPatronSearchFields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' | html %]";
var defaultPatronSearchFields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname|middle_name|surname|othernames|cardnumber|userid' | html %]";
var defaultPatronSearchMethod = "[% Koha.Preference('DefaultPatronSearchMethod') || 'contains' | html %]";
var extendedPatronAttributes = "[% Koha.Preference('ExtendedPatronAttributes') | html %]";
var loggedInLibrary = '[% Branches.GetLoggedInBranchcode | html %]';

View File

@ -86,7 +86,8 @@
<label for="searchfieldstype_filter">Search field:</label>
<select name="searchfieldstype" id="searchfieldstype_filter">
[% END %]
[% SET standard = Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' %]
[% SET standard = Koha.Preference('DefaultPatronSearchFields') || 'firstname|middle_name|surname|othernames|cardnumber|userid' %]
[% standard.replace('|', ',') %]
[% SET full_address = 'streetnumber,streettype,address,address2,city,state,zipcode,country' %]
[% SET all_emails = 'email,emailpro,B_email' %]
[% SET all_phones = 'phone,phonepro,B_phone,altcontactphone,mobile' %]

View File

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