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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc (-1 / +6 lines)
Lines 326-333 Link Here
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
                        let cur_search_type = search_type;
330
                        if( pattern.slice(0,1) == '^' ){
331
                            cur_search_type = "starts_with";
332
                            pattern = pattern.substr(1);
333
                        }
329
                        search_fields.split(',').forEach(function(attr,ii){
334
                        search_fields.split(',').forEach(function(attr,ii){
330
                            sub_or.push({["me."+attr]:{"like":(search_type == "contain" ? "%" : "" ) + pattern + "%"}});
335
                            sub_or.push({["me."+attr]:{"like":(cur_search_type == "contain" ? "%" : "" ) + pattern + "%"}});
331
                            if ( attr == 'dateofbirth' ) {
336
                            if ( attr == 'dateofbirth' ) {
332
                                try {
337
                                try {
333
                                    let d = $date_to_rfc3339(pattern);
338
                                    let d = $date_to_rfc3339(pattern);
(-)a/koha-tmpl/intranet-tmpl/prog/js/patron-autocomplete.js (-2 / +6 lines)
Lines 20-28 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
                    let likeness = "%";
24
                    if( pattern.slice(0,1) == '^' ){
25
                        pattern = pattern.substr(1);
26
                        likeness = "";
27
                    }
23
                    defaultPatronSearchFields.split(',').forEach(function(field,i){
28
                    defaultPatronSearchFields.split(',').forEach(function(field,i){
24
                        subquery_or.push(
29
                        subquery_or.push(
25
                            {["me."+field]: {'like': pattern + '%'}}
30
                            {["me."+field]: {'like': likeness + pattern + '%'}}
26
                        );
31
                        );
27
                    });
32
                    });
28
                    subquery_and.push(subquery_or);
33
                    subquery_and.push(subquery_or);
29
- 

Return to bug 32772