Bug 29735: Remove flatpickr init from categories.js and holds.js
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 20 Dec 2021 11:02:45 +0000 (12:02 +0100)
committerFridolin Somers <fridolin.somers@biblibre.com>
Fri, 14 Jan 2022 02:37:33 +0000 (16:37 -1000)
Same as bug 29394, we want the flatpickr instanciations be done at the
same place, from calendar.inc. That way they will all behave
identically.

Test plan:
Edit a patron category and confirm that the "until date" calendar has
the "yesterday" and "today" dates disabled

Place a hold on an item, go to the patron detail page, click the "holds"
tab, suspend.
That should trigger a modal that will display a calendar with
"yesterday" and "today" dates disabled

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
koha-tmpl/intranet-tmpl/prog/en/modules/admin/categories.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt
koha-tmpl/intranet-tmpl/prog/en/modules/reserve/request.tt
koha-tmpl/intranet-tmpl/prog/js/categories.js
koha-tmpl/intranet-tmpl/prog/js/holds.js

index 9b1d6bf..a5e5b8e 100644 (file)
                             </li>
                             <li>
                                 <label for="enrolmentperioddate">Until date: </label>
-                                <input type="text" class="enrollmentperiod" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
+                                <input type="text" class="enrollmentperiod flatpickr" data-flatpickr-futuredate="true" name="enrolmentperioddate" id="enrolmentperioddate" value="[% category.enrolmentperioddate | $KohaDates %]" />
                             </li>
                         </ol>
                     </fieldset>
index 853cac2..951c3e1 100644 (file)
     [% INCLUDE 'datatables.inc' %]
     [% Asset.js("lib/jquery/plugins/rowGroup/dataTables.rowGroup.min.js") | $raw %]
     [% INCLUDE 'columns_settings.inc' %]
-    [% INCLUDE 'calendar.inc' %]
     [% Asset.js("lib/jquery/plugins/jquery-ui-timepicker-addon.min.js") | $raw %]
     [% INCLUDE 'timepicker.inc' %]
     [% INCLUDE 'select2.inc' %]
     [% Asset.js("js/pages/circulation.js") | $raw %]
     [% Asset.js("js/checkouts.js") | $raw %]
     [% Asset.js("js/holds.js") | $raw %]
+    [% INCLUDE 'calendar.inc' %]
     [% INCLUDE 'str/members-menu.inc' %]
     [% Asset.js("js/members-menu.js") | $raw %]
     <script>
index 442c489..7d89d9f 100644 (file)
 
 [% MACRO jsinclude BLOCK %]
     [% INCLUDE 'datatables.inc' %]
-    [% INCLUDE 'calendar.inc' %]
     [% INCLUDE 'columns_settings.inc' %]
     [% Asset.js("lib/hc-sticky.js") | $raw %]
     [% Asset.js("js/circ-patron-search-results.js") | $raw %]
     [% INCLUDE 'select2.inc' %]
     [% Asset.js("js/holds.js") | $raw%]
+    [% INCLUDE 'calendar.inc' %]
     <script>
         var Sticky;
         var biblionumber = "[% biblionumber | $raw %]";
index 3ef44c3..c3c1c85 100644 (file)
@@ -38,10 +38,6 @@ $(document).ready(function() {
         "exportColumns": [0,1,2,3,4,5,6,7,8,9,10,11,12],
     }, columns_settings);
 
-    $("#enrolmentperioddate").flatpickr({
-        minDate: new Date().fp_incr(1)
-    });
-
     if ($("#branches option:selected").length < 1) {
         $("#branches option:first").attr("selected", "selected");
     }
index 2e3e8dc..20ada49 100644 (file)
@@ -384,7 +384,7 @@ $(document).ready(function() {
                     <input type='hidden' id='suspend-modal-reserve_id' name='reserve_id' />\
 \
                     <label for='suspend-modal-until'>" + __("Suspend until:") + "</label>\
-                    <input name='suspend_until' id='suspend-modal-until' class='suspend-until' size='10' />\
+                    <input name='suspend_until' id='suspend-modal-until' class='suspend-until flatpickr' data-flatpickr-futuredate='true' size='10' />\
 \
                     <p><a class='btn btn-link' id='suspend-modal-clear-date' >" + __("Clear date to suspend indefinitely") + "</a></p>\
 \
@@ -400,9 +400,6 @@ $(document).ready(function() {
         </div>\
     ");
 
-    $("#suspend-modal-until").flatpickr({
-        minDate: new Date().fp_incr(1) // Require that "until date" be in the future
-    });
     $("#suspend-modal-clear-date").on( "click", function() { $("#suspend-modal-until").val(""); } );
 
     $("#suspend-modal-submit").on( "click", function( e ) {