summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2017-07-19 16:51:04 +0200
committerGitHub <noreply@github.com>2017-07-19 16:51:04 +0200
commitfa9970f7a6545fd9ed81a2fef23e5453db46bbec (patch)
tree3f717e6160c559e47638a4d47d3aabd3c85437e5
parent9425931a1ae8add4d05b01382516f95b2e74c5c3 (diff)
downloadbugzilla-fa9970f7a6545fd9ed81a2fef23e5453db46bbec.tar.gz
bugzilla-fa9970f7a6545fd9ed81a2fef23e5453db46bbec.tar.xz
Bug 1382085 - Add find_first_flag_type() to Bugzilla::Component
-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.