summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'extensions')
-rw-r--r--extensions/BMO/Extension.pm4
-rw-r--r--extensions/BMO/lib/Reports/Recruiting.pm107
-rw-r--r--extensions/BMO/template/en/default/bug/create/comment-recruiting.txt.tmpl27
-rw-r--r--extensions/BMO/template/en/default/hook/global/user-error-auth_failure_object.html.tmpl2
-rw-r--r--extensions/BMO/template/en/default/hook/reports/menu-end.html.tmpl7
-rw-r--r--extensions/BMO/template/en/default/pages/recruiting_dashboard.html.tmpl46
6 files changed, 178 insertions, 15 deletions
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm
index 62f88287a..637ff3139 100644
--- a/extensions/BMO/Extension.pm
+++ b/extensions/BMO/Extension.pm
@@ -174,6 +174,10 @@ sub page_before_template {
require Bugzilla::Extension::BMO::Reports::Groups;
Bugzilla::Extension::BMO::Reports::Groups::members_report($vars);
}
+ elsif ($page eq 'recruiting_dashboard.html') {
+ require Bugzilla::Extension::BMO::Reports::Recruiting;
+ Bugzilla::Extension::BMO::Reports::Recruiting::report($vars);
+ }
elsif ($page eq 'email_queue.html') {
print Bugzilla->cgi->redirect('view_job_queue.cgi');
}
diff --git a/extensions/BMO/lib/Reports/Recruiting.pm b/extensions/BMO/lib/Reports/Recruiting.pm
new file mode 100644
index 000000000..34d61b681
--- /dev/null
+++ b/extensions/BMO/lib/Reports/Recruiting.pm
@@ -0,0 +1,107 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This Source Code Form is "Incompatible With Secondary Licenses", as
+# defined by the Mozilla Public License, v. 2.0.
+
+package Bugzilla::Extension::BMO::Reports::Recruiting;
+use strict;
+use warnings;
+
+use Bugzilla::Error;
+use Bugzilla::Bug;
+use Bugzilla::Product;
+
+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 });
+
+ # find all open recruiting bugs
+ my $bugs = Bugzilla::Bug->match({
+ product_id => $product->id,
+ resolution => '',
+ });
+
+ # filter bugs based on visibility and re-bless
+ $user->visible_bugs($bugs);
+ $bugs = [
+ map { bless($_, 'RecuritingBug') }
+ grep { $user->can_see_bug($_->id) }
+ @$bugs
+ ];
+
+ $vars->{bugs} = $bugs;
+}
+
+1;
+
+package RecuritingBug;
+use strict;
+use warnings;
+
+use base qw(Bugzilla::Bug);
+
+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);
+ }
+}
+
+sub hiring_manager {
+ my ($self) = @_;
+ $self->_extract();
+ return $self->{recruitment_data}->{hiring_manager};
+}
+
+sub scvp {
+ my ($self) = @_;
+ $self->_extract();
+ return $self->{recruitment_data}->{scvp};
+}
+
+sub 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};
+}
+
+1;
diff --git a/extensions/BMO/template/en/default/bug/create/comment-recruiting.txt.tmpl b/extensions/BMO/template/en/default/bug/create/comment-recruiting.txt.tmpl
index 579d385f9..077697b32 100644
--- a/extensions/BMO/template/en/default/bug/create/comment-recruiting.txt.tmpl
+++ b/extensions/BMO/template/en/default/bug/create/comment-recruiting.txt.tmpl
@@ -1,22 +1,19 @@
-[%# The contents of this file are subject to the Mozilla Public
- # License Version 1.1 (the "License"); you may not use this file
- # except in compliance with the License. You may obtain a copy of
- # the License at http://www.mozilla.org/MPL/
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
- # Software distributed under the License is distributed on an "AS
- # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- # implied. See the License for the specific language governing
- # rights and limitations under the License.
- #
- # The Original Code is the BMO Bugzilla Extension.
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[%#
+ # IMPORTANT
#
- # The Initial Developer of the Original Code is the Mozilla Foundation
- # Portions created by the Initial Developers are Copyright (C) 2011 the
- # Initial Developer. All Rights Reserved.
+ # If you update this template, you must also update the parsing code in
+ # extensions/BMO/lib/Reports/Recruiting.pm
#
- # Contributor(s):
- # David Lawrence <dkl@mozilla.com>
#%]
+
[% USE Bugzilla %]
[% cgi = Bugzilla.cgi %]
diff --git a/extensions/BMO/template/en/default/hook/global/user-error-auth_failure_object.html.tmpl b/extensions/BMO/template/en/default/hook/global/user-error-auth_failure_object.html.tmpl
index 7fae9d1b0..9a1f220dd 100644
--- a/extensions/BMO/template/en/default/hook/global/user-error-auth_failure_object.html.tmpl
+++ b/extensions/BMO/template/en/default/hook/global/user-error-auth_failure_object.html.tmpl
@@ -16,4 +16,6 @@
comments
[% ELSIF object == 'bounty_attachments' %]
bounty attachments
+[% ELSIF object == 'recruiting_dashboard' %]
+ the Recruiting Dashboard
[% END %]
diff --git a/extensions/BMO/template/en/default/hook/reports/menu-end.html.tmpl b/extensions/BMO/template/en/default/hook/reports/menu-end.html.tmpl
index 34c51db81..991a685be 100644
--- a/extensions/BMO/template/en/default/hook/reports/menu-end.html.tmpl
+++ b/extensions/BMO/template/en/default/hook/reports/menu-end.html.tmpl
@@ -59,5 +59,12 @@
</strong> - TheSchwartz queue
</li>
[% END %]
+ [% IF user.in_group('hr') %]
+ <li>
+ <strong>
+ <a href="[% urlbase FILTER none %]page.cgi?id=recruiting_dashboard.html">Recruiting Dashboard</a>
+ </strong> - Dashboard for open requested requisitions.
+ </li>
+ [% END %]
</ul>
diff --git a/extensions/BMO/template/en/default/pages/recruiting_dashboard.html.tmpl b/extensions/BMO/template/en/default/pages/recruiting_dashboard.html.tmpl
new file mode 100644
index 000000000..8eeae3b87
--- /dev/null
+++ b/extensions/BMO/template/en/default/pages/recruiting_dashboard.html.tmpl
@@ -0,0 +1,46 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+ # License, v. 2.0. If a copy of the MPL was not distributed with this
+ # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ #
+ # This Source Code Form is "Incompatible With Secondary Licenses", as
+ # defined by the Mozilla Public License, v. 2.0.
+ #%]
+
+[% PROCESS global/variables.none.tmpl %]
+[% INCLUDE global/header.html.tmpl
+ title = "Recruiting Dashboard"
+ style_urls = [ "extensions/BMO/web/styles/reports.css" ]
+ style = "#report td { vertical-align: top; }"
+%]
+
+<h1>Recuriting Dashboard</h1>
+
+[% IF bugs.size %]
+ <table border="0" cellspacing="0" id="report" class="hover" width="100%">
+ <tr id="report-header">
+ <th>[% terms.Bug %]</th>
+ <th>Summary</th>
+ <th>Hiring Manager</th>
+ <th>SCVP</th>
+ <th>Part of Strategic Plan</th>
+ <th>Why is this critical for success</th>
+ </tr>
+
+ [% FOREACH bug = bugs %]
+ <tr class="report_item [% loop.count % 2 == 1 ? "report_row_odd" : "report_row_even" %]">
+ <td>[% bug.id FILTER bug_link(bug) FILTER none %]</td>
+ <td>[% bug.short_desc FILTER html %]</td>
+ <td>[% bug.hiring_manager FILTER html %]</td>
+ <td>[% bug.scvp FILTER html %]</td>
+ <td>[% bug.strategic_plan FILTER html FILTER html_line_break %]</td>
+ <td>[% bug.why_critical FILTER html FILTER html_line_break %]</td>
+ </tr>
+ [% END %]
+ </table>
+[% ELSE %]
+ <p>
+ No open recruiting requisitions.
+ </p>
+[% END %]
+
+[% INCLUDE global/footer.html.tmpl %]