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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc (+2 lines)
Lines 431-436 Link Here
431
                            [% CASE 'dateofbirth' %]
431
                            [% CASE 'dateofbirth' %]
432
                            {
432
                            {
433
                                "data": "date_of_birth",
433
                                "data": "date_of_birth",
434
                                "type": "date",
434
                                "searchable": true,
435
                                "searchable": true,
435
                                "orderable": true,
436
                                "orderable": true,
436
                                "render": function( data, type, row, meta ) {
437
                                "render": function( data, type, row, meta ) {
Lines 552-557 Link Here
552
                            [% CASE 'dateexpiry' %]
553
                            [% CASE 'dateexpiry' %]
553
                            {
554
                            {
554
                                "data": "expiry_date",
555
                                "data": "expiry_date",
556
                                "type": "date",
555
                                "searchable": true,
557
                                "searchable": true,
556
                                "orderable": true,
558
                                "orderable": true,
557
                                "render": function( data, type, row, meta ) {
559
                                "render": function( data, type, row, meta ) {
(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-10 / +24 lines)
Lines 508-522 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
508
508
509
    /**
509
    /**
510
    * Create a new dataTables instance that uses the Koha RESTful API's as a data source
510
    * Create a new dataTables instance that uses the Koha RESTful API's as a data source
511
    * @param  {Object}  options         Please see the dataTables documentation for further details
511
    * @param  {Object}  options                      Please see the dataTables settings documentation for further
512
    *                                   We extend the options set with the `criteria` key which allows
512
    *                                                details
513
    *                                   the developer to select the match type to be applied during searches
513
    * @param  {string}  [options.criteria=contains]  A koha specific extension to the dataTables settings block that
514
    *                                   Valid keys are: `contains`, `starts_with`, `ends_with` and `exact`
514
    *                                                allows setting the 'comparison operator' used in searches
515
    * @param  {Object}  table_settings The arrayref as returned by TableSettings.GetTableSettings function available
515
    *                                                Supports `contains`, `starts_with`, `ends_with` and `exact` match
516
    *                                   from the columns_settings template toolkit include
516
    * @param  {string}  [options.columns.*.type      Data type the field is stored in so we may impose some additional 
517
    * @param  {Boolean} add_filters     Add a filters row as the top row of the table
517
    *                                                manipulation to search strings. Supported types are currenlty 'date'
518
    * @param  {Object}  default_filters Add a set of default search filters to apply at table initialisation
518
    * @param  {Object}  table_settings               The arrayref as returned by TableSettings.GetTableSettings function
519
    * @return {Object}                  The dataTables instance
519
    *                                                available from the columns_settings template toolkit include
520
    * @param  {Boolean} add_filters                  Add a filters row as the top row of the table
521
    * @param  {Object}  default_filters              Add a set of default search filters to apply at table initialisation
522
    * @return {Object}                               The dataTables instance
520
    */
523
    */
521
    $.fn.kohaTable = function(options, table_settings, add_filters, default_filters) {
524
    $.fn.kohaTable = function(options, table_settings, add_filters, default_filters) {
522
        var settings = null;
525
        var settings = null;
Lines 601-606 jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { Link Here
601
                                            ? value
604
                                            ? value
602
                                            : {like: (['contains', 'ends_with'].indexOf(criteria) !== -1?'%':'') + value + (['contains', 'starts_with'].indexOf(criteria) !== -1?'%':'')};
605
                                            : {like: (['contains', 'ends_with'].indexOf(criteria) !== -1?'%':'') + value + (['contains', 'starts_with'].indexOf(criteria) !== -1?'%':'')};
603
                                        parts.push(part);
606
                                        parts.push(part);
607
608
                                        // Alternate manipulated query based on type
609
                                        let type = col.type;
610
                                        if ( type === 'date' ) {
611
                                            try {
612
                                                let d = $date_to_rfc3339(value);
613
                                                parts.push({[!attr.includes('.')?'me.'+attr:attr]:d});
614
                                            }
615
                                            catch {
616
                                                // Hide the warning if the date is not correct
617
                                            };
618
                                        }
604
                                    }
619
                                    }
605
                                    return parts;
620
                                    return parts;
606
                                }
621
                                }
607
- 

Return to bug 32505