Bug 12214: display SQL errors in reports to users

When a user runs a report containing an SQL error, no
error is shown to the user.  This patch fixes this.

To test:
1) Run a report with known good SQL.
2) No error is shown.
3) Run a report with bad SQL (eg. a typo in field name)
4) No error is shown.
5) Apply patch
6) Repeat 1-4. For the bad SQL report, the database error
   should be shown.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Pasi Kallinen 2014-05-08 10:11:29 +03:00 committed by Galen Charlton
parent 795700d8f0
commit 0625685f7c
2 changed files with 2 additions and 1 deletions

View file

@ -512,6 +512,7 @@ sub execute_query {
my $sth = C4::Context->dbh->prepare($sql);
$sth->execute(@$sql_params, $offset, $limit);
return ( $sth, { queryerr => $sth->errstr } ) if ($sth->err);
return ( $sth );
# my @xmlarray = ... ;
# my $url = "/cgi-bin/koha/reports/guided_reports.pl?phase=retrieve%20results&id=$id";

View file

@ -753,7 +753,7 @@ elsif ($phase eq 'Run this report'){
'execute' => 1,
'name' => $name,
'notes' => $notes,
'errors' => $errors,
'errors' => defined($errors) ? [ $errors ] : undef,
'pagination_bar' => pagination_bar($url, $totpages, $input->param('page')),
'unlimited_total' => $total,
'sql_params' => \@sql_params,