Bug 282737: Software Error from time-tracking fields during Change Columns

Patch by Joel, Me, r=wurblzap, a=myk
parent 3d9cbd26
......@@ -149,6 +149,11 @@ sub init {
"ON bugs.component_id = map_components.id";
}
if (grep($_ =~/AS (actual_time|percentage_complete)$/, @$fieldsref)) {
push(@supptables, "INNER JOIN longdescs AS ldtime " .
"ON ldtime.bug_id = bugs.bug_id");
}
my $minvotes;
if (defined $params->param('votes')) {
my $c = trim($params->param('votes'));
......@@ -218,11 +223,6 @@ sub init {
push(@specialchart, ["keywords", $t, $params->param('keywords')]);
}
if (lsearch($fieldsref, "(SUM(ldtime.work_time)*COUNT(DISTINCT ldtime.bug_when)/COUNT(bugs.bug_id)) AS actual_time") != -1) {
push(@supptables, "INNER JOIN longdescs AS ldtime " .
"ON ldtime.bug_id = bugs.bug_id");
}
foreach my $id ("1", "2") {
if (!defined ($params->param("email$id"))) {
next;
......
......@@ -733,7 +733,15 @@ foreach my $fragment (split(/,/, $order)) {
# Add order columns to selectnames
# The fragment has already been validated
$fragment =~ s/\s+(asc|desc)$//;
# This fixes an issue where columns being used in the ORDER BY statement
# can have the SQL that generates the value changed to become invalid -
# mainly affects time tracking.
if ($fragment =~ / AS (\w+)/) {
$fragment = $columns->{$1}->{'name'};
}
else {
$fragment =~ tr/a-zA-Z\.0-9\-_//cd;
}
push @selectnames, $fragment;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment