summaryrefslogtreecommitdiffstats
path: root/Bugzilla/API
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-07-25 06:21:06 +0200
committerDavid Lawrence <dkl@mozilla.com>2015-07-25 06:21:06 +0200
commit3331c1bafae2fcaf511db95a0e2b79ab65e25bfe (patch)
treeef00cceb2667187de4d01f423715abf6e4933c46 /Bugzilla/API
parent300331b456392d054f6a85a98aa6a5c56bc37f9b (diff)
downloadbugzilla-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 'Bugzilla/API')
-rw-r--r--Bugzilla/API/1_0/Resource/Bug.pm20
1 files changed, 19 insertions, 1 deletions
diff --git a/Bugzilla/API/1_0/Resource/Bug.pm b/Bugzilla/API/1_0/Resource/Bug.pm
index 6a32a687f..c6ae6a19a 100644
--- a/Bugzilla/API/1_0/Resource/Bug.pm
+++ b/Bugzilla/API/1_0/Resource/Bug.pm
@@ -716,7 +716,25 @@ sub search {
ThrowUserError('buglist_parameters_required');
}
- $options{order} = [ split(/\s*,\s*/, delete $match_params->{order}) ] if $match_params->{order};
+ # Allow the use of order shortcuts similar to web UI
+ if ($match_params->{order}) {
+ # Convert the value of the "order" form field into a list of columns
+ # by which to sort the results.
+ 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{$match_params->{order}}) {
+ $options{order} = $order_types{$match_params->{order}};
+ }
+ else {
+ $options{order} = [ split(/\s*,\s*/, $match_params->{order}) ];
+ }
+ }
+
$options{params} = $match_params;
my $search = new Bugzilla::Search(%options);