diff options
author | Tiago Mello <timello@gmail.com> | 2010-10-18 23:18:58 +0200 |
---|---|---|
committer | Tiago Mello <timello@gmail.com> | 2010-10-18 23:18:58 +0200 |
commit | 509189f0c586ed468287d323e03e0cd2658fd198 (patch) | |
tree | 9c234d578c0c9d593eea5cb3f417c65b8925a601 | |
parent | 7c03516e0ed331a98e7a9a8984d7b7abec0e9318 (diff) | |
download | bugzilla-509189f0c586ed468287d323e03e0cd2658fd198.tar.gz bugzilla-509189f0c586ed468287d323e03e0cd2658fd198.tar.xz |
Bug 595569: Fixes Bugzilla::Field::ChoiceInterface->controls_visibility_of_fields
method which was causing an error when deleting a product/component.
r/a=mkanat
-rw-r--r-- | Bugzilla/Field/ChoiceInterface.pm | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Bugzilla/Field/ChoiceInterface.pm b/Bugzilla/Field/ChoiceInterface.pm index 894ce00d3..87354a103 100644 --- a/Bugzilla/Field/ChoiceInterface.pm +++ b/Bugzilla/Field/ChoiceInterface.pm @@ -110,10 +110,21 @@ sub is_static { sub controls_visibility_of_fields { my $self = shift; - $self->{controls_visibility_of_fields} ||= Bugzilla::Field->match( - { visibility_field_id => $self->field->id, - visibility_value_id => $self->id }); - return $self->{controls_visibility_of_fields}; + my $dbh = Bugzilla->dbh; + + if (!$self->{controls_visibility_of_fields}) { + my $ids = $dbh->selectcol_arrayref( + "SELECT id FROM fielddefs + INNER JOIN field_visibility + ON fielddefs.id = field_visibility.field_id + WHERE value_id = ? AND visibility_field_id = ?", undef, + $self->id, $self->field->id); + + $self->{controls_visibility_of_fields} = + Bugzilla::Field->new_from_list($ids); + } + + return $self->{controls_visibility_of_fields}; } sub visibility_value { |