Bug 9587 : Followup removing a commented out warn that was annoying the qa tools
[koha.git] / reports / guided_reports.pl
index 00f52ef..23d85a9 100755 (executable)
@@ -501,7 +501,7 @@ elsif ( $phase eq 'Save Report' ) {
         );
     }
     else {
-        save_report( {
+        my $id = save_report( {
                 borrowernumber => $borrowernumber,
                 sql            => $sql,
                 name           => $name,
@@ -513,13 +513,17 @@ elsif ( $phase eq 'Save Report' ) {
                 cache_expiry   => $cache_expiry,
                 public         => $public,
             } );
-        $template->param( 'save_successful' => 1, );
+        $template->param(
+            'save_successful' => 1,
+            'reportname'      => $name,
+            'id'              => $id,
+        );
     }
 }
 
 elsif ($phase eq 'Run this report'){
     # execute a saved report
-    my $limit      = 20; # page size. # TODO: move to DB or syspref?
+    my $limit      = $input->param('limit') || 20;
     my $offset     = 0;
     my $report_id  = $input->param('reports');
     my @sql_params = $input->param('sql_params');
@@ -528,6 +532,11 @@ elsif ($phase eq 'Run this report'){
         $offset = ($input->param('page') - 1) * $limit;
     }
 
+    $template->param(
+        'limit'   => $limit,
+        'report_id' => $report_id,
+    );
+
     my ( $sql, $type, $name, $notes );
     if (my $report = get_saved_report($report_id)) {
         $sql   = $report->{savedsql};
@@ -650,7 +659,7 @@ elsif ($phase eq 'Run this report'){
             }
 
             my $totpages = int($total/$limit) + (($total % $limit) > 0 ? 1 : 0);
-            my $url = "/cgi-bin/koha/reports/guided_reports.pl?reports=$report_id&phase=Run%20this%20report";
+            my $url = "/cgi-bin/koha/reports/guided_reports.pl?reports=$report_id&phase=Run%20this%20report&limit=$limit";
             if (@sql_params) {
                 $url = join('&sql_params=', $url, map { URI::Escape::uri_escape($_) } @sql_params);
             }
@@ -772,7 +781,6 @@ foreach (1..6) {
      $template->{VARS}->{'build' . $_} and $template->{VARS}->{'buildx' . $_} and last;
 }
 $template->param(   'referer' => $input->referer(),
-                    'DHTMLcalendar_dateformat' => C4::Dates->DHTMLcalendar(),
                 );
 
 output_html_with_http_headers $input, $cookie, $template->output;