Bug 24163: Allow to define CSV profile for late orders export
[srvgit] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / holidays.tt
index 4ad136e..f7771c0 100644 (file)
@@ -5,7 +5,6 @@
 [% INCLUDE 'doc-head-open.inc' %]
 <title>Koha &rsaquo; Tools &rsaquo; [% Branches.GetName( branch ) | html %] calendar</title>
 [% INCLUDE 'doc-head-close.inc' %]
-[% Asset.css("css/datatables.css") | $raw %]
 <style> .key { padding : 3px; white-space:nowrap; line-height:230%; }
 .ui-datepicker { font-size : 150%; }
 .ui-datepicker th, .ui-datepicker .ui-datepicker-title select { font-size : 80%; }
@@ -516,22 +515,45 @@ td.repeatableyearly a.ui-state-default {  background:  #FFCC66 none; color :  Bl
             $("a.helptext").click(function(){
                 $(this).parent().find(".hint").toggle(); return false;
             });
-            $("#dateofrange").datepicker();
+            $("#dateofrange").datepicker({
+                beforeShow: function() {
+                    var startdate = $("#jcalendar-container").datepicker("getDate");
+                    if (startdate !== null) {
+                        var sd = new Date(startdate);
+                        var ed = new Date($(this).datepicker("getDate"));
+                        if (ed < sd) {
+                            $(this).datepicker("setDate", startdate);
+                            $(this).datepicker("option", "defaultDate", startdate);
+                        }
+                    }
+                }
+            });
             $("#datecancelrange").datepicker();
             $("#dateofrange").each(function () { this.value = "" });
             $("#datecancelrange").each(function () { this.value = "" });
             $("#jcalendar-container").datepicker({
-              beforeShowDay: function(thedate) {
-                var day = thedate.getDate();
-                var month = thedate.getMonth() + 1;
-                var year = thedate.getFullYear();
-                var dateString = year + '/' + month + '/' + day;
-                return dateStatusHandler(dateString);
+                beforeShowDay: function(thedate) {
+                    var day = thedate.getDate();
+                    var month = thedate.getMonth() + 1;
+                    var year = thedate.getFullYear();
+                    var dateString = year + '/' + month + '/' + day;
+                    return dateStatusHandler(dateString);
+                },
+                onSelect: function(dateText, inst) {
+                    dateChanged($(this).datepicker("getDate"));
+                    var enddate = $("#dateofrange").datepicker("getDate");
+                    $("#dateofrange").datepicker("option", "defaultDate", $(this).datepicker("getDate"));
+                    $("#dateofrange").datepicker( "option", "minDate", $(this).datepicker("getDate")); //ensure end date can't be before start date
+                    if (enddate !== null) {
+                        var ed = new Date(enddate);
+                        var sd = new Date($(this).datepicker("getDate"));
+                        if (ed < sd) {
+                            $("#dateofrange").datepicker("setDate", $(this).datepicker("getDate"));
+                            $("#dateofrange").datepicker("option", "defaultDate", enddate);
+                        }
+                    }
                 },
-            onSelect: function(dateText, inst) {
-                dateChanged($(this).datepicker("getDate"));
-            },
-            defaultDate: new Date("[% keydate | html %]")
+                defaultDate: new Date("[% keydate | html %]")
             });
             $(".hidePanel").on("click",function(){
                 if( $(this).hasClass("showHoliday") ){