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

(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-2 / +5 lines)
Lines 512-517 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
512
    $.fn.api = function(options) {
512
    $.fn.api = function(options) {
513
        var settings = null;
513
        var settings = null;
514
        if(options) {
514
        if(options) {
515
            if(!options.criteria || ['contains', 'starts_with', 'ends_with', 'exact'].indexOf(options.criteria.toLowerCase()) === -1) options.criteria = 'contains';
516
            options.criteria = options.criteria.toLowerCase();
515
            settings = $.extend(true, {}, dataTablesDefaults, {
517
            settings = $.extend(true, {}, dataTablesDefaults, {
516
                        'deferRender': true,
518
                        'deferRender': true,
517
                        "paging": true,
519
                        "paging": true,
Lines 556-562 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
556
                                })
558
                                })
557
                                .map(function(col) {
559
                                .map(function(col) {
558
                                    var part = {};
560
                                    var part = {};
559
                                    part[!col.data.includes('.')?'me.'+col.data:col.data] = {like: (data.columns[col.idx].search.value != '' ? data.columns[col.idx].search.value : filter)+'%'};
561
                                    var value = data.columns[col.idx].search.value != '' ? data.columns[col.idx].search.value : filter;
562
                                    part[!col.data.includes('.')?'me.'+col.data:col.data] = options.criteria === 'exact'?value:{like: (['contains', 'ends_with'].indexOf(options.criteria) !== -1?'%':'')+value+(['contains', 'starts_with'].indexOf(options.criteria) !== -1?'%':'')};
560
                                    return part;
563
                                    return part;
561
                                });
564
                                });
562
565
Lines 572-578 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
572
                                    delete options.query_parameters;
575
                                    delete options.query_parameters;
573
                                }
576
                                }
574
577
575
                                dataSet._match = 'starts_with';
578
                                dataSet._match = options.criteria;
576
579
577
                                if(options.columns) {
580
                                if(options.columns) {
578
                                    var order = data.order;
581
                                    var order = data.order;
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/datatables.js (-3 / +5 lines)
Lines 133-138 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
133
    $.fn.api = function(options) {
133
    $.fn.api = function(options) {
134
        var settings = null;
134
        var settings = null;
135
        if(options) {
135
        if(options) {
136
            if(!options.criteria || ['contains', 'starts_with', 'ends_with', 'exact'].indexOf(options.criteria.toLowerCase()) === -1) options.criteria = 'contains';
137
            options.criteria = options.criteria.toLowerCase();
136
            settings = $.extend(true, {}, dataTablesDefaults, {
138
            settings = $.extend(true, {}, dataTablesDefaults, {
137
                        'deferRender': true,
139
                        'deferRender': true,
138
                        "paging": true,
140
                        "paging": true,
Lines 177-183 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
177
                                })
179
                                })
178
                                .map(function(col) {
180
                                .map(function(col) {
179
                                    var part = {};
181
                                    var part = {};
180
                                    part[!col.data.includes('.')?'me.'+col.data:col.data] = {like: (data.columns[col.idx].search.value != '' ? data.columns[col.idx].search.value : filter)+'%'};
182
                                    var value = data.columns[col.idx].search.value != '' ? data.columns[col.idx].search.value : filter;
183
                                    part[!col.data.includes('.')?'me.'+col.data:col.data] = options.criteria === 'exact'?value:{like: (['contains', 'ends_with'].indexOf(options.criteria) !== -1?'%':'')+value+(['contains', 'starts_with'].indexOf(options.criteria) !== -1?'%':'')};
181
                                    return part;
184
                                    return part;
182
                                });
185
                                });
183
186
Lines 193-199 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
193
                                    delete options.query_parameters;
196
                                    delete options.query_parameters;
194
                                }
197
                                }
195
198
196
                                dataSet._match = 'starts_with';
199
                                dataSet._match = options.criteria;
197
200
198
                                if(options.columns) {
201
                                if(options.columns) {
199
                                    var order = data.order;
202
                                    var order = data.order;
200
- 

Return to bug 24561