Browse Source

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.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.11/bug30761
Owen Leonard 2 years ago
committed by Jonathan Druart
parent
commit
8fb01c0453
  1. 4
      koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc
  2. 6
      koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt
  3. 8
      koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt
  4. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt

4
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);

6
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt

@ -112,11 +112,7 @@
<fieldset class="rows">
<legend>Due date: </legend>
<label for="duedatespec">Hard due date [% INCLUDE 'date-format.inc' %]:</label>
[% IF Koha.Preference('SpecifyDueDate') %]
<input type="text" size="20" id="duedatespec" name="duedatespec" value="[% duedatespec | $KohaDates with_hours => 1 %]" class="flatpickr" data-flatpickr-enable-time="true" />
[% ELSE %]
<input type="text" size="20" id="duedatespec" name="duedatespec" value="[% duedatespec | $KohaDates with_hours => 1 %]" />
[% END %]
<input type="text" size="20" id="duedatespec" name="duedatespec" value="[% duedatespec | $KohaDates with_hours => 1 %]" class="flatpickr" data-flatpickr-enable-time="true" />
</fieldset>
[% END %]
<input type="hidden" name="op" value="show" />

8
koha-tmpl/intranet-tmpl/prog/en/modules/circ/renew.tt

@ -171,11 +171,7 @@
[% END %]
<form method="get" action="/cgi-bin/koha/circ/renew.pl">
[% IF Koha.Preference('SpecifyDueDate') %]
<input type="hidden" name="hard_due_date" value="[% hard_due_date | html %]" class="flatpickr flatpickr-enable-time" />
[% ELSE %]
<input type="hidden" name="hard_due_date" value="[% hard_due_date | html %]" />
[% END %]
<input type="hidden" name="hard_due_date" value="[% hard_due_date | html %]" />
<button type="submit" class="deny"><i class="fa fa-times"></i> Continue without renewing</button>
</form>
</div>
@ -224,7 +220,7 @@
<div class="circ-settings show">
<div class="date-select" id="renew_date_override_fields">
<div><label for="hard_due_date" class="hint">Renewal due date [% INCLUDE 'date-format.inc' %]:</label></div>
<input type="text" size="20" id="hard_due_date" name="hard_due_date" value="[% hard_due_date | $KohaDates with_hours => 1 %]" />
<input type="text" size="20" id="hard_due_date" name="hard_due_date" value="[% hard_due_date | $KohaDates with_hours => 1 %]" class="flatpickr" data-flatpickr-futuredate="true" data-flatpickr-enable-time="true" />
</div> <!-- /.date-select -->
</div>
</fieldset>

2
koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt

@ -808,7 +808,7 @@
<div class="date-select" id="return_date_override_fields">
<div class="hint">Specify return date [% INCLUDE 'date-format.inc' %]: </div>
<input type="text" size="20" id="return_date_override" name="return_date_override" value="[% return_date_override | html %]" class="flatpickr" data-flatpickr-pastdate="true" data-flatpickr-enable-time="true" data-flatpickr-on-close-focus="#barcode" />
<input type="text" size="20" id="return_date_override" name="return_date_override" value="[% return_date_override | html %]" class="flatpickr" data-flatpickr-pastinclusive="true" data-flatpickr-enable-time="true" data-flatpickr-on-close-focus="#barcode" />
<div class="circ-setting">
[% IF ( return_date_override_remember ) %]

Loading…
Cancel
Save