Bugzilla – Attachment 153845 Details for
Bug 32559
Support formatted date for column filtering (DT)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32559: Add support for formatted date when filtering on a column
Bug-32559-Add-support-for-formatted-date-when-filt.patch (text/plain), 3.64 KB, created by
Martin Renvoize
on 2023-07-24 15:47:16 UTC
(
hide
)
Description:
Bug 32559: Add support for formatted date when filtering on a column
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2023-07-24 15:47:16 UTC
Size:
3.64 KB
patch
obsolete
>From e5c20b1c535cde7fe5bb0f63a885e6f10c8a3929 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 3 Jan 2023 18:00:13 +0100 >Subject: [PATCH] Bug 32559: Add support for formatted date when filtering on a > column > >When dates are displayed formatted (following the dateformat syspref) >in a DataTable table and that there is a filter for the column, we should >filter correctly the data. > >Test plan: >Assuming dateformat is set to metric >Go to the main patron search, search for all patrons (don't provide a >search term) >In the "date of birth" column filter, enter "1958", notice that you see >Henry >Search using an iso formatted date 1958-05-30 >Search using a metric formatted date 30/05/1958 > >Note that: >- it's also working for "Expires on" on the same table. We may want to >adjust other tables that are using the DT REST API wrapper and the >column filters >- You need to search for the full formatted date to make it work. >"30/05" won't work. > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > .../intranet-tmpl/prog/en/includes/patron-search.inc | 4 ++-- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 8 ++++++-- > 2 files changed, 8 insertions(+), 4 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >index 3c1ce6fe2c..4f24c88338 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc >@@ -149,14 +149,14 @@ > [% SWITCH column %] > [% CASE 'checkbox' %]<th class="noExport"></th> > [% CASE 'cardnumber' %]<th>Card</th> >- [% CASE 'dateofbirth' %]<th>Date of birth</th> >+ [% CASE 'dateofbirth' %]<th data-datatype="date">Date of birth</th> > [% CASE 'name' %]<th>Name</th> > [% CASE 'name-address' %]<th>Name</th> > [% CASE 'address' %]<th>Address</th> > [% CASE 'address-library' %]<th>Address</th> > [% CASE 'branch' %]<th data-filter="libraries">Library</th> > [% CASE 'category' %]<th data-filter="categories">Category</th> >- [% CASE 'dateexpiry' %]<th>Expires on</td> >+ [% CASE 'dateexpiry' %]<th data-datatype="date">Expires on</td> > [% CASE 'borrowernotes' %]<th>Notes</th> > [% CASE 'phone' %]<th>Phone</th> > [% CASE 'checkouts' %]<th>Checkouts</th> >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 8d79a44253..f309e794bb 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -663,8 +663,12 @@ function _dt_default_ajax (params){ > > if(query_parameters.length) { > query_parameters = JSON.stringify(query_parameters.length === 1?query_parameters[0]:{"-and": query_parameters}); >- dataSet.q = query_parameters; >- delete options.query_parameters; >+ if(options.header_filter) { >+ options.query_parameters = query_parameters; >+ } else { >+ dataSet.q = query_parameters; >+ delete options.query_parameters; >+ } > } else { > delete options.query_parameters; > } >-- >2.41.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 32559
:
144951
|
144954
|
144977
|
145094
|
145095
|
145136
| 153845 |
153846
|
153847