View | Details | Raw Unified | Return to bug 29822
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/js_includes.inc (-1 / +1 lines)
Lines 72-78 Link Here
72
[% IF ( PatronAutoComplete ) %]
72
[% IF ( PatronAutoComplete ) %]
73
    <script>
73
    <script>
74
    // PatronAutoComplete
74
    // PatronAutoComplete
75
    var defaultPatronSearchFields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' | html %]";
75
    var defaultPatronSearchFields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname|middle_name|surname|othernames|cardnumber|userid' | html %]";
76
    var loggedInLibrary = '[% Branches.GetLoggedInBranchcode | html %]';
76
    var loggedInLibrary = '[% Branches.GetLoggedInBranchcode | html %]';
77
    var singleBranchMode = '[% singleBranchMode | html %]';
77
    var singleBranchMode = '[% singleBranchMode | html %]';
78
    var loggedInClass = "";
78
    var loggedInClass = "";
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc (-2 / +2 lines)
Lines 306-318 Link Here
306
                    let search_type = $("#searchtype_filter").val() || "contain";
306
                    let search_type = $("#searchtype_filter").val() || "contain";
307
                    let search_fields = $("#searchfieldstype_filter").val();
307
                    let search_fields = $("#searchfieldstype_filter").val();
308
                    if ( !search_fields ) {
308
                    if ( !search_fields ) {
309
                        search_fields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' | html %]";
309
                        search_fields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname|middle_name|surname|othernames|cardnumber|userid' | html %]";
310
                    }
310
                    }
311
311
312
                    let subquery_and = [];
312
                    let subquery_and = [];
313
                    patterns.forEach(function(pattern,i){
313
                    patterns.forEach(function(pattern,i){
314
                        let sub_or = [];
314
                        let sub_or = [];
315
                        search_fields.split(',').forEach(function(attr,ii){
315
                        search_fields.split('|').forEach(function(attr,ii){
316
                            sub_or.push({["me."+attr]:{"like":(search_type == "contain" ? "%" : "" ) + pattern + "%"}});
316
                            sub_or.push({["me."+attr]:{"like":(search_type == "contain" ? "%" : "" ) + pattern + "%"}});
317
                            if ( attr == 'dateofbirth' ) {
317
                            if ( attr == 'dateofbirth' ) {
318
                                try {
318
                                try {
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patronfields.inc (-1 / +2 lines)
Lines 86-92 Link Here
86
        <label for="searchfieldstype_filter">Search field:</label>
86
        <label for="searchfieldstype_filter">Search field:</label>
87
        <select name="searchfieldstype" id="searchfieldstype_filter">
87
        <select name="searchfieldstype" id="searchfieldstype_filter">
88
    [% END %]
88
    [% END %]
89
        [% SET standard = Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' %]
89
        [% SET standard = Koha.Preference('DefaultPatronSearchFields') || 'firstname|middle_name|surname|othernames|cardnumber|userid' %]
90
        [% standard.replace('|', ',') %]
90
        [% SET full_address = 'streetnumber,streettype,address,address2,city,state,zipcode,country' %]
91
        [% SET full_address = 'streetnumber,streettype,address,address2,city,state,zipcode,country' %]
91
        [% SET all_emails = 'email,emailpro,B_email' %]
92
        [% SET all_emails = 'email,emailpro,B_email' %]
92
        [% SET all_phones = 'phone,phonepro,B_phone,altcontactphone,mobile' %]
93
        [% SET all_phones = 'phone,phonepro,B_phone,altcontactphone,mobile' %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js (-2 / +1 lines)
Lines 20-26 function patron_autocomplete(node, options) { Link Here
20
                .filter(function(s){ return s.length })
20
                .filter(function(s){ return s.length })
21
                .forEach(function(pattern,i){
21
                .forEach(function(pattern,i){
22
                    let subquery_or = [];
22
                    let subquery_or = [];
23
                    defaultPatronSearchFields.split(',').forEach(function(field,i){
23
                    defaultPatronSearchFields.split('|').forEach(function(field,i){
24
                        subquery_or.push(
24
                        subquery_or.push(
25
                            {["me."+field]: {'like': pattern + '%'}}
25
                            {["me."+field]: {'like': pattern + '%'}}
26
                        );
26
                        );
27
- 

Return to bug 29822