@@ -, +, @@ --------- 1) Apply the patch 2) ~/qa-test-tools/koha-qa.pl -v 2 -c 2 NOTE: There are two patches, but you could just test 1. 3) Log into staff client 4) Reports 5) Used save reports 6) Click the Action button on any report WITHOUT PARAMETERS. -- with parameters blows up in master and this. 7) Click Edit 8) Make the report public 9) Update the SQL https://OPAC/cgi-bin/koha/svc/report?id=## -- matches default master report. https://OPAC/cgi-bin/koha/svc/report?id=##&annotated=1 -- has hash where the keys are the field name. https://STAFF/cgi-bin/koha/svc/report?id=## -- matches default master report. https://STAFF/cgi-bin/koha/svc/report?id=##&annotated=1 -- has hash where the keys are the field name. https://OPAC/cgi-bin/koha/svc/report?id=## -- matches the warning from master. https://OPAC/cgi-bin/koha/svc/report?id=##&annotated=1 -- matches the warning from master. https://STAFF/cgi-bin/koha/svc/report?id=## -- matches default master report. https://STAFF/cgi-bin/koha/svc/report?id=##&annotated=1 -- has hash where the keys are the field name. the report does not exist. https://OPAC/cgi-bin/koha/svc/report?id=## -- tells you the report doesn't exist vs. master giving a Software error. https://OPAC/cgi-bin/koha/svc/report?id=##&annotated=1 -- tells you the report doesn't exist vs. master giving a Software error. https://STAFF/cgi-bin/koha/svc/report?id=## -- tells you the report doesn't exist vs. master giving a Software error. https://STAFF/cgi-bin/koha/svc/report?id=##&annotated=1 -- tells you the report doesn't exist vs. master giving a Software error. --- opac/svc/report | 12 ++++++++++-- svc/report | 13 +++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) --- a/opac/svc/report +++ a/opac/svc/report @@ -30,10 +30,12 @@ use Koha::Cache; my $query = CGI->new(); my $report_id = $query->param('id'); my $report_name = $query->param('name'); +my $report_annotation = $query->param('annotated'); my $report_rec = get_saved_report( $report_name ? { 'name' => $report_name } : { 'id' => $report_id } ); -die "Sorry this report is not public\n" unless $report_rec->{public}; +if (!$report_rec) { die "There is no such report.\n"; } +die "Sorry this report is not public\n" unless $report_rec->{public}; my $cache_active = Koha::Cache->is_cache_active; my ($cache_key, $cache, $json_text); @@ -48,7 +50,13 @@ unless ($json_text) { my $limit = C4::Context->preference("SvcMaxReportRows") || 10; my ( $sth, $errors ) = execute_query( $report_rec->{savedsql}, $offset, $limit ); if ($sth) { - my $lines = $sth->fetchall_arrayref; + my $lines; + if ($report_annotation) { + $lines = $sth->fetchall_arrayref({}); + } + else { + $lines = $sth->fetchall_arrayref; + } $json_text = to_json($lines); if ($cache_active) { --- a/svc/report +++ a/svc/report @@ -32,6 +32,10 @@ use Koha::Cache; my $query = CGI->new(); my $report_id = $query->param('id'); my $report_name = $query->param('name'); +my $report_annotation = $query->param('annotated'); + +my $report_rec = get_saved_report( $report_name ? { 'name' => $report_name } : { 'id' => $report_id } ); +if (!$report_rec) { die "There is no such report.\n"; } my ( $template, $loggedinuser, $cookie ) = get_template_and_user( { @@ -52,12 +56,17 @@ if ($cache_active) { } unless ($json_text) { - my $report_rec = get_saved_report($report_name ? { 'name' => $report_name } : { 'id' => $report_id }); my $offset = 0; my $limit = C4::Context->preference("SvcMaxReportRows") || 10; my ( $sth, $errors ) = execute_query( $report_rec->{savedsql}, $offset, $limit ); if ($sth) { - my $lines = $sth->fetchall_arrayref; + my $lines; + if ($report_annotation) { + $lines = $sth->fetchall_arrayref({}); + } + else { + $lines = $sth->fetchall_arrayref; + } $json_text = to_json($lines); if ($cache_active) { --