Lines 822-831
elsif ($phase eq 'Run this report'){
Link Here
|
822 |
my ($sql,$header_types) = $report->prep_report( \@param_names, \@sql_params ); |
822 |
my ($sql,$header_types) = $report->prep_report( \@param_names, \@sql_params ); |
823 |
$template->param(header_types => $header_types); |
823 |
$template->param(header_types => $header_types); |
824 |
my ( $sth, $errors ) = execute_query( $sql, $offset, $limit, undef, $report_id ); |
824 |
my ( $sth, $errors ) = execute_query( $sql, $offset, $limit, undef, $report_id ); |
825 |
my $total = nb_rows($sql) || 0; |
825 |
my $total; |
826 |
unless ($sth) { |
826 |
if (!$sth) { |
827 |
die "execute_query failed to return sth for report $report_id: $sql"; |
827 |
die "execute_query failed to return sth for report $report_id: $sql"; |
828 |
} else { |
828 |
} elsif ( !$errors ) { |
|
|
829 |
$total = nb_rows($sql) || 0; |
829 |
my $headers = header_cell_loop($sth); |
830 |
my $headers = header_cell_loop($sth); |
830 |
$template->param(header_row => $headers); |
831 |
$template->param(header_row => $headers); |
831 |
while (my $row = $sth->fetchrow_arrayref()) { |
832 |
while (my $row = $sth->fetchrow_arrayref()) { |
Lines 839-869
elsif ($phase eq 'Run this report'){
Link Here
|
839 |
push @allrows, { cells => \@cells }; |
840 |
push @allrows, { cells => \@cells }; |
840 |
} |
841 |
} |
841 |
} |
842 |
} |
842 |
} |
|
|
843 |
|
843 |
|
844 |
my $totpages = int($total/$limit) + (($total % $limit) > 0 ? 1 : 0); |
844 |
my $totpages = int($total/$limit) + (($total % $limit) > 0 ? 1 : 0); |
845 |
my $url = "/cgi-bin/koha/reports/guided_reports.pl?reports=$report_id&phase=Run%20this%20report&limit=$limit&want_full_chart=$want_full_chart"; |
845 |
my $url = "/cgi-bin/koha/reports/guided_reports.pl?reports=$report_id&phase=Run%20this%20report&limit=$limit&want_full_chart=$want_full_chart"; |
846 |
if (@param_names) { |
846 |
if (@param_names) { |
847 |
$url = join('&param_name=', $url, map { URI::Escape::uri_escape_utf8($_) } @param_names); |
847 |
$url = join('&param_name=', $url, map { URI::Escape::uri_escape_utf8($_) } @param_names); |
848 |
} |
848 |
} |
849 |
if (@sql_params) { |
849 |
if (@sql_params) { |
850 |
$url = join('&sql_params=', $url, map { URI::Escape::uri_escape_utf8($_) } @sql_params); |
850 |
$url = join('&sql_params=', $url, map { URI::Escape::uri_escape_utf8($_) } @sql_params); |
851 |
} |
851 |
} |
852 |
|
852 |
|
|
|
853 |
$template->param( |
854 |
'results' => \@rows, |
855 |
'allresults' => \@allrows, |
856 |
'pagination_bar' => pagination_bar($url, $totpages, scalar $input->param('page')), |
857 |
'unlimited_total' => $total, |
858 |
); |
859 |
} |
853 |
$template->param( |
860 |
$template->param( |
854 |
'results' => \@rows, |
861 |
'sql' => $sql, |
855 |
'allresults' => \@allrows, |
862 |
original_sql => $original_sql, |
856 |
'sql' => $sql, |
863 |
'id' => $report_id, |
857 |
original_sql => $original_sql, |
864 |
'execute' => 1, |
858 |
'id' => $report_id, |
865 |
'name' => $name, |
859 |
'execute' => 1, |
866 |
'notes' => $notes, |
860 |
'name' => $name, |
867 |
'errors' => defined($errors) ? [$errors] : undef, |
861 |
'notes' => $notes, |
868 |
'sql_params' => \@sql_params, |
862 |
'errors' => defined($errors) ? [ $errors ] : undef, |
869 |
'param_names' => \@param_names, |
863 |
'pagination_bar' => pagination_bar($url, $totpages, scalar $input->param('page')), |
|
|
864 |
'unlimited_total' => $total, |
865 |
'sql_params' => \@sql_params, |
866 |
'param_names' => \@param_names, |
867 |
); |
870 |
); |
868 |
} |
871 |
} |
869 |
} |
872 |
} |
870 |
- |
|
|