From 8816b8cb98a7902b722c00cbed6e22b12f176e74 Mon Sep 17 00:00:00 2001 From: "myk%mozilla.org" <> Date: Sat, 9 Nov 2002 09:58:47 +0000 Subject: Fix for bug 171505: shows disabled flags in the UI r=bbaetz a=justdave --- bug_form.pl | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'bug_form.pl') diff --git a/bug_form.pl b/bug_form.pl index 0e6b4547d..946dc4a31 100644 --- a/bug_form.pl +++ b/bug_form.pl @@ -209,8 +209,7 @@ sub show_bug { my $flag_types = Bugzilla::FlagType::match({ 'target_type' => 'bug', 'product_id' => $bug{'product_id'}, - 'component_id' => $bug{'component_id'}, - 'is_active' => 1 }); + 'component_id' => $bug{'component_id'}); foreach my $flag_type (@$flag_types) { $flag_type->{'flags'} = Bugzilla::Flag::match({ 'bug_id' => $id , @@ -219,13 +218,21 @@ sub show_bug { } $vars->{'flag_types'} = $flag_types; - # The number of types of flags that can be set on attachments - # to this bug. If none, flags won't be shown in the list of attachments. - $vars->{'num_attachment_flag_types'} = - Bugzilla::FlagType::count({ 'target_type' => 'a', - 'product_id' => $bug{'product_id'}, - 'component_id' => $bug{'component_id'}, - 'is_active' => 1 }); + # The number of types of flags that can be set on attachments to this bug + # and the number of flags on those attachments. One of these counts must be + # greater than zero in order for the "flags" column to appear in the table + # of attachments. + my $num_attachment_flag_types = + Bugzilla::FlagType::count({ 'target_type' => 'attachment', + 'product_id' => $bug{'product_id'}, + 'component_id' => $bug{'component_id'}, + 'is_active' => 1 }); + my $num_attachment_flags = + Bugzilla::Flag::count({ 'target_type' => 'attachment', + 'bug_id' => $id }); + + $vars->{'show_attachment_flags'} + = $num_attachment_flag_types || $num_attachment_flags; # Dependencies my @list; -- cgit v1.2.3-24-g4f1b