| 
      
            Lines 30-40
          use Koha::Cache;
      
      
        Link Here
      
     | 
  
        
          | 30 | 
          my $query  = CGI->new();  | 
          30 | 
          my $query  = CGI->new();  | 
        
        
          | 31 | 
          my $report_id = $query->param('id'); | 
          31 | 
          my $report_id = $query->param('id'); | 
        
        
          | 32 | 
          my $report_name = $query->param('name'); | 
          32 | 
          my $report_name = $query->param('name'); | 
        
            
               | 
               | 
              33 | 
              my $report_header = $query->param('header'); | 
            
        
          | 33 | 
           | 
          34 | 
           | 
        
        
          | 34 | 
          my $report_rec = get_saved_report( $report_name ? { 'name' => $report_name } : { 'id' => $report_id } ); | 
          35 | 
          my $report_rec = get_saved_report( $report_name ? { 'name' => $report_name } : { 'id' => $report_id } ); | 
        
        
          | 35 | 
          die "Sorry this report is not public\n" unless $report_rec->{public}; | 
          36 | 
          die "Sorry this report is not public\n" unless $report_rec->{public}; | 
        
        
          | 36 | 
           | 
          37 | 
           | 
        
            
              | 37 | 
               | 
               | 
               | 
            
        
          | 38 | 
          my $cache_active = Koha::Cache->is_cache_active;  | 
          38 | 
          my $cache_active = Koha::Cache->is_cache_active;  | 
        
        
          | 39 | 
          my ($cache_key, $cache, $json_text);  | 
          39 | 
          my ($cache_key, $cache, $json_text);  | 
        
        
          | 40 | 
          if ($cache_active) { | 
          40 | 
          if ($cache_active) { | 
        
  
    | 
      
            Lines 48-54
          unless ($json_text) {
      
      
        Link Here
      
     | 
  
        
          | 48 | 
              my $limit  = C4::Context->preference("SvcMaxReportRows") || 10; | 
          48 | 
              my $limit  = C4::Context->preference("SvcMaxReportRows") || 10; | 
        
        
          | 49 | 
              my ( $sth, $errors ) = execute_query( $report_rec->{savedsql}, $offset, $limit ); | 
          49 | 
              my ( $sth, $errors ) = execute_query( $report_rec->{savedsql}, $offset, $limit ); | 
        
        
          | 50 | 
              if ($sth) { | 
          50 | 
              if ($sth) { | 
        
            
               | 
               | 
              51 | 
                      my $header = $sth->{NAME}; | 
            
        
          | 51 | 
                  my $lines     = $sth->fetchall_arrayref;  | 
          52 | 
                  my $lines     = $sth->fetchall_arrayref;  | 
        
            
               | 
               | 
              53 | 
                      if ($report_header) { | 
            
            
              | 54 | 
                          unshift @{$lines}, [ @{$header} ]; | 
            
            
              | 55 | 
                      }  | 
            
        
          | 52 | 
                  $json_text = to_json($lines);  | 
          56 | 
                  $json_text = to_json($lines);  | 
        
        
          | 53 | 
           | 
          57 | 
           | 
        
        
          | 54 | 
                  if ($cache_active) { | 
          58 | 
                  if ($cache_active) { |