diff options
Diffstat (limited to 'extensions/BMO/lib/Reports/Recruiting.pm')
-rw-r--r-- | extensions/BMO/lib/Reports/Recruiting.pm | 126 |
1 files changed, 62 insertions, 64 deletions
diff --git a/extensions/BMO/lib/Reports/Recruiting.pm b/extensions/BMO/lib/Reports/Recruiting.pm index 39eb8327d..c35b0cbff 100644 --- a/extensions/BMO/lib/Reports/Recruiting.pm +++ b/extensions/BMO/lib/Reports/Recruiting.pm @@ -17,33 +17,30 @@ use Bugzilla::Product; use Bugzilla::Component; sub report { - my ($vars) = @_; - my $user = Bugzilla->user; - - $user->in_group('hr') - || ThrowUserError('auth_failure', { group => 'hr', - action => 'run', - object => 'recruiting_dashboard' }); - - my $product = Bugzilla::Product->check({ name => 'Recruiting', cache => 1 }); - my $component = Bugzilla::Component->new({ product => $product, name => 'General', cache => 1 }); - - # find all open recruiting bugs - my $bugs = Bugzilla::Bug->match({ - product_id => $product->id, - component_id => $component->id, - resolution => '', - }); - - # filter bugs based on visibility and re-bless - $user->visible_bugs($bugs); - $bugs = [ - map { bless($_, 'RecruitingBug') } - grep { $user->can_see_bug($_->id) } - @$bugs - ]; - - $vars->{bugs} = $bugs; + my ($vars) = @_; + my $user = Bugzilla->user; + + $user->in_group('hr') + || ThrowUserError('auth_failure', + {group => 'hr', action => 'run', object => 'recruiting_dashboard'}); + + my $product = Bugzilla::Product->check({name => 'Recruiting', cache => 1}); + my $component = Bugzilla::Component->new( + {product => $product, name => 'General', cache => 1}); + + # find all open recruiting bugs + my $bugs = Bugzilla::Bug->match({ + product_id => $product->id, + component_id => $component->id, + resolution => '', + }); + + # filter bugs based on visibility and re-bless + $user->visible_bugs($bugs); + $bugs = [map { bless($_, 'RecruitingBug') } + grep { $user->can_see_bug($_->id) } @$bugs]; + + $vars->{bugs} = $bugs; } 1; @@ -58,55 +55,56 @@ use Bugzilla::Comment; use Bugzilla::Util qw(trim); sub _extract { - my ($self) = @_; - return if exists $self->{recruitment_data}; - $self->{recruitment_data} = {}; - - # we only need the first comment - my $comment = Bugzilla::Comment->match({ - bug_id => $self->id, - LIMIT => 1, - })->[0]->body; - - # extract just what we need - # changing the comment will break this - - if ($comment =~ /\nHiring Manager:\s+(.+)VP Authority:\n/s) { - $self->{recruitment_data}->{hiring_manager} = trim($1); - } - if ($comment =~ /\nVP Authority:\s+(.+)HRBP:\n/s) { - $self->{recruitment_data}->{scvp} = trim($1); - } - if ($comment =~ /\nWhat part of your strategic plan does this role impact\?\s+(.+)Why is this critical for success\?\n/s) { - $self->{recruitment_data}->{strategic_plan} = trim($1); - } - if ($comment =~ /\nWhy is this critical for success\?\s+(.+)$/s) { - $self->{recruitment_data}->{why_critical} = trim($1); - } + my ($self) = @_; + return if exists $self->{recruitment_data}; + $self->{recruitment_data} = {}; + + # we only need the first comment + my $comment + = Bugzilla::Comment->match({bug_id => $self->id, LIMIT => 1,})->[0]->body; + + # extract just what we need + # changing the comment will break this + + if ($comment =~ /\nHiring Manager:\s+(.+)VP Authority:\n/s) { + $self->{recruitment_data}->{hiring_manager} = trim($1); + } + if ($comment =~ /\nVP Authority:\s+(.+)HRBP:\n/s) { + $self->{recruitment_data}->{scvp} = trim($1); + } + if ($comment + =~ /\nWhat part of your strategic plan does this role impact\?\s+(.+)Why is this critical for success\?\n/s + ) + { + $self->{recruitment_data}->{strategic_plan} = trim($1); + } + if ($comment =~ /\nWhy is this critical for success\?\s+(.+)$/s) { + $self->{recruitment_data}->{why_critical} = trim($1); + } } sub hiring_manager { - my ($self) = @_; - $self->_extract(); - return $self->{recruitment_data}->{hiring_manager}; + my ($self) = @_; + $self->_extract(); + return $self->{recruitment_data}->{hiring_manager}; } sub scvp { - my ($self) = @_; - $self->_extract(); - return $self->{recruitment_data}->{scvp}; + my ($self) = @_; + $self->_extract(); + return $self->{recruitment_data}->{scvp}; } sub strategic_plan { - my ($self) = @_; - $self->_extract(); - return $self->{recruitment_data}->{strategic_plan}; + my ($self) = @_; + $self->_extract(); + return $self->{recruitment_data}->{strategic_plan}; } sub why_critical { - my ($self) = @_; - $self->_extract(); - return $self->{recruitment_data}->{why_critical}; + my ($self) = @_; + $self->_extract(); + return $self->{recruitment_data}->{why_critical}; } 1; |