From 1a8b41594b33176debf92472da347c93714584f0 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Thu, 23 Aug 2012 13:36:15 +0200 Subject: [PATCH] Bug 7993: Several bug fixes - Re-display text input for sql params that are not linked to a list of values - Fix passing report id to template Signed-off-by: Chris Cormack --- reports/guided_reports.pl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl index b249a90..baadab0 100755 --- a/reports/guided_reports.pl +++ b/reports/guided_reports.pl @@ -608,14 +608,16 @@ elsif ($phase eq 'Run this report'){ -multiple => 0, -tabindex => 1, ); - push @tmpl_parameters, {'entry' => $text, 'input' => $input }; + } else { + $input = ''; } + push @tmpl_parameters, {'entry' => $text, 'input' => $input }; } $template->param('sql' => $sql, 'name' => $name, 'sql_params' => \@tmpl_parameters, 'enter_params' => 1, - 'reports' => $report, + 'reports' => $report->{id}, ); } else { # OK, we have parameters, or there are none, we run the report @@ -632,7 +634,7 @@ elsif ($phase eq 'Run this report'){ my ($sth, $errors) = execute_query($sql, $offset, $limit); my $total = nb_rows($sql) || 0; unless ($sth) { - die "execute_query failed to return sth for report $report: $sql"; + die "execute_query failed to return sth for report $report->{id}: $sql"; } else { my $headref = $sth->{NAME} || []; my @headers = map { +{ cell => $_ } } @$headref; @@ -644,14 +646,14 @@ elsif ($phase eq 'Run this report'){ } my $totpages = int($total/$limit) + (($total % $limit) > 0 ? 1 : 0); - my $url = "/cgi-bin/koha/reports/guided_reports.pl?reports=$report&phase=Run%20this%20report"; + my $url = "/cgi-bin/koha/reports/guided_reports.pl?reports=$report->{id}&phase=Run%20this%20report"; if (@sql_params) { $url = join('&sql_params=', $url, map { URI::Escape::uri_escape($_) } @sql_params); } $template->param( 'results' => \@rows, 'sql' => $sql, - 'id' => $report, + 'id' => $report->{id}, 'execute' => 1, 'name' => $name, 'notes' => $notes, -- 1.7.9.5