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

(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-5 / +5 lines)
Lines 564-576 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
564
                                };
564
                                };
565
565
566
566
567
                                function build_query(col){
567
                                function build_query(col, value){
568
                                    var parts = [];
568
                                    var parts = [];
569
                                    var attributes = col.data.split(':');
569
                                    var attributes = col.data.split(':');
570
                                    for (var i=0;i<attributes.length;i++){
570
                                    for (var i=0;i<attributes.length;i++){
571
                                        var part = {};
571
                                        var part = {};
572
                                        var attr = attributes[i];
572
                                        var attr = attributes[i];
573
                                        var value = data.columns[col.idx].search.value;
574
                                        part[!attr.includes('.')?'me.'+attr:attr] = options.criteria === 'exact'
573
                                        part[!attr.includes('.')?'me.'+attr:attr] = options.criteria === 'exact'
575
                                            ? value
574
                                            ? value
576
                                            : {like: (['contains', 'ends_with'].indexOf(options.criteria) !== -1?'%':'') + value + (['contains', 'starts_with'].indexOf(options.criteria) !== -1?'%':'')};
575
                                            : {like: (['contains', 'ends_with'].indexOf(options.criteria) !== -1?'%':'') + value + (['contains', 'starts_with'].indexOf(options.criteria) !== -1?'%':'')};
Lines 586-592 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
586
                                    return col.bSearchable && typeof col.data == 'string' && data.columns[col.idx].search.value != ''
585
                                    return col.bSearchable && typeof col.data == 'string' && data.columns[col.idx].search.value != ''
587
                                })
586
                                })
588
                                .map(function(col) {
587
                                .map(function(col) {
589
                                    return build_query(col)
588
                                    var value = data.columns[col.idx].search.value;
589
                                    return build_query(col, value)
590
                                })
590
                                })
591
                                .map(function r(e){
591
                                .map(function r(e){
592
                                    return ($.isArray(e) ? $.map(e, r) : e);
592
                                    return ($.isArray(e) ? $.map(e, r) : e);
Lines 598-604 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
598
                                    return col.bSearchable && typeof col.data == 'string' && data.columns[col.idx].search.value == '' && filter != ''
598
                                    return col.bSearchable && typeof col.data == 'string' && data.columns[col.idx].search.value == '' && filter != ''
599
                                })
599
                                })
600
                                .map(function(col) {
600
                                .map(function(col) {
601
                                    return build_query(col)
601
                                    var value = filter;
602
                                    return build_query(col, value)
602
                                })
603
                                })
603
                                .map(function r(e){
604
                                .map(function r(e){
604
                                    return ($.isArray(e) ? $.map(e, r) : e);
605
                                    return ($.isArray(e) ? $.map(e, r) : e);
605
- 

Return to bug 20212