From 4b2830df572bbe8fe8901a7860af4969021baee1 Mon Sep 17 00:00:00 2001 From: "bbaetz%student.usyd.edu.au" Date: Wed, 12 Jun 2002 23:18:58 +0000 Subject: [PATCH] Bug 150882 - SQL error when sorting by bugs.votes with explicit direction r=gerv x2 --- webtools/bugzilla/buglist.cgi | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/webtools/bugzilla/buglist.cgi b/webtools/bugzilla/buglist.cgi index 925f0296f9e..b649b8f1e15 100755 --- a/webtools/bugzilla/buglist.cgi +++ b/webtools/bugzilla/buglist.cgi @@ -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 "; }