]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 610581: The Bug.fields method doesn't include available bug statuses when creatin...
authorFrank Becker <Frank@Frank-Becker.de>
Sat, 18 Aug 2012 21:34:52 +0000 (23:34 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Sat, 18 Aug 2012 21:34:52 +0000 (23:34 +0200)
r/a=LpSolit

Bugzilla/Status.pm
Bugzilla/WebService/Bug.pm

index 1159fa4ae6319e54e1a81e69271ef306be31a06a..2821f7c6e9f11f5f012957fec504bab4e861fc4d 100644 (file)
@@ -175,8 +175,8 @@ sub _status_condition {
     my ($self, $old_status) = @_;
     my @values;
     my $cond = 'old_status IS NULL';
-    # For newly-filed bugs
-    if ($old_status) {
+    # We may pass a fake status object to represent the initial unset state.
+    if ($old_status && $old_status->id)  {
         $cond = 'old_status = ?';
         push(@values, $old_status->id);
     }
index faac5f3d6a1bab17be8f5bf5e85c55b5a5822936..ea5f82999e3771851289849a0847f50ab69c09b3 100644 (file)
@@ -174,6 +174,11 @@ sub _legal_field_values {
 
     elsif ($field_name eq 'bug_status') {
         my @status_all = Bugzilla::Status->get_all;
+        my $initial_status = bless({ id => 0, name => '', is_open => 1, sortkey => 0,
+                                     can_change_to => Bugzilla::Status->can_change_to },
+                                   'Bugzilla::Status');
+        unshift(@status_all, $initial_status);
+
         foreach my $status (@status_all) {
             my @can_change_to;
             foreach my $change_to (@{ $status->can_change_to }) {