diff options
author | David Lawrence <dkl@mozilla.com> | 2015-07-25 06:21:06 +0200 |
---|---|---|
committer | David Lawrence <dkl@mozilla.com> | 2015-07-25 06:21:06 +0200 |
commit | 3331c1bafae2fcaf511db95a0e2b79ab65e25bfe (patch) | |
tree | ef00cceb2667187de4d01f423715abf6e4933c46 /buglist.cgi | |
parent | 300331b456392d054f6a85a98aa6a5c56bc37f9b (diff) | |
download | bugzilla-3331c1bafae2fcaf511db95a0e2b79ab65e25bfe.tar.gz bugzilla-3331c1bafae2fcaf511db95a0e2b79ab65e25bfe.tar.xz |
Bug 1161070: api searches should honour the same fields in its "order" parameter as the web UI
r=dylan,a=simon
Diffstat (limited to 'buglist.cgi')
-rwxr-xr-x | buglist.cgi | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/buglist.cgi b/buglist.cgi index 2ecb04e0c..7b1c69e40 100755 --- a/buglist.cgi +++ b/buglist.cgi @@ -645,29 +645,18 @@ my @order_columns; if ($order) { # Convert the value of the "order" form field into a list of columns # by which to sort the results. - ORDER: for ($order) { - /^Bug Number$/ && do { - @order_columns = ("bug_id"); - last ORDER; - }; - /^Importance$/ && do { - @order_columns = ("priority", "bug_severity"); - last ORDER; - }; - /^Assignee$/ && do { - @order_columns = ("assigned_to", "bug_status", "priority", - "bug_id"); - last ORDER; - }; - /^Last Changed$/ && do { - @order_columns = ("changeddate", "bug_status", "priority", - "assigned_to", "bug_id"); - last ORDER; - }; - do { - # A custom list of columns. Bugzilla::Search will validate items. - @order_columns = split(/\s*,\s*/, $order); - }; + my %order_types = ( + "Bug Number" => [ "bug_id" ], + "Importance" => [ "priority", "bug_severity" ], + "Assignee" => [ "assigned_to", "bug_status", "priority", "bug_id" ], + "Last Changed" => [ "changeddate", "bug_status", "priority", + "assigned_to", "bug_id" ], + ); + if ($order_types{$order}) { + @order_columns = @{ $order_types{$order} }; + } + else { + @order_columns = split(/\s*,\s*/, $order); } } |