summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/API/1_0/Resource/Bug.pm20
-rw-r--r--Bugzilla/WebService/Bug.pm20
-rwxr-xr-xbuglist.cgi35
3 files changed, 50 insertions, 25 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);
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index 47c047745..c6b28a9a0 100644
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -575,7 +575,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);
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);
}
}