From 98352d6985bef2977c166c3a8af9b9ea5d6fb049 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 11 Nov 2021 13:46:32 +0000 Subject: [PATCH] Bug 29459: Replace some missed datetimepickers in circulation templates with Flatpickr This patch updates a few more instances of jQueryUI datepickers which were missed initially, replacing them with Flatpickr widgets. Also changed: A few datetime input fields are updated to have a size of 20, consistent with other datetime input fields. To test, apply the patch and go to Circulation. Check in: - With the 'SpecifyReturnDate' system preference enabled, go to Check in. - Click the "Checkin settings" link. - Test the "Specify return date" field. Clicking it should trigger a Flatpickr widget with a time picker. It should limit your selection to dates in the past. - Check the "Remember return date" checkbox and confirm that the date is preserved over page reloads. - Check and uncheck the "Box drop mode" checkbox to confirm that the return date field is disabled and enabled correctly. Check out: - With the 'AllowRenewalOnHoldOverride' preference enabled, check out to a patron who has a checkout which is on hold for another patron. - At the bottom of the table of checkouts, click the "Override renewal restrictions" checkbox. - The on-hold checkouts should now have a checkbox in the "Renew" column. Check one or more of these checkboxes. - In the table footer you should now see two date inputs, "Renewal due date" and "On hold due date." These should both trigger Flatpickr widgets with time pickers. - Confirm that your date selections are submitted correctly when you renew items. ILL checkout: - Create a new ILL request with the type "book," filling in at least title, patron, and destination library. - On the "Manage ILL request" page, click "Confirm request" and "Confirm request" on the next confirmation page. - There should now be a "Check out" button in the "Manage ILL request" toolbar. Click it. - Test the "Due date" field. It should trigger a Flatpickr widget with a time picker. --- .../en/includes/checkouts-table-footer.inc | 4 +- .../prog/en/modules/circ/returns.tt | 50 ++++--------------- .../prog/en/modules/ill/ill-requests.tt | 10 ++-- .../prog/js/pages/circulation.js | 16 ++---- 4 files changed, 21 insertions(+), 59 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc index 46532078d0..bede364104 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/checkouts-table-footer.inc @@ -10,8 +10,8 @@ [% END %]
-

-

+

+

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 67a1a22109..b3d8c04e59 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/returns.tt @@ -808,11 +808,8 @@
Specify return date [% INCLUDE 'date-format.inc' %]:
- + - - -
[% IF ( return_date_override_remember ) %] @@ -1041,44 +1038,15 @@ "dom": 'B<"clearfix">t', }, columns_settings); - $("#return_date_override").datetimepicker({ - onClose: function(dateText, inst) { - if (validate_date(dateText, inst) ) { - $("#barcode").focus(); - } - }, - defaultDate: -1, - hour: 23, - minute: 59, - maxDate: 0 - }).on("change", function(e, value) { - if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");} - }); - $("#return_date_override").on("blur", function() { - check_valid_return_date(); - }); - $("#checkin-form").submit(function( event ) { - if ( !check_valid_return_date() ) { - event.preventDefault(); + $("#return_date_override").flatpickr({ + enableTime: true, + dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string, + maxDate: "today", + onClose: function() { + $("#barcode").focus(); } }); - function check_valid_return_date() { - if ( $("#return_date_override").val() ) { - var datetime = DateTime_from_syspref( $("#return_date_override").val() ); - var now = new Date(); - if ( !datetime || datetime > now ) { - alert("Invalid return date/time!"); - $("#return_date_override").val("") - return false; - } - } - // Add saved date information to onscreen message, which - // may or may not be hidden - $("#saved_return_date").text( $("#return_date_override").val() ); - return true; - } - $("#exemptcheck").change(function () { if (this.checked == true) { $("#barcode").addClass("input-warning"); @@ -1089,22 +1057,22 @@ } $("#barcode").focus(); }); + $("#dropboxcheck").change(function () { if (this.checked == true) { $("#barcode").addClass("input-warning"); $("#dropboxmode").show(); $("#return_date_override_fields :input").prop('disabled', true); - $("#return_date_override").datetimepicker("disable"); } else { $("#barcode").removeClass("input-warning"); $("#dropboxmode").hide(); $("#return_date_override_fields :input").prop('disabled', false); - $("#return_date_override").datetimepicker("enable"); } $("#barcode").focus(); }); + $("#forgivemanualholdsexpire").change(function () { if (this.checked == true) { $("#barcode").addClass("input-warning"); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt index 39dbd67819..a5889a10e6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/ill/ill-requests.tt @@ -839,12 +839,12 @@ var prefilters = '[% prefilters | $raw %]'; // Set column settings var columns_settings = [% TablesSettings.GetColumns( 'illrequests', 'ill-requests', 'ill-requests', 'json' ) %]; - $("#ill_checkout_duedate_input").datetimepicker({ - hour: 23, - minute: 59 - }).on("change", function(e, value) { - if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");} + + $("#ill_checkout_duedate_input").flatpickr({ + enableTime: true, + dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string, }); + [% IF services_json.length > 0 %] var services = [% services_json | $raw %]; [% ELSE %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js b/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js index 7a544ff2a4..cb63c56f0d 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js +++ b/koha-tmpl/intranet-tmpl/prog/js/pages/circulation.js @@ -29,17 +29,6 @@ $(document).ready(function() { radioCheckBox($(this)); }); - $("#newduedate, #newonholdduedate input").datetimepicker({ - onClose: function(dateText, inst) { - validate_date(dateText, inst); - }, - minDate: 1, // require that renewal date is after today - hour: 23, - minute: 59 - }).on("change", function(e) { - if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");} - }); - $("#duedatespec").flatpickr({ enableTime: true, dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string, @@ -48,6 +37,11 @@ $(document).ready(function() { } }); + $("#newduedate, #newonholdduedate input").flatpickr({ + enableTime: true, + dateFormat: flatpickr_dateformat_string + " " + flatpickr_timeformat_string, + }); + $(".clear_date").on("click", function(){ $("#stickyduedate").prop( "checked", false ); }); -- 2.20.1