Skip to content

Commit aad9a94

Browse files
committed
Bug 1264821 - We want to replace the project kick-off form with a contract request form
1 parent 10bf6d4 commit aad9a94

13 files changed

Lines changed: 771 additions & 923 deletions

extensions/MozProjectReview/Extension.pm

Lines changed: 33 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,14 @@ use warnings;
1212

1313
use base qw(Bugzilla::Extension);
1414

15+
our $VERSION = '0.01';
16+
1517
use Bugzilla::User;
1618
use Bugzilla::Group;
1719
use Bugzilla::Error;
1820
use Bugzilla::Constants;
1921

20-
our $VERSION = '0.01';
21-
22-
# these users will be cc'd to the parent bug when the corresponding child bug
23-
# is created, as well as the child bug.
24-
our %auto_cc = (
25-
'legal' => ['liz@mozilla.com'],
26-
'finance' => ['waoieong@mozilla.com', 'mcristobal@mozilla.com', 'echoe@mozilla.com'],
27-
'privacy-vendor' => ['smartin@mozilla.com'],
28-
'privacy-project' => ['ahua@mozilla.com'],
29-
'privacy-tech' => ['ahua@mozilla.com'],
30-
'policy-business-partner' => ['smartin@mozilla.com']
31-
);
22+
use List::MoreUtils qw(any);
3223

