summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Product.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2006-07-25 08:22:53 +0200
committerlpsolit%gmail.com <>2006-07-25 08:22:53 +0200
commit2904ac3261ff9bb59e29b74d55d4ada294986ffe (patch)
treec3c5b3a99f23f76502eac1e652044a550ba19371 /Bugzilla/Product.pm
parentbea873a66d06670af744b29d9e8d357ae3b5ceed (diff)
downloadbugzilla-2904ac3261ff9bb59e29b74d55d4ada294986ffe.tar.gz
bugzilla-2904ac3261ff9bb59e29b74d55d4ada294986ffe.tar.xz
Bug 174039: Set flags on bug entry - Patch by Frédéric Buclin <LpSolit@gmail.com> r=wurblzap r=myk a=myk
Diffstat (limited to 'Bugzilla/Product.pm')
-rw-r--r--Bugzilla/Product.pm28
1 files changed, 28 insertions, 0 deletions
diff --git a/Bugzilla/Product.pm b/Bugzilla/Product.pm
index 995369130..b025cd7cb 100644
--- a/Bugzilla/Product.pm
+++ b/Bugzilla/Product.pm
@@ -177,6 +177,24 @@ sub user_has_access {
undef, $self->id);
}
+sub flag_types {
+ my $self = shift;
+
+ if (!defined $self->{'flag_types'}) {
+ $self->{'flag_types'} = {};
+ foreach my $type ('bug', 'attachment') {
+ my %flagtypes;
+ foreach my $component (@{$self->components}) {
+ foreach my $flagtype (@{$component->flag_types->{$type}}) {
+ $flagtypes{$flagtype->{'id'}} ||= $flagtype;
+ }
+ }
+ $self->{'flag_types'}->{$type} = [sort { $a->{'sortkey'} <=> $b->{'sortkey'}
+ || $a->{'name'} cmp $b->{'name'} } values %flagtypes];
+ }
+ }
+ return $self->{'flag_types'};
+}
###############################
#### Accessors ######
@@ -231,6 +249,7 @@ Bugzilla::Product - Bugzilla product class.
my $bugcount = $product->bug_count();
my $bug_ids = $product->bug_ids();
my $has_access = $product->user_has_access($user);
+ my $flag_types = $product->flag_types();
my $id = $product->id;
my $name = $product->name;
@@ -320,6 +339,15 @@ below.
Returns C<1> If this user's groups allow him C<entry> access to
this Product, C<0> otherwise.
+=item C<flag_types()>
+
+ Description: Returns flag types available for at least one of
+ its components.
+
+ Params: none.
+
+ Returns: Two references to an array of flagtype objects.
+
=back
=head1 SUBROUTINES