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 71-77 Link Here
71
[% IF ( PatronAutoComplete ) %]
71
[% IF ( PatronAutoComplete ) %]
72
    <script>
72
    <script>
73
    // PatronAutoComplete
73
    // PatronAutoComplete
74
    var defaultPatronSearchFields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' | html %]";
74
    var defaultPatronSearchFields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname|middle_name|surname|othernames|cardnumber|userid' | html %]";
75
    var loggedInLibrary = '[% Branches.GetLoggedInBranchcode | html %]';
75
    var loggedInLibrary = '[% Branches.GetLoggedInBranchcode | html %]';
76
    var singleBranchMode = '[% singleBranchMode | html %]';
76
    var singleBranchMode = '[% singleBranchMode | html %]';
77
    var loggedInClass = "";
77
    var loggedInClass = "";
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/member-search-box.inc (-2 / +2 lines)
Lines 27-35 Link Here
27
                <div>
27
                <div>
28
                    <label for="searchfieldstype" class="control-label">Search fields</label>
28
                    <label for="searchfieldstype" class="control-label">Search fields</label>
29
                    <select name="searchfieldstype" id="searchfieldstype" class="form-control">
29
                    <select name="searchfieldstype" id="searchfieldstype" class="form-control">
30
                        [% SET standard = Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' %]
30
                        [% SET standard = Koha.Preference('DefaultPatronSearchFields') || 'firstname|middle_name|surname|othernames|cardnumber|userid' %]
31
                        [% default_fields = [ standard, 'surname', 'cardnumber', 'email', 'borrowernumber', 'userid', 'phone', 'address', 'dateofbirth', 'sort1', 'sort2' ] %]
31
                        [% default_fields = [ standard, 'surname', 'cardnumber', 'email', 'borrowernumber', 'userid', 'phone', 'address', 'dateofbirth', 'sort1', 'sort2' ] %]
32
                        [% search_options = default_fields.merge(standard.split(',')).unique %]
32
                        [% search_options = default_fields.merge(standard.split('|')).unique %]
33
                        [% FOREACH s_o IN search_options %]
33
                        [% FOREACH s_o IN search_options %]
34
                            [% display_name = PROCESS patron_fields name=s_o %]
34
                            [% display_name = PROCESS patron_fields name=s_o %]
35
                            [% NEXT IF !display_name.length %]
35
                            [% NEXT IF !display_name.length %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc (-4 / +4 lines)
Lines 60-68 Link Here
60
                        <li>
60
                        <li>
61
                            <label for="searchfieldstype_filter">Search field:</label>
61
                            <label for="searchfieldstype_filter">Search field:</label>
62
                            <select name="searchfieldstype" id="searchfieldstype_filter">
62
                            <select name="searchfieldstype" id="searchfieldstype_filter">
63
                                [% SET standard = Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' %]
63
                                [% SET standard = Koha.Preference('DefaultPatronSearchFields') || 'firstname|middle_name|surname|othernames|cardnumber|userid' %]
64
                                [% default_fields = [ standard, 'surname', 'cardnumber', 'email', 'borrowernumber', 'userid', 'phone', 'address', 'dateofbirth', 'sort1', 'sort2' ] %]
64
                                [% default_fields = [ standard, 'surname', 'cardnumber', 'email', 'borrowernumber', 'userid', 'phone', 'address', 'dateofbirth', 'sort1', 'sort2' ] %]
65
                                [% search_options = default_fields.merge(standard.split(',')).unique %]
65
                                [% search_options = default_fields.merge(standard.split('|')).unique %]
66
                                [% FOREACH s_o IN search_options %]
66
                                [% FOREACH s_o IN search_options %]
67
                                    [% display_name = PROCESS patron_fields name=s_o %]
67
                                    [% display_name = PROCESS patron_fields name=s_o %]
68
                                    [% NEXT IF !display_name %]
68
                                    [% NEXT IF !display_name %]
Lines 320-332 Link Here
320
                    let search_type = $("#searchtype_filter").val() || "contain";
320
                    let search_type = $("#searchtype_filter").val() || "contain";
321
                    let search_fields = $("#searchfieldstype_filter").val();
321
                    let search_fields = $("#searchfieldstype_filter").val();
322
                    if ( !search_fields ) {
322
                    if ( !search_fields ) {
323
                        search_fields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname,middle_name,surname,othernames,cardnumber,userid' | html %]";
323
                        search_fields = "[% Koha.Preference('DefaultPatronSearchFields') || 'firstname|middle_name|surname|othernames|cardnumber|userid' | html %]";
324
                    }
324
                    }
325
325
326
                    let subquery_and = [];
326
                    let subquery_and = [];
327
                    patterns.forEach(function(pattern,i){
327
                    patterns.forEach(function(pattern,i){
328
                        let sub_or = [];
328
                        let sub_or = [];
329
                        search_fields.split(',').forEach(function(attr,ii){
329
                        search_fields.split('|').forEach(function(attr,ii){
330
                            sub_or.push({["me."+attr]:{"like":(search_type == "contain" ? "%" : "" ) + pattern + "%"}});
330
                            sub_or.push({["me."+attr]:{"like":(search_type == "contain" ? "%" : "" ) + pattern + "%"}});
331
                            if ( attr == 'dateofbirth' ) {
331
                            if ( attr == 'dateofbirth' ) {
332
                                try {
332
                                try {
(-)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