Bug 23268: Make "Suspend all holds" calendar select a date from tomorrow
authorEmmi <emmi.takkinen@outlook.com>
Fri, 5 Jul 2019 08:46:15 +0000 (11:46 +0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 10 Mar 2020 15:20:19 +0000 (15:20 +0000)
This patch removes "circulation" and moremember" templates functions
for Datepicker plugin. They now use options common for all inputs with
"datepicker" class and get "minDate" option from class "futuredate" assigned
function in "calender.inc".

To test:
- Apply patch
- Add holds for patron
- Use "Suspend all holds" calendar
=>Calendar greys out dates past from today

Signed-off-by: David Roberts <david.roberts@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc
koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt
koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt

index 1cd41e2..9b266b6 100644 (file)
@@ -176,6 +176,10 @@ $("#dateofbirth").datepicker({
         yearRange: "c-100:c"
     });
 
+    $(".futuredate").datepicker({
+        minDate: 1, // require that hold suspended until date is after today
+    });
+
     $( ".datepicker" ).datepicker({
         onClose: function(dateText, inst) {
             validate_date(dateText, inst);
index e969656..718ad01 100644 (file)
 
                                             [% IF Koha.Preference('AutoResumeSuspendedHolds') %]
                                             <label for="suspend_until">until</label>
-                                            <input type="text" size="10" id="suspend_until" name="suspend_until" class="datepicker"/>
+                                            <input type="text" size="10" id="suspend_until" name="suspend_until" class="datepicker futuredate"/>
                                             <span class="hint">Specify date on which to resume [% INCLUDE 'date-format.inc' %]: </span>
                                              [% END %]
                                         </form>
                 toggle_onsite_checkout();
             });
 
-            $("#suspend_until").datepicker({
-                onClose: function(dateText, inst) {
-                    validate_date(dateText, inst);
-                },
-                minDate: 1, // require that hold suspended until date is after today
-            });
-
             [% IF HIGHHOLDS %]
                 [% IF !override_high_holds %]
                     $("input[name=duedatespec]:hidden").val('[% HIGHHOLDS.returndate | html %]');
index cfc2a0a..f8ec612 100644 (file)
 
                                                 [% IF Koha.Preference('AutoResumeSuspendedHolds') %]
                                                     <label for="suspend_until">until</label>
-                                                    <input type="text" size="10" id="suspend_until" name="suspend_until" class="datepicker"/>
+                                                    <input type="text" size="10" id="suspend_until" name="suspend_until" class="datepicker futuredate"/>
                                                     <span class="hint">Specify date on which to resume [% INCLUDE 'date-format.inc' %]: </span>
                                                 [% END %]
                                             </fieldset>
                 "bPaginate": false
             }));
 
-            $("#suspend_until").datepicker({
-                onClose: function(dateText, inst) {
-                    validate_date(dateText, inst);
-                },
-                minDate: 1, // require that hold suspended until date is after today
-            }).on("change", function(e, value) {
-                if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");}
-            });
 
             $("#view_restrictions").on("click",function(){
                 $('#debarments-tab-link').click();