Bugzilla – Attachment 151560 Details for
Bug 33804
Implement as_due_date for $date (js-date-format)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33804: Use as_due_date to display due dates
Bug-33804-Use-asduedate-to-display-due-dates.patch (text/plain), 6.48 KB, created by
Jonathan Druart
on 2023-05-23 11:02:10 UTC
(
hide
)
Description:
Bug 33804: Use as_due_date to display due dates
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-05-23 11:02:10 UTC
Size:
6.48 KB
patch
obsolete
>From 3d1b7f41bc674a047d4d39dbe57dd5b5c69eb821 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 23 May 2023 12:16:55 +0200 >Subject: [PATCH] Bug 33804: Use as_due_date to display due dates > >--- > .../prog/en/includes/js-date-format.inc | 5 +++-- > .../prog/en/modules/catalogue/detail.tt | 2 +- > .../prog/en/modules/circ/circulation.tt | 1 + > koha-tmpl/intranet-tmpl/prog/js/checkouts.js | 17 +++++++++-------- > svc/checkouts | 12 ------------ > 5 files changed, 14 insertions(+), 23 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc >index 640fa5c90c2..06fdcb67f1a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc >@@ -42,9 +42,10 @@ > */ > window.$date = function(value, options) { > if(!value) return ''; >- var tz = (options&&options.tz)||def_tz; >+ let tz = (options&&options.tz)||def_tz; >+ let no_tz_adjust = (options&&options.no_tz_adjust)||false; > var m = dayjs(value); >- if ( ! value.match(/^\d{4}-\d{2}-\d{2}$/ ) ) { >+ if ( !no_tz_adjust && ! value.match(/^\d{4}-\d{2}-\d{2}$/ ) ) { > m = m.tz(tz); > } > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index 351a48aa317..c543cc34494 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -2385,7 +2385,7 @@ > } > } > nodes += ': '; >- nodes += _("due %s").format($date(row.checkout.due_date)); [%# FIXME Missing due date formatting here, $date do not have as_due_date option %] >+ nodes += _("due %s").format($date(row.checkout.due_date, { as_due_date: true })); > nodes += "</span>" > } else if ( row.transfer ) { > if ( row.transfer.datesent ) { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >index 6fc4e740c57..4877d6d1e18 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt >@@ -1036,6 +1036,7 @@ > [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %] > [% PROCESS 'modal-claims.inc' %] > [% PROCESS 'modal-claims-js' %] >+ [% INCLUDE 'js-date-format.inc' %] > > <script> > /* Set some variable needed in circulation.js */ >diff --git a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >index 534fec1cdaa..e35a6296716 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/checkouts.js >@@ -299,10 +299,10 @@ $(document).ready(function() { > { > "iDataSort": 2, // Sort on hidden unformatted date due column > "mDataProp": function( oObj ) { >- var due = oObj.date_due_formatted; >- if ( oObj.date_due_overdue ) { >- due = "<span class='overdue'>" + due + "</span>"; >- } >+ let date_due_formatted = $datetime(oObj.date_due, { as_due_date: true, no_tz_adjust: true }); >+ var due = oObj.date_due_overdue >+ ? "<span class='overdue'>" + date_due_formatted + "</span>" >+ : date_due_formatted; > > due = "<span id='date_due_" + oObj.itemnumber + "' class='date_due'>" + due + "</span>"; > >@@ -417,7 +417,7 @@ $(document).ready(function() { > }, > { > "iDataSort": 10, // Sort on hidden unformatted issuedate column >- "mDataProp": "issuedate_formatted", >+ "mDataProp": "issuedate", > }, > { > "mDataProp": function ( oObj ) { >@@ -720,10 +720,11 @@ $(document).ready(function() { > "mDataProp": function( oObj ) { > var today = new Date(); > var due = new Date( oObj.date_due ); >+ let date_due_formatted = $datetime(oObj.date_due, { as_due_date: true, no_tz_adjust: true }); > if ( today > due ) { >- return "<span class='overdue'>" + oObj.date_due_formatted + "</span>"; >+ return "<span class='overdue'>" + date_due_formatted + "</span>"; > } else { >- return oObj.date_due_formatted; >+ return date_due_formatted; > } > } > }, >@@ -813,7 +814,7 @@ $(document).ready(function() { > }, > { > "iDataSort": 7, // Sort on hidden unformatted issuedate column >- "mDataProp": "issuedate_formatted", >+ "mDataProp": "issuedate", > }, > { > "mDataProp": function ( oObj ) { >diff --git a/svc/checkouts b/svc/checkouts >index bf5399aea20..6bb33d1404e 100755 >--- a/svc/checkouts >+++ b/svc/checkouts >@@ -288,18 +288,6 @@ while ( my $c = $sth->fetchrow_hashref() ) { > return_claim_created_on_formatted => $c->{return_claim_created_on} ? output_pref({ dt => dt_from_string( $c->{return_claim_created_on} ) }) : undef, > return_claim_updated_on_formatted => $c->{return_claim_updated_on} ? output_pref({ dt => dt_from_string( $c->{return_claim_updated_on} ) }) : undef, > >- issuedate_formatted => output_pref( >- { >- dt => dt_from_string( $c->{issuedate} ), >- as_due_date => 1 >- } >- ), >- date_due_formatted => output_pref( >- { >- dt => dt_from_string( $c->{date_due} ), >- as_due_date => 1 >- } >- ), > lost => $lost, > claims_returned => $claims_returned, > damaged => $damaged, >-- >2.25.1
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 33804
:
151559
|
151560
|
151561
|
151666
|
151667
|
151668
|
153418
|
153419
|
153420