From 2904ac3261ff9bb59e29b74d55d4ada294986ffe Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Tue, 25 Jul 2006 06:22:53 +0000 Subject: Bug 174039: Set flags on bug entry - Patch by Frédéric Buclin r=wurblzap r=myk a=myk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/Component.pm | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'Bugzilla/Component.pm') diff --git a/Bugzilla/Component.pm b/Bugzilla/Component.pm index 827be789d..abd3711f5 100644 --- a/Bugzilla/Component.pm +++ b/Bugzilla/Component.pm @@ -13,7 +13,7 @@ # The Original Code is the Bugzilla Bug Tracking System. # # Contributor(s): Tiago R. Mello -# +# Frédéric Buclin use strict; @@ -22,6 +22,7 @@ package Bugzilla::Component; use Bugzilla::Util; use Bugzilla::Error; use Bugzilla::User; +use Bugzilla::FlagType; ############################### #### Initialization #### @@ -135,6 +136,24 @@ sub default_qa_contact { return $self->{'default_qa_contact'}; } +sub flag_types { + my $self = shift; + + if (!defined $self->{'flag_types'}) { + $self->{'flag_types'} = {}; + $self->{'flag_types'}->{'bug'} = + Bugzilla::FlagType::match({ 'target_type' => 'bug', + 'product_id' => $self->product_id, + 'component_id' => $self->id }); + + $self->{'flag_types'}->{'attachment'} = + Bugzilla::FlagType::match({ 'target_type' => 'attachment', + 'product_id' => $self->product_id, + 'component_id' => $self->id }); + } + return $self->{'flag_types'}; +} + ############################### #### Accessors #### ############################### @@ -193,6 +212,8 @@ Bugzilla::Component - Bugzilla product component class. my $product_id = $component->product_id; my $default_assignee = $component->default_assignee; my $default_qa_contact = $component->default_qa_contact; + my $bug_flag_types = $component->flag_types->{'bug'}; + my $attach_flag_types = $component->flag_types->{'attachment'}; my $component = Bugzilla::Component::check_component($product, 'AcmeComp'); @@ -252,6 +273,15 @@ Component.pm represents a Product Component object. Returns: A Bugzilla::User object. +=item C + + Description: Returns all bug and attachment flagtypes available for + the component. + + Params: none. + + Returns: Two references to an array of flagtype objects. + =back =head1 SUBROUTINES -- cgit v1.2.3-24-g4f1b