From: Frédéric Buclin Date: Thu, 2 Jan 2014 22:55:16 +0000 (+0100) Subject: Bug 895813: Mandatory custom fields whose visibility depends on a component are not... X-Git-Tag: bugzilla-4.4.2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=987e438bd66a42f693213aea4526c1136460b0b8;p=thirdparty%2Fbugzilla.git Bug 895813: Mandatory custom fields whose visibility depends on a component are not required on bug creation r=pketolai r=dkl a=sgreen --- diff --git a/Bugzilla/Component.pm b/Bugzilla/Component.pm index 2b3f484068..1ce4e02ea3 100644 --- a/Bugzilla/Component.pm +++ b/Bugzilla/Component.pm @@ -417,10 +417,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; } ###############################