From 0b6456b8f88d4f284ca44d23111b58cacf6b6536 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 21 Jul 2023 11:38:32 +0000 Subject: [PATCH] Bug 25023: Claims returned dates not formatted according to dateformat preference This patch updates the code for rendering the claims returned table on the checkout and patron detail pages. Now the dates are formatted using the global js-date-format.inc code. To test, apply the patch and make sure the claims returned feature is enabled by setting a value in the ClaimReturnedLostValue system preference. - Check out some items to a patron. - Under the checkouts tab, mark several checkouts as "Claim returned." - Open the claims tab. - The dates in the "Created on" column should be formatted according to your dateformat system preference. - Change the dateformat preference and return to the checkouts page. Confirm that the claims tab shows dates formatted correctly. - The "created on" and "updated on" columns should sort correctly with any dateformat setting. You may have to directly modify the dates in the database in order to have the right data for testing this. Signed-off-by: Caroline Cyr La Rose Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 1156b3683b7231560c18e8001fc97777d007c899) Signed-off-by: Fridolin Somers (cherry picked from commit b72c5e94655f18e2eebaf6fc4df3dc330fda3379) Signed-off-by: Matt Blenkinsop --- .../prog/en/includes/patron-return-claims.inc | 50 +++++++++---------- koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 20 ++++++-- 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-return-claims.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-return-claims.inc index 4aee20ccab..c0b40e6806 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-return-claims.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-return-claims.inc @@ -1,25 +1,25 @@ -
-

- [% IF ( patron.return_claims.resolved.count > 0 || patron.return_claims.unresolved.count > 0 ) %] - Show all [% patron.return_claims.count | html %] claim(s) - Show [% patron.return_claims.unresolved.count | html %] unresolved claims - [% ELSE %] - - - [% END %] -

- - - - - - - - - - - - - -
Claim IDResolved?TitleNotesCreated onUpdated onResolution 
-
+

+ [% IF ( patron.return_claims.resolved.count > 0 || patron.return_claims.unresolved.count > 0 ) %] + Show all [% patron.return_claims.count | html %] claim(s) + Show [% patron.return_claims.unresolved.count | html %] unresolved claims + [% ELSE %] + + + [% END %] +

+ + + + + + + + + + + + + + + +
Claim IDResolved?TitleNotesCreated onCreated onUpdated onUpdated onResolution 
diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js index 534fec1cda..305ff0d151 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js +++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js @@ -975,16 +975,28 @@ $(document).ready(function() { } }, { + "mDataProp": "created_on", + "bVisible": false, + }, + { + "orderData": 4, "mDataProp": function ( oObj ) { - let created_on = new Date( oObj.created_on ); - return created_on.toLocaleDateString(); + if ( oObj.created_on ) { + return $date(oObj.created_on, { no_tz_adjust: true });; + } else { + return ""; + } } }, { + "mDataProp": "updated_on", + "bVisible": false, + }, + { + "orderData": 6, "mDataProp": function ( oObj ) { if ( oObj.updated_on ) { - let updated_on = new Date( oObj.updated_on ); - return updated_on.toLocaleDateString(); + return $date(oObj.updated_on, { no_tz_adjust: true }); } else { return ""; } -- 2.39.5