summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormozilla%colinogilvie.co.uk <>2005-07-20 07:38:14 +0200
committermozilla%colinogilvie.co.uk <>2005-07-20 07:38:14 +0200
commit82787bc9132869edb068904dfc8123414c115639 (patch)
treedefa3df28ae742034c5ea9bd321011d37dbf8b12
parent3d9cbd26f5bcf6cba530a6693c2536f90c5bade1 (diff)
downloadbugzilla-82787bc9132869edb068904dfc8123414c115639.tar.gz
bugzilla-82787bc9132869edb068904dfc8123414c115639.tar.xz
Bug 282737: Software Error from time-tracking fields during Change Columns
Patch by Joel, Me, r=wurblzap, a=myk
-rw-r--r--Bugzilla/Search.pm10
-rwxr-xr-xbuglist.cgi12
2 files changed, 15 insertions, 7 deletions
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index 96f38fc06..e7b7739be 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -148,6 +148,11 @@ sub init {
push @supptables, "INNER JOIN components AS map_components " .
"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')) {
@@ -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;
diff --git a/buglist.cgi b/buglist.cgi
index 4768843de..45c0db552 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -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)$//;
- $fragment =~ tr/a-zA-Z\.0-9\-_//cd;
+ # 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;
}
}
@@ -881,7 +889,7 @@ while (my @row = $buglist_sth->fetchrow_array()) {
# or because of human choice
my %min_membercontrol;
if (@bugidlist) {
- my $sth = $dbh->prepare(
+ my $sth = $dbh->prepare(
"SELECT DISTINCT bugs.bug_id, MIN(group_control_map.membercontrol) " .
"FROM bugs " .
"INNER JOIN bug_group_map " .