Bug 28961: Use Flatpickr on tools pages

This patch replaces the use of jQueryUI's datepicker on tools pages.

To test, apply the patch and test the following tools pages to confirm
that datepickers work correctly. "Linked" date fields should prevent a
"to" selection which preceeds the selected "from" date.

 - News -> New entry: Linked fields "Published date" and "Expiration
   date".
 - Batch extend due dates: Linked fields "Due date from" and  "Due date
   to"; "Hard due date" field.
 - Batch patron deletion: "who have not borrowed since," "whose
   expiration date is before," and "Permanently delete checkout history
   older than."
 - Export: Linked "Start date" and "End date" fields.
 - Import patrons -> Enter default values: "Date of birth,"
   "Registration date," and "Expiry date."
 - Inventory: "Set inventory date to."
 - Batch patron modification -> Submit a batch of cardnumbers or a
   patron list: "Registration date," "Expiry date," and "Restriction
   expiration."
 - Task scheduler: "Date" field.
 - Log viewer: "Display from" and "Display to" linked fields.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Owen Leonard 2021-09-07 14:14:54 +00:00 committed by Jonathan Druart
parent cde87a34a1
commit 89dfbe654b
9 changed files with 21 additions and 24 deletions

View File

@ -199,12 +199,12 @@
[% END %]
<li>
<label for="from">Publication date: </label>
<input id="from" type="text" name="published_on" size="15" value="[% additional_content.published_on | html %]" class="datepickerfrom" />
<input id="from" type="text" name="published_on" size="15" value="[% additional_content.published_on | html %]" class="flatpickrfrom" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>
<label for="to">Expiration date: </label>
<input id="to" type="text" name="expirationdate" size="15" value="[% additional_content.expirationdate | html %]" class="datepickerto" />
<input id="to" type="text" name="expirationdate" size="15" value="[% additional_content.expirationdate | html %]" class="flatpickrto" />
<div class="hint">
[% INCLUDE 'date-format.inc' %]
[% IF category == 'news' %]

View File

@ -82,12 +82,12 @@
<li>
<label for="from_due_date">Due date from: </label>
<input type="text" size="10" id="from" name="from_due_date" class="datepickerfrom" />
<input type="text" size="10" id="from" name="from_due_date" class="flatpickrfrom" />
</li>
<li>
<label for="to_due_date">Due date to:</label>
<input type="text" size="10" id="to" name="to_due_date" class="datepickerto" />
<input type="text" size="10" id="to" name="to_due_date" class="flatpickrto" />
</li>
</ol>
</fieldset>
@ -96,7 +96,7 @@
<ol>
<li>
<label for="new_hard_due_date">Hard due date: </label>
<input type="text" size="10" id="new_hard_due_date" name="new_hard_due_date" class="datepicker" />
<input type="text" size="10" id="new_hard_due_date" name="new_hard_due_date" class="flatpickr" />
</li>
<li>

View File

@ -111,18 +111,18 @@
<ul>
<li>
<label for="date1">who have not borrowed since:</label>
<input size="10" id="date1" name="not_borrowed_since" type="text" class="datepicker" />
<input size="10" id="date1" name="not_borrowed_since" type="text" class="flatpickr" />
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
</li>
<li>
<label for="borrower_dateexpiry">whose expiration date is before:</label>
<input size="10" id="borrower_dateexpiry" name="borrower_dateexpiry" type="text" class="datepicker" />
<input size="10" id="borrower_dateexpiry" name="borrower_dateexpiry" type="text" class="flatpickr" />
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
</li>
[% IF Koha.Preference('TrackLastPatronActivity') %]
<li>
<label for="borrower_lastseen">who have not been connected since:</label>
<input size="10" id="borrower_lastseen" name="borrower_lastseen" type="text" class="datepicker" />
<input size="10" id="borrower_lastseen" name="borrower_lastseen" type="text" class="flatpickr" />
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
</li>
[% END %]
@ -161,7 +161,7 @@
<ul>
<li>
<label for="date2">Permanently delete checkout history older than</label>
<input size="10" id="date2" name="last_issue_date" type="text" class="datepicker" />
<input size="10" id="date2" name="last_issue_date" type="text" class="flatpickr" />
<span class="hint">[% INCLUDE 'date-format.inc' %]</span>
</li>
</ul>

View File

@ -110,11 +110,11 @@
<ol>
<li>
<label for="from">Start date:</label>
<input type="text" size="10" id="from" name="start_accession" value="[% from | html %]" class="datepickerfrom" />
<input type="text" size="10" id="from" name="start_accession" value="[% from | html %]" class="flatpickrfrom" />
</li>
<li>
<label for="to">End date:</label>
<input size="10" id="to" name="end_accession" value="[% end_accession | html %]" type="text" class="datepickerto" />
<input size="10" id="to" name="end_accession" value="[% end_accession | html %]" type="text" class="flatpickrto" />
</li>
</ol>
</fieldset>

View File

@ -409,7 +409,7 @@ you can supply dates in ISO format (e.g., '2010-10-28').
<script>
$(document).ready(function() {
[%# Make date fields have the datepicker %]
$("#dateenrolled, #dateexpiry, #dateofbirth").datepicker();
$("#dateenrolled, #dateexpiry, #dateofbirth").flatpickr();
$(".expand_defaults").click(function(e){
e.preventDefault();

View File

@ -84,7 +84,7 @@
<fieldset class="rows">
<legend>Parameters</legend>
<ol>
<li><label for="setdate">Set inventory date to:</label> <input type="text" id="setdate" name="setdate" value="[% today | $KohaDates %]" class="datepicker" disabled /></li>
<li><label for="setdate">Set inventory date to:</label> <input type="text" id="setdate" name="setdate" value="[% today | $KohaDates %]" class="flatpickr" /></li>
<li><label for="compareinv2barcd">Compare barcodes list to results: </label><input type="checkbox" name="compareinv2barcd" id="compareinv2barcd" disabled /></li>
<li><label for="dont_checkin">Do not check in items scanned during inventory: </label><input type="checkbox" name="dont_checkin" id="dont_checkin" disabled /></li>
<li><label for="out_of_order">Check barcodes list for items shelved out of order: </label><input type="checkbox" name="out_of_order" id="out_of_order" disabled /></li>

View File

@ -351,7 +351,7 @@
[% END %]
[% END %]
[% IF ( field.type == 'date' ) %]
<input type="text" name="[% field.name | html %]" id="[% field.name | html %]" value="" size="10" maxlength="10" class="datepicker" />
<input type="text" name="[% field.name | html %]" id="[% field.name | html %]" value="" size="10" maxlength="10" class="flatpickr" />
<a href="#" class="clear-date" id="clear-date-[% field.name | html %]" ><i class="fa fa-fw fa-trash"></i> Clear</a>
[% END %]
[% IF field.mandatory %]

View File

@ -44,9 +44,11 @@
[% time | html %]</li>
<li><label for="starttime">Time:</label>
<input type="text" name="starttime" id="starttime" value="" maxlength="5" size="5" /></li>
<li><label for="startdate">Date: </label> <input type="text" size="10" id="startdate" name="startdate" value="" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>
<label for="startdate">Date: </label>
<input type="text" size="10" id="startdate" name="startdate" class="flatpickr futuredate" value="" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li><label for="report">Report:</label>
<select name="report" id="report">
[% FOREACH savedreport IN savedreports %]
@ -109,11 +111,6 @@
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/tools-menu.js") | $raw %]
[% INCLUDE 'calendar.inc' %]
<script>
$(document).ready(function(){
$("#startdate").datepicker({ minDate: "+0D" });
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]

View File

@ -273,11 +273,11 @@
[% END %]
</li>
<li>
<label for="from"> Display from: </label> <input type="text" size="10" id="from" name="from" value="[% datefrom | html %]" class="datepickerfrom" />
<label for="from"> Display from: </label> <input type="text" size="10" id="from" name="from" value="[% datefrom | html %]" class="flatpickrfrom" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
<li>
<label for="to">Display to: </label> <input size="10" id="to" name="to" type="text" value="[% dateto | html %]" class="datepickerto" />
<label for="to">Display to: </label> <input size="10" id="to" name="to" type="text" value="[% dateto | html %]" class="flatpickrto" />
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
</ol>