Bug 20600: (follow-up) Fix filtering
authorAndrew Isherwood <andrew.isherwood@ptfs-europe.com>
Wed, 6 Jun 2018 09:45:44 +0000 (10:45 +0100)
committerNick Clemens <nick@bywatersolutions.com>
Tue, 19 Feb 2019 16:36:43 +0000 (16:36 +0000)
There was a bug whereby filtering by date would fail if the selected
date syspref was set to dmydot or metric. Rather than use the display
date value, We now use the non-display date value that is always in
a predictable ISO8601 format to construct the Date objects used
for comparison.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt

index cfc5e59..fd7f78c 100644 (file)
                         { // Hide the two date columns we use just for sorting
                             'aTargets': [ 'placed', 'updated' ],
                             'bVisible': false,
-                            'bSearchable': false
+                            'bSearchable': true
                         },
                         { // When sorting 'placed', we want to use the
                           // unformatted column
 
                 // Custom date range filtering
                 $.fn.dataTable.ext.search.push(function(settings, data, dataIndex) {
+                    console.log(data);
                     var placedStart = $('#illfilter_dateplaced_start').datepicker('getDate');
                     var placedEnd = $('#illfilter_dateplaced_end').datepicker('getDate');
                     var modifiedStart = $('#illfilter_datemodified_start').datepicker('getDate');
                     var modifiedEnd = $('#illfilter_datemodified_end').datepicker('getDate');
-                    var rowPlaced = data[8] ? new Date(data[8]) : null;
-                    var rowModified = data[10] ? new Date(data[10]) : null;
+                    var rowPlaced = data[7] ? new Date(data[7]) : null;
+                    var rowModified = data[9] ? new Date(data[9]) : null;
                     var placedPassed = true;
                     var modifiedPassed = true;
                     if (placedStart && rowPlaced && rowPlaced < placedStart) {