Skip to content

Commit b332f12

Browse files
committed
Show necessary config changes when adding/renaming a constituency
1 parent d987c0c commit b332f12

1 file changed

Lines changed: 88 additions & 0 deletions

File tree

bin/add_constituency.in

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ END
207207
if ($ok) {
208208
$RT::Handle->Commit;
209209
notify "Done. Enjoy your new constituency.\n";
210+
notify_config_changes();
210211
return 0;
211212
}
212213
else {
@@ -254,6 +255,7 @@ END
254255
if ($ok) {
255256
$RT::Handle->Commit;
256257
notify "Renamed constituency '$old' to '$new'.\n";
258+
notify_config_changes();
257259
return 0;
258260
}
259261
else {
@@ -270,3 +272,89 @@ sub prompt_yN {
270272
return 1;
271273
}
272274

275+
sub notify_config_changes {
276+
notify <<"EOF";
277+
Please add the following config to your RT_SiteConfig.pm:
278+
279+
Set(%CustomFieldGroupings,
280+
'RT::Ticket' => {
281+
'Incidents - $constituency' => [
282+
'Networking' => [ 'IP', 'Domain' ],
283+
'Details' => [
284+
'How Reported', 'Reporter Type', 'Customer', 'Description',
285+
'Resolution', 'Function', 'Classification', 'CVE ID',
286+
'Customer', 'Netmask', 'Port', 'Where Blocked'
287+
],
288+
],
289+
'Incident Reports - $constituency' => [
290+
'Networking' => [ 'IP', 'Domain' ],
291+
'Details' => [
292+
'How Reported', 'Reporter Type', 'Customer', 'Description',
293+
'Resolution', 'Function', 'Classification', 'CVE ID',
294+
'Customer', 'Netmask', 'Port', 'Where Blocked'
295+
],
296+
],
297+
'Investigations - $constituency' => [
298+
'Networking' => [ 'IP', 'Domain' ],
299+
'Details' => [
300+
'How Reported', 'Reporter Type', 'Customer', 'Description',
301+
'Resolution', 'Function', 'Classification', 'CVE ID',
302+
'Customer', 'Netmask', 'Port', 'Where Blocked'
303+
],
304+
],
305+
'Countermeasures - $constituency' => [
306+
'Networking' => [ 'IP', 'Domain' ],
307+
'Details' => [
308+
'How Reported', 'Reporter Type', 'Customer', 'Description',
309+
'Resolution', 'Function', 'Classification', 'CVE ID',
310+
'Customer', 'Netmask', 'Port', 'Where Blocked'
311+
],
312+
],
313+
},
314+
);
315+
316+
Set(%LinkedQueuePortlets,
317+
( 'Incidents - $constituency' => [
318+
{ 'Incident Reports - $constituency' => ['All'] },
319+
{ 'Investigations - $constituency' => ['All'] },
320+
{ 'Countermeasures - $constituency' => ['All'] },
321+
],
322+
)
323+
);
324+
325+
Set(%PageLayoutMapping,
326+
'RT::Ticket' => {
327+
Display => [
328+
{ Type => 'Queue',
329+
Layout => {
330+
'Incidents - $constituency' => 'Incidents',
331+
'Incident Reports - $constituency' => 'Incident Reports',
332+
'Investigations - $constituency' => 'Investigations',
333+
'Countermeasures - $constituency' => 'Countermeasures',
334+
},
335+
},
336+
],
337+
Create => [
338+
{ Type => 'Queue',
339+
Layout => {
340+
'Incidents - $constituency' => 'Incidents',
341+
'Incident Reports - $constituency' => 'Incident Reports',
342+
'Investigations - $constituency' => 'Investigations',
343+
'Countermeasures - $constituency' => 'Countermeasures',
344+
},
345+
},
346+
],
347+
Update => [
348+
{ Type => 'Queue',
349+
Layout => {
350+
'Incidents - $constituency' => 'Incidents',
351+
'Incident Reports - $constituency' => 'Incident Reports',
352+
'Investigations - $constituency' => 'Investigations',
353+
'Countermeasures - $constituency' => 'Countermeasures',
354+
},
355+
},
356+
],
357+
}
358+
);
359+
EOF
360+
}

0 commit comments

Comments
 (0)