Summary: | ILL table search filtering broken | ||
---|---|---|---|
Product: | Koha | Reporter: | Andrew Isherwood <bugzilla> |
Component: | ILL | Assignee: | Martin Renvoize (ashimema) <martin.renvoize> |
Status: | CLOSED FIXED | QA Contact: | |
Severity: | major | ||
Priority: | P3 | CC: | andreas.jonsson, aude.charillon, jake.deery, janet.mcgowan, jonathan.druart, kyle, lucy.vaux-harvey, martin.renvoize, nick, oleonard, susie.strachan, tomascohen |
Version: | Main | Keywords: | regression |
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
22.05.00,21.11.05
|
|
Circulation function: | |||
Bug Depends on: | 29240 | ||
Bug Blocks: | |||
Attachments: |
Bug 30183: Fetch flatPickr instance prior to custom search definition
Bug 30183: Fetch flatPickr instance prior to custom search definition Bug 30183: Fetch flatPickr instance prior to custom search definition |
Description
Andrew Isherwood
2022-02-25 15:02:28 UTC
Created attachment 131661 [details] [review] 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. Created attachment 131668 [details] [review] 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 <tomascohen@theke.io> Created attachment 131913 [details] [review] 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 <tomascohen@theke.io> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> It works but it's awkward. I was expecting to see $(selector).val() to retrieve the formatted value, then use one of our JS function to get a Date() object. Pushed to master for 22.05, thanks to everybody involved [U+1F984] I just fixed this issue for a production system that we recently upgraded to 21.11.03 and was going to report it when I found this bug report. I think it would be nicer to avoid unnecessarily referencing the flatpickr data directly: $.fn.dataTable.ext.search.push(function(settings, data, dataIndex) { const d = (s) => s ? new Date(s) : null; const t = (value, filter, test) => { da = d(value); if (!da) { return true; } const fv = $('#illfilter_' + filter).val(); db = d(fv); if (!db) { return true; } return test(da, db); }; return t(data[14], 'dateplaced_start', (a, b) => a >= b) && t(data[14], 'dateplaced_end', (a, b) => a <= b) && t(data[16], 'datemodified_start', (a, b) => a >= b) && t(data[16], 'datemodified_end', (a, b) => a <= b); }); Pushed to 21.11.x for 21.11.05 |