summaryrefslogtreecommitdiffstats
path: root/buglist.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-xbuglist.cgi12
1 files changed, 10 insertions, 2 deletions
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 " .