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 <caroline.cyr-la-rose@inlibro.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1156b3683b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Owen Leonard 2023-07-21 11:38:32 +00:00 committed by Fridolin Somers
parent 6f9dd5e449
commit b72c5e9465
2 changed files with 18 additions and 4 deletions

View File

@ -15,6 +15,8 @@
<th class="return-claim-record-title anti-the">Title</th>
<th class="return-claim-notes">Notes</th>
<th class="return-claim-created-on">Created on</th>
<th class="return-claim-created-on">Created on</th>
<th class="return-claim-updated-on">Updated on</th>
<th class="return-claim-updated-on">Updated on</th>
<th class="return-claim-resolution">Resolution</th>
<th class="return-claim-actions NoSort">&nbsp;</th>

View File

@ -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 "";
}