Bug 5698: Add date picker option to SQL Runtime Parameters
[koha.git] / reports / guided_reports.pl
index f5667a2..ce9370a 100755 (executable)
@@ -420,7 +420,21 @@ elsif ($phase eq 'Run this report'){
         for(my $i=0;$i<($#split/2);$i++) {
             my ($text,$authorised_value) = split /\|/,$split[$i*2+1];
             my $input;
-            if ($authorised_value) {
+            if ($authorised_value eq "date") {
+               $input = qq(<input id="date_$text" type="text" value="" size="10" name="sql_params">
+                         <img id="date_picker_$text" alt="Show Calendar" src="/intranet-tmpl/prog/en/lib/calendar/cal.gif">
+                         <script type="text/javascript">
+                              Calendar.setup(
+                              {
+                                 inputField : "date_$text",
+                                 ifFormat : "%Y-%m-%d",
+                                 button : "date_picker_$text"
+                              }
+                              );
+                         </script>
+                         );
+            }
+            elsif ($authorised_value) {
                 my $dbh=C4::Context->dbh;
                 my @authorised_values;
                 my %authorised_lib;
@@ -539,7 +553,7 @@ elsif ($phase eq 'Run this report'){
 }
 
 elsif ($phase eq 'Export'){
-    binmode STDOUT, ':utf8';
+    binmode STDOUT, ':encoding(UTF-8)';
 
        # export results to tab separated text or CSV
        my $sql    = $input->param('sql');  # FIXME: use sql from saved report ID#, not new user-supplied SQL!