]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 895813: Mandatory custom fields whose visibility depends on a component are not...
authorFrédéric Buclin <LpSolit@gmail.com>
Thu, 2 Jan 2014 22:52:25 +0000 (23:52 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Thu, 2 Jan 2014 22:52:25 +0000 (23:52 +0100)
r=pketolai r=dkl a=sgreen

Bugzilla/Component.pm

index d8f75daaef299ead56fd671eb10ce6316da1fd83..3d56cc8c265b46f13f059e3d3f37eae8a68853bd 100644 (file)
@@ -413,10 +413,10 @@ use constant is_default => 0;
 
 sub is_set_on_bug {
     my ($self, $bug) = @_;
-    # We treat it like a hash always, so that we don't have to check if it's
-    # a hash or an object.
-    return 0 if !defined $bug->{component_id};
-    $bug->{component_id} == $self->id ? 1 : 0;
+    my $value = blessed($bug) ? $bug->component_id : $bug->{component};
+    $value = $value->id if blessed($value);
+    return 0 unless $value;
+    return $value == $self->id ? 1 : 0;
 }
 
 ###############################