View | Details | Raw Unified | Return to bug 11491
Collapse All | Expand All

(-)a/opac/svc/report (-2 / +10 lines)
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) {
(-)a/svc/report (-3 / +11 lines)
Lines 32-37 use Koha::Cache; Link Here
32
my $query  = CGI->new();
32
my $query  = CGI->new();
33
my $report_id = $query->param('id');
33
my $report_id = $query->param('id');
34
my $report_name = $query->param('name');
34
my $report_name = $query->param('name');
35
my $report_annotation = $query->param('annotated');
36
37
my $report_rec = get_saved_report( $report_name ? { 'name' => $report_name } : { 'id' => $report_id } );
38
if (!$report_rec) { die "There is no such report.\n"; }
35
39
36
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
40
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
37
    {
41
    {
Lines 52-63 if ($cache_active) { Link Here
52
}
56
}
53
57
54
unless ($json_text) {
58
unless ($json_text) {
55
    my $report_rec = get_saved_report($report_name ? { 'name' => $report_name } : { 'id' => $report_id });
56
    my $offset = 0;
59
    my $offset = 0;
57
    my $limit  = C4::Context->preference("SvcMaxReportRows") || 10;
60
    my $limit  = C4::Context->preference("SvcMaxReportRows") || 10;
58
    my ( $sth, $errors ) = execute_query( $report_rec->{savedsql}, $offset, $limit );
61
    my ( $sth, $errors ) = execute_query( $report_rec->{savedsql}, $offset, $limit );
59
    if ($sth) {
62
    if ($sth) {
60
        my $lines     = $sth->fetchall_arrayref;
63
        my $lines;
64
        if ($report_annotation) {
65
            $lines = $sth->fetchall_arrayref({});
66
        }
67
        else {
68
            $lines = $sth->fetchall_arrayref;
69
        }
61
        $json_text = to_json($lines);
70
        $json_text = to_json($lines);
62
71
63
        if ($cache_active) {
72
        if ($cache_active) {
64
- 

Return to bug 11491