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 562-570 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
562
                                    for (var i=0;i<attributes.length;i++){
562
                                    for (var i=0;i<attributes.length;i++){
563
                                        var part = {};
563
                                        var part = {};
564
                                        var attr = attributes[i];
564
                                        var attr = attributes[i];
565
                                        part[!attr.includes('.')?'me.'+attr:attr] = options.criteria === 'exact'
565
                                        let criteria = options.criteria;
566
                                        if ( value.match(/^\^(.*)\$$/) ) {
567
                                            value = value.replace(/^\^/, '').replace(/\$$/, '');
568
                                            criteria = "exact";
569
                                        }
570
                                        part[!attr.includes('.')?'me.'+attr:attr] = criteria === 'exact'
566
                                            ? value
571
                                            ? value
567
                                            : {like: (['contains', 'ends_with'].indexOf(options.criteria) !== -1?'%':'') + value + (['contains', 'starts_with'].indexOf(options.criteria) !== -1?'%':'')};
572
                                            : {like: (['contains', 'ends_with'].indexOf(criteria) !== -1?'%':'') + value + (['contains', 'starts_with'].indexOf(criteria) !== -1?'%':'')};
568
                                        parts.push(part);
573
                                        parts.push(part);
569
                                    }
574
                                    }
570
                                    return parts;
575
                                    return parts;
Lines 840-849 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
840
845
841
                    $( input_type, this ).on( 'keyup change', function () {
846
                    $( input_type, this ).on( 'keyup change', function () {
842
                        if ( table_dt.column(i).search() !== this.value ) {
847
                        if ( table_dt.column(i).search() !== this.value ) {
843
                            table_dt
848
                            if ( input_type == "input" ) {
844
                                .column(i)
849
                                table_dt
845
                                .search( this.value )
850
                                    .column(i)
846
                                .draw();
851
                                    .search( this.value )
852
                                    .draw();
853
                            } else {
854
                                table_dt
855
                                    .column(i)
856
                                    .search( '^'+this.value+'$', true, false )
857
                                    .draw();
858
                            }
847
                        }
859
                        }
848
                    } );
860
                    } );
849
                } else {
861
                } else {
850
- 

Return to bug 30055