diff options
author | Frédéric Buclin <LpSolit@gmail.com> | 2011-06-11 12:42:50 +0200 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2011-06-11 12:42:50 +0200 |
commit | b468c6e0c76d557b62ba9bcc05945437c465d06d (patch) | |
tree | 5cf9d9fc5e76545695b3ccc6498f3168fb5b0938 /report.cgi | |
parent | b326ea1e0b07ca34086fec764ff0bba784e5ad30 (diff) | |
download | bugzilla-b468c6e0c76d557b62ba9bcc05945437c465d06d.tar.gz bugzilla-b468c6e0c76d557b62ba9bcc05945437c465d06d.tar.xz |
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
Diffstat (limited to 'report.cgi')
-rwxr-xr-x | report.cgi | 33 |
1 files changed, 21 insertions, 12 deletions
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; +} |