Lines 596-601
sub execute_query {
Link Here
|
596 |
my $limit = $params->{limit} || C4::Context->config('report_results_limit') || 999999; |
596 |
my $limit = $params->{limit} || C4::Context->config('report_results_limit') || 999999; |
597 |
my $sql_params = defined $params->{sql_params} ? $params->{sql_params} : []; |
597 |
my $sql_params = defined $params->{sql_params} ? $params->{sql_params} : []; |
598 |
my $report_id = $params->{report_id}; |
598 |
my $report_id = $params->{report_id}; |
|
|
599 |
my $report = Koha::Reports->find($report_id) if $report_id; |
600 |
my $report_name = $report ? $report->report_name : 'Unknown report'; |
599 |
|
601 |
|
600 |
# check parameters |
602 |
# check parameters |
601 |
unless ($sql) { |
603 |
unless ($sql) { |
Lines 655-671
sub execute_query {
Link Here
|
655 |
eval { $sth->execute( @$sql_params, $offset, $limit ); }; |
657 |
eval { $sth->execute( @$sql_params, $offset, $limit ); }; |
656 |
warn $@ if $@; |
658 |
warn $@ if $@; |
657 |
|
659 |
|
658 |
Koha::Logger->get( { prefix => 0, interface => 'reports', category => 'execute.time.end' } ) |
660 |
logaction( "REPORTS", "Run", $report_id, "$report_name | $sql " ) if C4::Context->preference("ReportsLog"); |
659 |
->info("Report finished: $report_id") |
|
|
660 |
if $report_id; |
661 |
|
662 |
return ( $sth, { queryerr => $sth->errstr } ) if ( $sth->err ); |
663 |
|
664 |
# Check if table.* contained forbidden column names |
665 |
return ( $sth, { passworderr => "Illegal column in results" } ) |
666 |
if Koha::Report->new->check_columns( undef, $sth->{NAME_lc} ); |
667 |
|
661 |
|
668 |
return ($sth); |
662 |
return ( $sth, { queryerr => $sth->errstr } ) if ($sth->err); |
|
|
663 |
return ( $sth ); |
669 |
} |
664 |
} |
670 |
|
665 |
|
671 |
=head2 save_report($sql,$name,$type,$notes) |
666 |
=head2 save_report($sql,$name,$type,$notes) |
672 |
- |
|
|