]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 150882 - SQL error when sorting by bugs.votes with explicit direction
authorbbaetz%student.usyd.edu.au <>
Thu, 13 Jun 2002 06:18:58 +0000 (06:18 +0000)
committerbbaetz%student.usyd.edu.au <>
Thu, 13 Jun 2002 06:18:58 +0000 (06:18 +0000)
r=gerv x2

buglist.cgi

index 925f0296f9e09af014c7b3ed6e4fbc31db6242fd..b649b8f1e15880f64f9a9e8e16040cd2173466fb 100755 (executable)
@@ -1357,10 +1357,9 @@ if ($order) {
         $query =~ s/\sWHERE\s/ LEFT JOIN milestones ms_order ON ms_order.value = bugs.target_milestone AND ms_order.product = bugs.product WHERE /;
     }
 
-    # If we are sorting by votes, sort in descending order.
-    if ($db_order =~ /bugs.votes\s*(asc|desc){0}/i) {
-        $db_order =~ s/bugs.votes/bugs.votes desc/i;
-    }
+    # If we are sorting by votes, sort in descending order if no explicit
+    # sort order was given
+    $db_order =~ s/bugs.votes\s*(,|$)/bugs.votes desc$1/i;
 
     $query .= " ORDER BY $db_order ";
 }