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);
}
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 }) {