3324
sub post_bug_after_creation {
3425
my ($self, $args) = @_;
@@ -39,50 +30,28 @@ sub post_bug_after_creation {
3930
my $params = Bugzilla->input_params;
4031
my $template = Bugzilla->template;
4132

42-
return if !($params->{format}
43-
&& $params->{format} eq 'moz-project-review'
44-
&& $bug->component eq 'Project Review');
33+
return if !($params->{format} && $params->{format} eq 'moz-project-review');
4534

4635
# do a match if applicable
4736
Bugzilla::User::match_field({
48-
'legal_cc' => { 'type' => 'multi' }
37+
'sow_vendor_mozcontact' => { 'type' => 'single' },
4938
});
5039

51-
my ($do_sec_review, $do_legal, $do_finance, $do_data_compliance);
52-
53-
if ($params->{'mozilla_data'} eq 'Yes') {
54-
$do_legal = 1;
55-
$do_data_compliance = 1;
40+
my $do_sec_review = 0;
41+
my @sec_review_needed = (
42+
'Engaging a new vendor company',
43+
'Engaging an individual (independent contractor, temp agency worker, incorporated)',
44+
'Adding a new SOW with a vendor',
45+
'Extending an SOW or renewing a contract',
46+
'Purchasing software',
47+
'Signing up for an online service',
48+
);
49+
if ((any { $_ eq $params->{contract_type} } @sec_review_needed)
50+
|| $params->{mozilla_data} eq 'Yes') {
5651
$do_sec_review = 1;
5752
}
5853

59-
if ($params->{'separate_party'} eq 'Yes') {
60-
if ($params->{'relationship_type'} ne 'Hardware Purchase') {
61-
$do_legal = 1;
62-
}
63-
64-
if ($params->{'data_access'} eq 'Yes') {
65-
$do_data_compliance = 1;
66-
$do_legal = 1;
67-
$do_sec_review = 1;
68-
}
69-
70-
if ($params->{'data_access'} eq 'Yes'
71-
&& $params->{'privacy_policy_vendor_user_data'} eq 'Yes')
72-
{
73-
$do_data_compliance = 1;
74-
}
75-
76-
if ($params->{'vendor_cost'} eq '> $25,000'
77-
|| ($params->{'vendor_cost'} eq '<= $25,000'
78-
&& $params->{'po_needed'} eq 'Yes'))
79-
{
80-
$do_finance = 1;
81-
}
82-
}
83-
84-
my ($sec_review_bug, $legal_bug, $finance_bug, $data_compliance_bug,
85-
$error, @dep_comment, @dep_errors, @send_mail);
54+
my ($sec_review_bug, $finance_bug, $error, @dep_comment, @dep_errors, @send_mail);
8655

8756
# Common parameters always passed to _file_child_bug
8857
# bug_data and template_suffix will be different for each bug
@@ -105,79 +74,27 @@ sub post_bug_after_creation {
10574
rep_platform => 'All',
10675
version => 'unspecified',
10776
blocked => $bug->bug_id,
77+
cc => $params->{cc},
10878
};
10979
$child_params->{'template_suffix'} = 'sec-review';
11080
_file_child_bug($child_params);
11181
}
11282

113-
if ($do_legal) {
114-
my $component = 'General';
115-
116-
if ($params->{separate_party} eq 'Yes'
117-
&& $params->{relationship_type})
118-
{
119-
$component = ($params->{relationship_type} eq 'Other'
120-
|| $params->{relationship_type} eq 'Hardware Purchase')
121-
? 'General'
122-
: $params->{relationship_type};
123-
}
124-
125-
my $legal_summary = "Legal Review: ";
126-
$legal_summary .= $params->{legal_other_party} . " - " if $params->{legal_other_party};
127-
$legal_summary .= $bug->short_desc;
128-
129-
$child_params->{'bug_data'} = {
130-
short_desc => $legal_summary,
131-
product => 'Legal',
132-
component => $component,
133-
bug_severity => 'normal',
134-
priority => '--',
135-
groups => [ 'legal' ],
136-
op_sys => 'All',
137-
rep_platform => 'All',
138-
version => 'unspecified',
139-
blocked => $bug->bug_id,
140-
cc => $params->{'legal_cc'},
141-
};
142-
$child_params->{'template_suffix'} = 'legal';
143-
_file_child_bug($child_params);
144-
}
145-
146-
if ($do_finance) {
147-
$child_params->{'bug_data'} = {
148-
short_desc => 'Finance Review: ' . $bug->short_desc,
149-
product => 'Finance',
150-
component => 'Purchase Request Form',
151-
bug_severity => 'normal',
152-
priority => '--',
153-
groups => [ 'finance' ],
154-
op_sys => 'All',
155-
rep_platform => 'All',
156-
version => 'unspecified',
157-
blocked => $bug->bug_id,
158-
};
159-
$child_params->{'template_suffix'} = 'finance';
160-
_file_child_bug($child_params);
161-
}
162-
163-
if ($do_data_compliance) {
164-
$child_params->{'bug_data'} = {
165-
short_desc => 'Data Compliance Review: ' . $bug->short_desc,
166-
product => 'Data Compliance',
167-
component => 'General',
168-
bug_severity => 'normal',
169-
priority => '--',
170-
bug_severity => $params->{data_comp_urgency},
171-
groups => [ 'mozilla-employee-confidential' ],
172-
op_sys => 'All',
173-
rep_platform => 'All',
174-
version => 'unspecified',
175-
cf_due_date => $params->{release_date},
176-
blocked => $bug->bug_id,
177-
};
178-
$child_params->{'template_suffix'} = 'data-compliance';
179-
_file_child_bug($child_params);
180-
}
83+
$child_params->{'bug_data'} = {
84+
short_desc => 'Finance Review: ' . $bug->short_desc,
85+
product => 'Finance',
86+
component => 'Purchase Request Form',
87+
bug_severity => 'normal',
88+
priority => '--',
89+
groups => [ 'finance' ],
90+
op_sys => 'All',
91+
rep_platform => 'All',
92+
version => 'unspecified',
93+
blocked => $bug->bug_id,
94+
cc => $params->{cc},
95+
};
96+
$child_params->{'template_suffix'} = 'finance';
97+
_file_child_bug($child_params);
18198

18299
if (scalar @dep_errors) {
183100
warn "[Bug " . $bug->id . "] Failed to create additional moz-project-review bugs:\n" .
@@ -214,16 +131,10 @@ sub _file_child_bug {
214131
Bugzilla->template->process($full_template, $template_vars, \$comment)
215132
|| ThrowTemplateError(Bugzilla->template->error());
216133
$bug_data->{'comment'} = $comment;
217-
if (exists $auto_cc{$template_suffix}) {
218-
$bug_data->{'cc'} = $auto_cc{$template_suffix};
219-
}
220134
if ($new_bug = Bugzilla::Bug->create($bug_data)) {
221135
my $set_all = {
222136
dependson => { add => [ $new_bug->bug_id ] }
223137
};
224-
if (exists $auto_cc{$template_suffix}) {
225-
$set_all->{'cc'} = { add => $auto_cc{$template_suffix} };
226-
}
227138
$parent_bug->set_all($set_all);
228139
$parent_bug->update($parent_bug->creation_ts);
229140
}

extensions/MozProjectReview/template/en/default/bug/create/comment-moz-project-review-data-compliance.txt.tmpl

Lines changed: 0 additions & 28 deletions
This file was deleted.

extensions/MozProjectReview/template/en/default/bug/create/comment-moz-project-review-finance.txt.tmpl

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,28 @@
99
[% USE Bugzilla %]
1010
[% cgi = Bugzilla.cgi %]
1111

12-
[% PROCESS "bug/create/comment-moz-project-review.txt.tmpl" %]
12+
[% PROCESS "bug/create/initial-questions-comment.txt.tmpl" %]
1313

14-
Finance Questions:
14+
[% RETURN IF cgi.param('vendor_cost') != '< $25,000 PO Needed' && cgi.param('vendor_cost') != '> $25,000' %]
15+
>> Finance Question
1516

16-
Vendor: [% cgi.param('finance_purchase_vendor') %]
1717
Is this line item in budget?:
1818
[%+ cgi.param('finance_purchase_inbudget') %]
19+
1920
What is the purchase for?:
2021
[%+ cgi.param('finance_purchase_what') %]
22+
2123
Why is the purchase needed?:
2224
[%+ cgi.param('finance_purchase_why') %]
25+
2326
What is the risk if not purchased?:
2427
[%+ cgi.param('finance_purchase_risk') %]
25-
What is the alternative?:
28+
29+
What is the alternative?:
2630
[%+ cgi.param('finance_purchase_alternative') %]
27-
What is the urgency?: [% cgi.param('finance_purchase_urgency') %]
31+
2832
What is the shipping address?:
2933
[%+ cgi.param('finance_shipment_address') %]
30-
Total Cost: [% cgi.param('finance_purchase_cost') %]
34+
35+
Total not to exceed amount:
36+
[%+ cgi.param('sow_vendor_total_max') %]

extensions/MozProjectReview/template/en/default/bug/create/comment-moz-project-review-legal.txt.tmpl

Lines changed: 0 additions & 51 deletions
This file was deleted.

extensions/MozProjectReview/template/en/default/bug/create/comment-moz-project-review-privacy-policy.txt.tmpl

Lines changed: 0 additions & 17 deletions
This file was deleted.

extensions/MozProjectReview/template/en/default/bug/create/comment-moz-project-review-privacy-tech.txt.tmpl

Lines changed: 0 additions & 12 deletions
This file was deleted.

extensions/MozProjectReview/template/en/default/bug/create/comment-moz-project-review-privacy-vendor.txt.tmpl

Lines changed: 0 additions & 16 deletions
This file was deleted.

extensions/MozProjectReview/template/en/default/bug/create/comment-moz-project-review-sec-review.txt.tmpl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
[% USE Bugzilla %]
1010
[% cgi = Bugzilla.cgi %]
1111

12-
[% PROCESS "bug/create/comment-moz-project-review.txt.tmpl" %]
12+
[% PROCESS "bug/create/initial-questions-comment.txt.tmpl" %]
1313

14-
Security Review Questions:
14+
>> Vendor Security Review Questions
15+
16+
Review Invitees:
17+
[%+ cgi.param('sec_review_invitees') %]
1518

16-
Affects Products: [% cgi.param('sec_affects_products') %]
17-
Review Due Date: [% cgi.param('sec_review_date') %]
18-
Review Invitees: [% cgi.param('sec_review_invitees') %]
1919
Extra Information:
2020
[%+ cgi.param('sec_review_extra') %]

0 commit comments

Comments
 (0)