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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/search.tt (-2 / +2 lines)
Lines 344-354 Link Here
344
                [% CASE 'branch' %]
344
                [% CASE 'branch' %]
345
                    let library_id = $("#branchcode_filter").val();
345
                    let library_id = $("#branchcode_filter").val();
346
                    patrons_table.find('thead tr:eq(1) th[data-filter="libraries"] select').val(library_id);
346
                    patrons_table.find('thead tr:eq(1) th[data-filter="libraries"] select').val(library_id);
347
                    table_dt.column([% loop.count - 1 %]).search(library_id);
347
                    table_dt.column([% loop.count - 1 %]).search(library_id ? '^'+library_id+'$' : '');
348
                [% CASE 'category' %]
348
                [% CASE 'category' %]
349
                    let category_id = $("#categorycode_filter").val();
349
                    let category_id = $("#categorycode_filter").val();
350
                    patrons_table.find('thead tr:eq(1) th[data-filter="categories"] select').val(category_id);
350
                    patrons_table.find('thead tr:eq(1) th[data-filter="categories"] select').val(category_id);
351
                    table_dt.column([% loop.count - 1 %]).search(category_id);
351
                    table_dt.column([% loop.count - 1 %]).search(category_id ? '^'+category_id+'$' : '');
352
                [% END %]
352
                [% END %]
353
            [% END %]
353
            [% END %]
354
            table_dt.search("");
354
            table_dt.search("");
(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-7 / +18 lines)
Lines 566-574 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
566
                                    for (var i=0;i<attributes.length;i++){
566
                                    for (var i=0;i<attributes.length;i++){
567
                                        var part = {};
567
                                        var part = {};
568
                                        var attr = attributes[i];
568
                                        var attr = attributes[i];
569
                                        part[!attr.includes('.')?'me.'+attr:attr] = options.criteria === 'exact'
569
                                        let criteria = options.criteria;
570
                                        if ( value.match(/^\^(.*)\$$/) ) {
571
                                            value = value.replace(/^\^/, '').replace(/\$$/, '');
572
                                            criteria = "exact";
573
                                        }
574
                                        part[!attr.includes('.')?'me.'+attr:attr] = criteria === 'exact'
570
                                            ? value
575
                                            ? value
571
                                            : {like: (['contains', 'ends_with'].indexOf(options.criteria) !== -1?'%':'') + value + (['contains', 'starts_with'].indexOf(options.criteria) !== -1?'%':'')};
576
                                            : {like: (['contains', 'ends_with'].indexOf(criteria) !== -1?'%':'') + value + (['contains', 'starts_with'].indexOf(criteria) !== -1?'%':'')};
572
                                        parts.push(part);
577
                                        parts.push(part);
573
                                    }
578
                                    }
574
                                    return parts;
579
                                    return parts;
Lines 847-856 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
847
852
848
                    $( input_type, this ).on( 'keyup change', function () {
853
                    $( input_type, this ).on( 'keyup change', function () {
849
                        if ( table_dt.column(i).search() !== this.value ) {
854
                        if ( table_dt.column(i).search() !== this.value ) {
850
                            table_dt
855
                            if ( input_type == "input" ) {
851
                                .column(i)
856
                                table_dt
852
                                .search( this.value )
857
                                    .column(i)
853
                                .draw();
858
                                    .search( this.value )
859
                                    .draw();
860
                            } else {
861
                                table_dt
862
                                    .column(i)
863
                                    .search( '^'+this.value+'$', true, false )
864
                                    .draw();
865
                            }
854
                        }
866
                        }
855
                    } );
867
                    } );
856
                } else {
868
                } else {
857
- 

Return to bug 30055