From a96ef314f1784c6219570ed60cdefe23ed82b594 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 16 Nov 2021 16:46:44 +0000 Subject: [PATCH] Bug 29394: (follow-up) Pass correct time format and other corrections This patch makes a few corrections, including adding the correct Flatpickr date format option when the timepicker is enabled. Besides past and future date options, I've added a "pastinclusive" option which allows dates in the past OR today. This option was previously applied to the checkin page. The patch also corrects a couple of places where the wrong date field was modified with the new data attributes. To test, apply the patch and test the datepickers on the batch checkout and renew pages. When you select a date and time the "TimeFormat" system preference should be correctly applied. The calendar widget on the checkin page should allow you to select today's date. --- koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc | 4 ++++ .../prog/en/modules/circ/circulation_batch_checkouts.tt | 6 +----- koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt | 8 ++------ koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt | 2 +- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc index f67bffe3133..8489c25acab 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc @@ -93,11 +93,15 @@ options['minDate'] = new Date().fp_incr(1); options['allowInvalidPreload'] = true; } + if( $(this).data("flatpickr-pastinclusive") === true ) { + options['maxDate'] = "today"; + } if( $(this).data("flatpickr-pastdate") === true ) { options['maxDate'] = new Date().fp_incr(-1); } if ( $(this).data('flatpickr-enable-time') === true ) { options['enableTime'] = true; + options['dateFormat'] = flatpickr_dateformat_string + " " + flatpickr_timeformat_string; } $(this).flatpickr(options); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt index dc584eabdc4..7f05904fae4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt @@ -112,11 +112,7 @@
Due date: - [% IF Koha.Preference('SpecifyDueDate') %] - - [% ELSE %] - - [% END %] +
[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt index 499c09bd272..f01cfb8221d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt @@ -171,11 +171,7 @@ [% END %]
- [% IF Koha.Preference('SpecifyDueDate') %] - - [% ELSE %] - - [% END %] +
@@ -224,7 +220,7 @@
- +
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt index c234bd64ca4..c119c2708e0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -808,7 +808,7 @@
Specify return date [% INCLUDE 'date-format.inc' %]:
- +
[% IF ( return_date_override_remember ) %] -- 2.25.1