@@ -12,23 +12,14 @@ use warnings;
1212
1313use base qw( Bugzilla::Extension) ;
1414
15+ our $VERSION = ' 0.01' ;
16+
1517use Bugzilla::User;
1618use Bugzilla::Group;
1719use Bugzilla::Error;
1820use 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
3324sub 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 }
0 commit comments