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

(-)a/opac/svc/report (-1 / +5 lines)
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) {
(-)a/svc/report (-2 / +6 lines)
Lines 32-38 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_header = $query->param('header');
35
36
37
my $report_rec = get_saved_report( $report_name ? { 'name' => $report_name } : { 'id' => $report_id } );
36
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
38
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
37
    {
39
    {
38
        template_name   => "intranet-main.tmpl",
40
        template_name   => "intranet-main.tmpl",
Lines 52-63 if ($cache_active) { Link Here
52
}
54
}
53
55
54
unless ($json_text) {
56
unless ($json_text) {
55
    my $report_rec = get_saved_report($report_name ? { 'name' => $report_name } : { 'id' => $report_id });
56
    my $offset = 0;
57
    my $offset = 0;
57
    my $limit  = C4::Context->preference("SvcMaxReportRows") || 10;
58
    my $limit  = C4::Context->preference("SvcMaxReportRows") || 10;
58
    my ( $sth, $errors ) = execute_query( $report_rec->{savedsql}, $offset, $limit );
59
    my ( $sth, $errors ) = execute_query( $report_rec->{savedsql}, $offset, $limit );
59
    if ($sth) {
60
    if ($sth) {
61
        my $header = $sth->{NAME};
60
        my $lines     = $sth->fetchall_arrayref;
62
        my $lines     = $sth->fetchall_arrayref;
63
        if ($report_header) {
64
            unshift @{$lines}, [ @{$header} ];
65
        }
61
        $json_text = to_json($lines);
66
        $json_text = to_json($lines);
62
67
63
        if ($cache_active) {
68
        if ($cache_active) {
64
- 

Return to bug 11491