summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/Component.pm18
1 files changed, 18 insertions, 0 deletions
diff --git a/Bugzilla/Component.pm b/Bugzilla/Component.pm
index 83ddec356..08a55846d 100644
--- a/Bugzilla/Component.pm
+++ b/Bugzilla/Component.pm
@@ -20,6 +20,7 @@ use Bugzilla::User;
use Bugzilla::FlagType;
use Bugzilla::Series;
+use List::Util qw(first);
use Scalar::Util qw(blessed);
###############################
@@ -405,6 +406,12 @@ sub flag_types {
return $self->{'flag_types'};
}
+sub find_first_flag_type {
+ my ($self, $target_type, $name) = @_;
+
+ return first { $_->name eq $name } @{ $self->flag_types->{$target_type} };
+}
+
sub initial_cc {
my $self = shift;
my $dbh = Bugzilla->dbh;
@@ -609,6 +616,17 @@ Component.pm represents a Product Component object.
Returns: Nothing.
+
+=item C<find_first_flag_type($target_type, $name).
+
+ Description: Find the first named bug or attachment flag with a given
+ name on this component.
+
+ Params: $target_type - 'bug' or 'attachment'
+ $name - the name of the flag
+
+ Returns: a new Bugzilla::FlagType object or undef
+
=item C<set_description($new_desc)>
Description: Changes the description of the component.