From 5a67364da5f5a456904a9c4a1acd440b89705ed5 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 14 Mar 2022 14:32:31 +0000 Subject: [PATCH] Bug 30183: Fetch flatPickr instance prior to custom search definition This patch updates teh search customisations in ill-list-table to properly fetch the existing flatpickr instances for date searches. To test: 1. Have at least one ILL request on the ILL requests page 2. Open the broser inspector 3. Choose a date on the left hand form => FAIL: Errors in the console, search doesn't work 4. Apply this patch 5. Reload 6. Repeat 2-3 => SUCCESS: No more errors, filtering works! 7. Sign off :-D Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart Signed-off-by: Fridolin Somers --- koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js b/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js index 414bcf8f22..920d6aed68 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js +++ b/koha-tmpl/intranet-tmpl/prog/js/ill-list-table.js @@ -498,10 +498,10 @@ $(document).ready(function() { // Custom date range filtering $.fn.dataTable.ext.search.push(function(settings, data, dataIndex) { - var placedStart = illfilter_dateplaced_start.selectedDates[0]; - var placedEnd = illfilter_dateplaced_end.selectedDates[0]; - var modifiedStart = illfilter_datemodified_start.selectedDates[0]; - var modifiedEnd = illfilter_datemodified_end.selectedDates[0]; + var placedStart = $('#illfilter_dateplaced_start').get(0)._flatpickr.selectedDates[0]; + var placedEnd = $('#illfilter_dateplaced_end').get(0)._flatpickr.selectedDates[0]; + var modifiedStart = $('#illfilter_datemodified_start').get(0)._flatpickr.selectedDates[0]; + var modifiedEnd = $('#illfilter_datemodified_end').get(0)._flatpickr.selectedDates[0]; var rowPlaced = data[14] ? new Date(data[14]) : null; var rowModified = data[16] ? new Date(data[16]) : null; var placedPassed = true; -- 2.39.5