diff options
author | David Lawrence <dkl@mozilla.com> | 2015-07-24 10:18:16 +0200 |
---|---|---|
committer | David Lawrence <dkl@mozilla.com> | 2015-07-24 10:18:16 +0200 |
commit | 92f16f758434dd1ce92a1043ade9bf7f8438fa78 (patch) | |
tree | 8651f11b381e3feda5b21adaa30d94b123c6eecb /Bugzilla | |
parent | 50c7dab9e0f27b8f1214b12c4c51ad133329173f (diff) | |
download | bugzilla-92f16f758434dd1ce92a1043ade9bf7f8438fa78.tar.gz bugzilla-92f16f758434dd1ce92a1043ade9bf7f8438fa78.tar.xz |
Bug 1184828: backport bug 1161070 to bmo (api searches should honour the same fields in its "order" parameter as the web UI)
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/WebService/Bug.pm | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm index fa66edb80..d0fe8465f 100644 --- a/Bugzilla/WebService/Bug.pm +++ b/Bugzilla/WebService/Bug.pm @@ -611,7 +611,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); |