Lines 30-39
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_annotation = $query->param('annotated'); |
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 |
if (!$report_rec) { die "There is no such report.\n"; } |
36 |
|
37 |
|
|
|
38 |
die "Sorry this report is not public\n" unless $report_rec->{public}; |
37 |
|
39 |
|
38 |
my $cache_active = Koha::Cache->is_cache_active; |
40 |
my $cache_active = Koha::Cache->is_cache_active; |
39 |
my ($cache_key, $cache, $json_text); |
41 |
my ($cache_key, $cache, $json_text); |
Lines 48-54
unless ($json_text) {
Link Here
|
48 |
my $limit = C4::Context->preference("SvcMaxReportRows") || 10; |
50 |
my $limit = C4::Context->preference("SvcMaxReportRows") || 10; |
49 |
my ( $sth, $errors ) = execute_query( $report_rec->{savedsql}, $offset, $limit ); |
51 |
my ( $sth, $errors ) = execute_query( $report_rec->{savedsql}, $offset, $limit ); |
50 |
if ($sth) { |
52 |
if ($sth) { |
51 |
my $lines = $sth->fetchall_arrayref; |
53 |
my $lines; |
|
|
54 |
if ($report_annotation) { |
55 |
$lines = $sth->fetchall_arrayref({}); |
56 |
} |
57 |
else { |
58 |
$lines = $sth->fetchall_arrayref; |
59 |
} |
52 |
$json_text = to_json($lines); |
60 |
$json_text = to_json($lines); |
53 |
|
61 |
|
54 |
if ($cache_active) { |
62 |
if ($cache_active) { |