Bugzilla – Attachment 153830 Details for
Bug 34226
Format dates from DT filters before querying the REST API
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34226: DT wrapper - pre-processed date term when filtering
Bug-34226-DT-wrapper---pre-processed-date-term-whe.patch (text/plain), 2.60 KB, created by
Martin Renvoize (ashimema)
on 2023-07-24 10:15:59 UTC
(
hide
)
Description:
Bug 34226: DT wrapper - pre-processed date term when filtering
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-07-24 10:15:59 UTC
Size:
2.60 KB
patch
obsolete
>From 0ee29ddbcf87311050f82b5d168e4936ec0e2eee Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 7 Jul 2023 15:11:44 +0200 >Subject: [PATCH] Bug 34226: DT wrapper - pre-processed date term when > filtering > >If we have filters on top of column on a table that is using the DT REST API wrapper, >we cannot filter on date using formatted dates. > >This was done for "date of birth" for bug 32505. >Here we want to provide a generic approach. > >Note that we cannot use what has been done on bug 22440 in some cases >(when we don't write the thead DOM directly but rely on DataTables >constructor, for instance bug 33568). The data- attributes are not >passed by DT. > >Test plan: >On top of 33568, filter date columns using the full version of the >formatted date > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > koha-tmpl/intranet-tmpl/prog/js/datatables.js | 16 ++++++++++++---- > 1 file changed, 12 insertions(+), 4 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >index 8d79a44253..9ee051d282 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js >@@ -562,12 +562,11 @@ function _dt_default_ajax (params){ > } > > let built_value; >+ let is_date_field; >+ > if ( col.datatype !== undefined ) { > if ( col.datatype == 'date' ) { >- let rfc3339 = $date_to_rfc3339(value); >- if ( rfc3339 != 'Invalid Date' ) { >- built_value = rfc3339; >- } >+ is_date_field = true; > } > else if (col.datatype == 'related-object') { > let query_term = value; >@@ -583,6 +582,15 @@ function _dt_default_ajax (params){ > } else { > console.log("datatype %s not supported yet".format(col.datatype)); > } >+ } else if (col.data && ( col.data.endsWith('_on') || col.data.endsWith('_date') ) ) { >+ is_date_field = true; >+ } >+ >+ if ( is_date_field ) { >+ let rfc3339 = $date_to_rfc3339(value); >+ if ( rfc3339 != 'Invalid Date' ) { >+ built_value = rfc3339; >+ } > } > > if (col.datatype != 'related-object') { >-- >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 34226
:
153180
|
153830
|
153831
|
153835
|
153862
|
153863
|
153864