From b468c6e0c76d557b62ba9bcc05945437c465d06d Mon Sep 17 00:00:00 2001 From: Frédéric Buclin Date: Sat, 11 Jun 2011 12:42:50 +0200 Subject: Fixes several bugs at once related to New Charts: Bug 610739: YUI-generated tabular reports do not work if only one axis is set Bug 617676: Wrong URLs in the "Total" row at the bottom of tabular reports when JS is enabled Bug 655848: Use of uninitialized value $tbl in string eq at /var/www/html/bugzilla/report.cgi line 162 r/a=LpSolit --- report.cgi | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'report.cgi') diff --git a/report.cgi b/report.cgi index 8d80b192f..a71776bfe 100755 --- a/report.cgi +++ b/report.cgi @@ -121,9 +121,7 @@ my $valid_columns = Bugzilla::Search::REPORT_COLUMNS; || ($valid_columns->{$tbl_field} && trick_taint($tbl_field)) || ThrowCodeError("report_axis_invalid", {fld => "z", val => $tbl_field}); -my @axis_fields = ($row_field || EMPTY_COLUMN, - $col_field || EMPTY_COLUMN, - $tbl_field || EMPTY_COLUMN); +my @axis_fields = grep { $_ } ($row_field, $col_field, $tbl_field); # Clone the params, so that Bugzilla::Search can modify them my $params = new Bugzilla::CGI($cgi); @@ -154,16 +152,10 @@ my $row_isnumeric = 1; my $tbl_isnumeric = 1; foreach my $result (@$results) { - my ($row, $col, $tbl) = @$result; - # handle empty dimension member names - $row = ' ' if ($row eq ''); - $col = ' ' if ($col eq ''); - $tbl = ' ' if ($tbl eq ''); - - $row = "" if ($row eq EMPTY_COLUMN); - $col = "" if ($col eq EMPTY_COLUMN); - $tbl = "" if ($tbl eq EMPTY_COLUMN); + my $row = check_value($row_field, $result); + my $col = check_value($col_field, $result); + my $tbl = check_value($tbl_field, $result); $data{$tbl}{$col}{$row}++; $names{"col"}{$col}++; @@ -337,3 +329,20 @@ sub get_names { return @sorted; } + +sub check_value { + my ($field, $result) = @_; + + my $value; + if (!defined $field) { + $value = ''; + } + elsif ($field eq '') { + $value = ' '; + } + else { + $value = shift @$result; + $value = ' ' if (!defined $value || $value eq ''); + } + return $value; +} -- cgit v1.2.3-24-g4f1b