Lines 608-621
elsif ($phase eq 'Run this report'){
Link Here
|
608 |
-multiple => 0, |
608 |
-multiple => 0, |
609 |
-tabindex => 1, |
609 |
-tabindex => 1, |
610 |
); |
610 |
); |
611 |
push @tmpl_parameters, {'entry' => $text, 'input' => $input }; |
611 |
} else { |
|
|
612 |
$input = '<input type="text" name="sql_params" />'; |
612 |
} |
613 |
} |
|
|
614 |
push @tmpl_parameters, {'entry' => $text, 'input' => $input }; |
613 |
} |
615 |
} |
614 |
$template->param('sql' => $sql, |
616 |
$template->param('sql' => $sql, |
615 |
'name' => $name, |
617 |
'name' => $name, |
616 |
'sql_params' => \@tmpl_parameters, |
618 |
'sql_params' => \@tmpl_parameters, |
617 |
'enter_params' => 1, |
619 |
'enter_params' => 1, |
618 |
'reports' => $report, |
620 |
'reports' => $report->{id}, |
619 |
); |
621 |
); |
620 |
} else { |
622 |
} else { |
621 |
# OK, we have parameters, or there are none, we run the report |
623 |
# OK, we have parameters, or there are none, we run the report |
Lines 632-638
elsif ($phase eq 'Run this report'){
Link Here
|
632 |
my ($sth, $errors) = execute_query($sql, $offset, $limit); |
634 |
my ($sth, $errors) = execute_query($sql, $offset, $limit); |
633 |
my $total = nb_rows($sql) || 0; |
635 |
my $total = nb_rows($sql) || 0; |
634 |
unless ($sth) { |
636 |
unless ($sth) { |
635 |
die "execute_query failed to return sth for report $report: $sql"; |
637 |
die "execute_query failed to return sth for report $report->{id}: $sql"; |
636 |
} else { |
638 |
} else { |
637 |
my $headref = $sth->{NAME} || []; |
639 |
my $headref = $sth->{NAME} || []; |
638 |
my @headers = map { +{ cell => $_ } } @$headref; |
640 |
my @headers = map { +{ cell => $_ } } @$headref; |
Lines 644-657
elsif ($phase eq 'Run this report'){
Link Here
|
644 |
} |
646 |
} |
645 |
|
647 |
|
646 |
my $totpages = int($total/$limit) + (($total % $limit) > 0 ? 1 : 0); |
648 |
my $totpages = int($total/$limit) + (($total % $limit) > 0 ? 1 : 0); |
647 |
my $url = "/cgi-bin/koha/reports/guided_reports.pl?reports=$report&phase=Run%20this%20report"; |
649 |
my $url = "/cgi-bin/koha/reports/guided_reports.pl?reports=$report->{id}&phase=Run%20this%20report"; |
648 |
if (@sql_params) { |
650 |
if (@sql_params) { |
649 |
$url = join('&sql_params=', $url, map { URI::Escape::uri_escape($_) } @sql_params); |
651 |
$url = join('&sql_params=', $url, map { URI::Escape::uri_escape($_) } @sql_params); |
650 |
} |
652 |
} |
651 |
$template->param( |
653 |
$template->param( |
652 |
'results' => \@rows, |
654 |
'results' => \@rows, |
653 |
'sql' => $sql, |
655 |
'sql' => $sql, |
654 |
'id' => $report, |
656 |
'id' => $report->{id}, |
655 |
'execute' => 1, |
657 |
'execute' => 1, |
656 |
'name' => $name, |
658 |
'name' => $name, |
657 |
'notes' => $notes, |
659 |
'notes' => $notes, |
658 |
- |
|
|