collect CCs from original email, with extra settings in RT_SiteConfig
[monitor.git] / rt3 / initialdata
1 # Initial data for a fresh RT3 Installation.
2
3 @Users = (
4     {  Name     => 'Nobody',
5        RealName => 'Nobody in particular',
6        Comments => 'Do not delete or modify this user. It is integral '
7          . 'to RT\'s internal data structures',
8        Privileged => '0', },
9
10     {  Name         => 'root',
11        Gecos        => 'root',
12        RealName     => 'RT Admin',
13        Password     => 'password',
14        EmailAddress => "root\@localhost",
15        Comments     => 'SuperUser',
16        Privileged   => '1', } );
17
18 @Groups = (
19     { Name        => '',
20       Type        => 'Everyone',                        # loc
21       Domain      => 'SystemInternal',
22       Instance    => '',
23       Description => 'Pseudogroup for internal use',    # loc
24     },
25     { Type        => 'Privileged',                      # loc
26       Domain      => 'SystemInternal',
27       Instance    => '',
28       Name        => '',
29       Description => 'Pseudogroup for internal use',    # loc
30     },
31     { Name        => '',
32       Type        => 'Unprivileged',                    # loc
33       Domain      => 'SystemInternal',
34       Instance    => '',
35       Description => 'Pseudogroup for internal use',    # loc
36     },
37     { Name        => '',
38       Type        => 'Owner',                               # loc
39       Domain      => 'RT::System-Role',
40       Instance    => '',
41       Description => 'SystemRolegroup for internal use',    # loc
42     },
43     { Name        => '',
44       Type        => 'Requestor',                           # loc
45       Domain      => 'RT::System-Role',
46       Instance    => '',
47       Description => 'SystemRolegroup for internal use',    # loc
48     },
49     { Name        => '',
50       Type        => 'Cc',                                  # loc
51       Domain      => 'RT::System-Role',
52       Instance    => '',
53       Description => 'SystemRolegroup for internal use',    # loc
54     },
55     { Name        => '',
56       Type        => 'AdminCc',                             # loc
57       Domain      => 'RT::System-Role',
58       Instance    => '',
59       Description => 'Pseudogroup for internal use',        # loc
60     }, );
61
62 @Queues = ({ Name              => 'support',
63              Description       => 'Support',
64              CorrespondAddress => 'support@PLC_RT_HOSTNAME',
65              CommentAddress    => '', },
66
67                    { Name              => 'monitor',
68              Description       => 'Queue for monitor',
69              CorrespondAddress => 'monitor@PLC_RT_HOSTNAME',
70              CommentAddress    => '', },
71
72                    { Name              => 'security',
73              Description       => 'Queue for security issues',
74              CorrespondAddress => 'security@PLC_RT_HOSTNAME',
75              CommentAddress    => '', },
76
77                    { Name              => 'legal',
78              Description       => 'Queue for legal issues',
79              CorrespondAddress => 'legal@PLC_RT_HOSTNAME',
80              CommentAddress    => '', },
81
82            { Name        => '___Approvals',
83              Description => 'A system-internal queue for the approvals system',
84              Disabled    => 2, } );
85
86 @ScripActions = (
87
88     {  Name        => 'Autoreply To Requestors',    # loc
89        Description =>
90 'Always sends a message to the requestors independent of message sender' ,                                            # loc
91        ExecModule => 'Autoreply',
92        Argument   => 'Requestor' },
93     { Name        => 'Notify Requestors',                    # loc
94       Description => 'Sends a message to the requestors',    # loc
95       ExecModule  => 'Notify',
96       Argument    => 'Requestor' },
97     { Name        => 'Notify Owner as Comment',              # loc
98       Description => 'Sends mail to the owner',              # loc
99       ExecModule  => 'NotifyAsComment',
100       Argument    => 'Owner' },
101     { Name        => 'Notify Owner',                         # loc
102       Description => 'Sends mail to the owner',              # loc
103       ExecModule  => 'Notify',
104       Argument    => 'Owner' },
105     { Name        => 'Notify Ccs as Comment',              # loc
106       Description => 'Sends mail to the Ccs as a comment', # loc
107       ExecModule  => 'NotifyAsComment',
108       Argument    => 'Cc' },
109     { Name        => 'Notify Ccs',                                   # loc
110       Description => 'Sends mail to the Ccs',                        # loc
111       ExecModule  => 'Notify',
112       Argument    => 'Cc' },
113     { Name        => 'Notify AdminCcs as Comment',                        # loc
114       Description => 'Sends mail to the administrative Ccs as a comment', # loc
115       ExecModule  => 'NotifyAsComment',
116       Argument    => 'AdminCc' },
117     { Name        => 'Notify AdminCcs',                                   # loc
118       Description => 'Sends mail to the administrative Ccs',              # loc
119       ExecModule  => 'Notify',
120       Argument    => 'AdminCc' },
121
122     { Name        => 'Notify Requestors and Ccs as Comment',              # loc
123       Description => 'Send mail to requestors and Ccs as a comment',      # loc
124       ExecModule  => 'NotifyAsComment',
125       Argument    => 'Requestor,Cc' },
126
127     { Name        => 'Notify Requestors and Ccs',                         # loc
128       Description => 'Send mail to requestors and Ccs',                   # loc
129       ExecModule  => 'Notify',
130       Argument    => 'Requestor,Cc' },
131
132     { Name        => 'Notify Requestors, Ccs and AdminCcs as Comment',    # loc
133       Description => 'Send mail to all watchers as a "comment"',          # loc
134       ExecModule  => 'NotifyAsComment',
135       Argument    => 'All' },
136     { Name        => 'Notify Requestors, Ccs and AdminCcs',               # loc
137       Description => 'Send mail to all watchers',                         # loc
138       ExecModule  => 'Notify',
139       Argument    => 'All' },
140     { Name        => 'Notify Other Recipients as Comment',                # loc
141       Description => 'Sends mail to explicitly listed Ccs and Bccs',      # loc
142       ExecModule  => 'NotifyAsComment',
143       Argument    => 'OtherRecipients' },
144     { Name        => 'Notify Other Recipients',                           # loc
145       Description => 'Sends mail to explicitly listed Ccs and Bccs',      # loc
146       ExecModule  => 'Notify',
147       Argument    => 'OtherRecipients' },
148     { Name        => 'User Defined',                                      # loc
149       Description => 'Perform a user-defined action',                     # loc
150       ExecModule  => 'UserDefined', },
151     {  Name        => 'Create Tickets',                                    # loc
152        Description =>
153          'Create new tickets based on this scrip\'s template',             # loc
154        ExecModule => 'CreateTickets', },
155     { Name        => 'Open Tickets',
156       Description => 'Open tickets on correspondence',                    # loc
157       ExecModule  => 'AutoOpen' },
158 );
159
160 @ScripConditions = (
161     { Name                 => 'On Create',                                # loc
162       Description          => 'When a ticket is created',                 # loc
163       ApplicableTransTypes => 'Create',
164       ExecModule           => 'AnyTransaction', },
165
166     { Name                 => 'On Transaction',                           # loc
167       Description          => 'When anything happens',                    # loc
168       ApplicableTransTypes => 'Any',
169       ExecModule           => 'AnyTransaction', },
170     {
171
172       Name                 => 'On Correspond',                             # loc
173       Description          => 'Whenever correspondence comes in',          # loc
174       ApplicableTransTypes => 'Correspond',
175       ExecModule           => 'AnyTransaction', },
176
177     {
178
179       Name                 => 'On Comment',                                # loc
180       Description          => 'Whenever comments come in',                 # loc
181       ApplicableTransTypes => 'Comment',
182       ExecModule           => 'AnyTransaction' },
183     {
184
185       Name                 => 'On Status Change',                          # loc
186       Description          => 'Whenever a ticket\'s status changes',       # loc
187       ApplicableTransTypes => 'Status',
188       ExecModule           => 'AnyTransaction',
189
190     },
191     {
192
193       Name                 => 'On Priority Change',                       # loc
194       Description          => 'Whenever a ticket\'s priority changes',    # loc
195       ApplicableTransTypes => 'Set',
196       ExecModule           => 'PriorityChange',
197     },
198     {
199
200       Name                 => 'On Owner Change',                           # loc
201       Description          => 'Whenever a ticket\'s owner changes',        # loc
202       ApplicableTransTypes => 'Any',
203       ExecModule           => 'OwnerChange',
204
205     },
206     {
207
208       Name                 => 'On Queue Change',                           # loc
209       Description          => 'Whenever a ticket\'s queue changes',        # loc
210       ApplicableTransTypes => 'Set',
211       ExecModule           => 'QueueChange',
212
213     },
214     {  Name                 => 'On Resolve',                               # loc
215        Description          => 'Whenever a ticket is resolved',            # loc
216        ApplicableTransTypes => 'Status',
217        ExecModule           => 'StatusChange',
218        Argument             => 'resolved'
219
220     },
221
222     {  Name                 => 'User Defined',                             # loc
223        Description          => 'Whenever a user-defined condition occurs', # loc
224        ApplicableTransTypes => 'Any',
225        ExecModule           => 'UserDefined'
226
227     },
228
229 );
230
231 @Templates = (
232     { Queue       => '0',
233       Name        => 'Blank',                                             # loc
234       Description => 'A blank template',                                  # loc
235       Content     => '', },
236
237     {  Queue       => '0',
238        Name        => 'Transaction',                     # loc
239        Description => 'Default transaction template',    # loc
240        Content     => 'RT-Attach-Message: yes
241
242
243 {$Transaction->CreatedAsString}: Request {$Ticket->id} was acted upon.
244 Transaction: {$Transaction->Description}
245        Queue: {$Ticket->QueueObj->Name}
246      Subject: {$Transaction->Subject || $Ticket->Subject || "(No subject given)"}
247        Owner: {$Ticket->OwnerObj->Name}
248   Requestors: {$Ticket->RequestorAddresses}
249       Status: {$Ticket->Status}
250  Ticket <URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id} >
251
252
253 {$Transaction->Content()}
254 '
255     },
256
257     {
258
259       Queue       => '0',
260       Name        => 'Admin Correspondence',                     # loc
261       Description => 'Default admin correspondence template',    # loc
262       Content     => 'RT-Attach-Message: yes
263
264
265 <URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id} >
266
267 {$Transaction->Content()}
268 '
269     },
270
271     {  Queue       => '0',
272        Name        => 'Correspondence',                          # loc
273        Description => 'Default correspondence template',         # loc
274        Content     => 'RT-Attach-Message: yes
275
276 {$Transaction->Content()}
277 '
278     },
279
280     {  Queue       => '0',
281        Name        => 'Admin Comment',                           # loc
282        Description => 'Default admin comment template',          # loc
283        Content     =>
284 'Subject: [Comment] {my $s=($Transaction->Subject||$Ticket->Subject); $s =~ s/\\[Comment\\]//g; $comment =~ s/^Re//i; $s;}
285
286
287 {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}
288 This is a comment.  It is not sent to the Requestor(s):
289
290 {$Transaction->Content()}
291 '
292     },
293
294     {  Queue       => '0',
295        Name        => 'Status Change',                                     # loc
296        Description => 'Ticket status changed',                             # loc
297        Content     => 'Subject: Status Changed to: {$Transaction->NewValue}
298
299
300 {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}
301
302 {$Transaction->Content()}
303 '
304     },
305
306     {
307
308       Queue       => '0',
309       Name        => 'Resolved',                 # loc
310       Description => 'Ticket Resolved',          # loc
311       Content     => 'Subject: Resolved: {$Ticket->Subject}
312
313 According to our records, your request has been resolved. If you have any
314 further questions or concerns, please respond to this message.
315 '
316     },
317         {
318       Queue       => '0',
319       Name        => 'Create with CC in body',                 # loc
320       Description => 'Create with CC in body',                 # loc
321       Content     => 'RT-Attach-Message: yes
322
323 Email Recipients (see http://PLC_RT_HOSTNAME/rt3/Ticket/Display.html?id={$Ticket->id} )
324     Owner: {$Ticket->OwnerObj->Name}
325     Requestor: {$Ticket->RequestorAddresses}
326 { if ($acc=$Ticket->AdminCcAddresses) { "    Ticket Ccs: " . $acc } }
327 ==================================================
328
329 {$Transaction->CreatedAsString}: Request {$Ticket->id} was acted upon.
330 Transaction: {$Transaction->Description}
331
332 Subject: {$Transaction->Subject || $Ticket->Subject || "(No subject given)"}
333
334 {$Transaction->Content()}
335 '
336         },
337     {  Queue       => '___Approvals',
338        Name        => "New Pending Approval",    # loc
339        Description =>
340          "Notify Owners and AdminCcs of new items pending their approval", # loc
341        Content => 'Subject: New Pending Approval: {$Ticket->Subject}
342
343 Greetings,
344
345 There is a new item pending your approval: "{$Ticket->Subject()}", 
346 a summary of which appears below.
347
348 Please visit {$RT::WebURL}Approvals/Display.html?id={$Ticket->id}
349 to approve or reject this ticket, or {$RT::WebURL}Approvals/ to
350 batch-process all your pending approvals.
351
352 -------------------------------------------------------------------------
353 {$Transaction->Content()}
354 '
355     },
356     {  Queue       => '___Approvals',
357        Name        => "Approval Passed",    # loc
358        Description =>
359          "Notify Owner of their ticket has been approved by some approver", # loc
360        Content => 'Subject: Ticket Approved: {$Ticket->Subject}
361
362 Greetings,
363
364 Your ticket has been approved by { eval { $Approval->OwnerObj->Name } }.
365 Other approvals may be pending.
366 '
367     },
368     {  Queue       => '___Approvals',
369        Name        => "All Approvals Passed",    # loc
370        Description =>
371          "Notify Owner of their ticket has been approved by all approvers", # loc
372        Content => 'Subject: Ticket Approved: {$Ticket->Subject}
373
374 Greetings,
375
376 Your ticket has been approved.  Its Owner may now start to act on it.
377 '
378     },
379     {  Queue       => '___Approvals',
380        Name        => "Approval Rejected",    # loc
381        Description =>
382          "Notify Owner of their rejected ticket", # loc
383        Content => 'Subject: Ticket Rejected: {$Ticket->Subject}
384
385 Greetings,
386
387 Your ticket has been rejected by { eval { $Approval->OwnerObj->Name } }.
388 '
389     },
390 );
391 # }}}
392
393 @Scrips = (
394     {  ScripCondition => 'On Correspond',
395        ScripAction    => 'Open Tickets',
396        Template       => 'Blank' },
397     {  ScripCondition => 'On Owner Change',
398        ScripAction    => 'Notify Owner',
399        Template       => 'Transaction' },
400     {  ScripCondition => 'On Create',
401        ScripAction    => 'AutoReply To Requestors',
402        Template       => 'AutoReply' },
403     {  ScripCondition => 'On Create',
404        ScripAction    => 'Notify AdminCcs',
405        Template       => 'Transaction' },
406     {  ScripCondition => 'On Correspond',
407        ScripAction    => 'Notify AdminCcs',
408        Template       => 'Admin Correspondence' },
409     {  ScripCondition => 'On Correspond',
410        ScripAction    => 'Notify Requestors And Ccs',
411        Template       => 'Correspondence' },
412     {  ScripCondition => 'On Correspond',
413        ScripAction    => 'Notify Other Recipients',
414        Template       => 'Correspondence' },
415     {  ScripCondition => 'On Comment',
416        ScripAction    => 'Notify AdminCcs As Comment',
417        Template       => 'Admin Comment' },
418     {  ScripCondition => 'On Comment',
419        ScripAction    => 'Notify Other Recipients As Comment',
420        Template       => 'Correspondence' },
421     {  ScripCondition => 'On Resolve',
422        ScripAction    => 'Notify Requestors',
423        Template       => 'Resolved' },
424
425     {  ScripCondition => 'On Create',
426        ScripAction    => 'Notify AdminCcs',
427        Template       => 'Create with CC in body', },
428     {  ScripCondition => 'On Correspond',
429        ScripAction    => 'Notify Requestors, Ccs and AdminCcs',
430        Template       => 'correspondance with CC', },
431     {  Description => "When an approval ticket is created, notify the Owner and AdminCc of the item awaiting their approval",    # loc
432        Queue          => '___Approvals',
433        ScripCondition => 'User Defined',
434        CustomIsApplicableCode => q[
435             $self->TicketObj->Type eq 'approval'        and
436             $self->TransactionObj->Field eq 'Status'    and
437             $self->TransactionObj->NewValue eq 'open'   and
438             eval { $T::Approving = ($self->TicketObj->AllDependedOnBy( Type => 'ticket' ))[0] }
439        ],
440        ScripAction    => 'Notify Owner',
441        Template       => 'New Pending Approval' },
442     {  Description => "If an approval is rejected, reject the original and delete pending approvals",    # loc
443        Queue            => '___Approvals',
444        ScripCondition   => 'On Status Change',
445        ScripAction      => 'User Defined',
446        CustomPrepareCode => q[
447 # ------------------------------------------------------------------- #
448 return(0) unless ( lc($self->TransactionObj->NewValue) eq "rejected" or
449                    lc($self->TransactionObj->NewValue) eq "deleted" );
450
451 my $rejected = 0;
452 my $links = $self->TicketObj->DependedOnBy;
453 foreach my $link (@{ $links->ItemsArrayRef }) {
454     my $obj = $link->BaseObj;
455     if ($obj->QueueObj->IsActiveStatus($obj->Status)) {
456         if ($obj->Type eq 'ticket') {
457             $obj->Comment(
458                 Content => $self->loc("Your request was rejected."),
459             );
460             $obj->SetStatus(
461                 Status  => 'rejected',
462                 Force   => 1,
463             );
464
465             $T::Approval = $self->TicketObj; # so we can access it inside templates
466             $self->{TicketObj} = $obj;  # we want the original id in the token line
467             $rejected = 1;
468         }
469         else {
470             $obj->SetStatus(
471                 Status  => 'deleted',
472                 Force   => 1,
473             );
474         }
475     }
476 }
477
478 $links = $self->TicketObj->DependsOn;
479 foreach my $link (@{ $links->ItemsArrayRef }) {
480     my $obj = $link->TargetObj;
481     if ($obj->QueueObj->IsActiveStatus($obj->Status)) {
482         $obj->SetStatus(
483             Status      => 'deleted',
484             Force       => 1,
485         );
486     }
487 }
488
489 # Now magically turn myself into a Requestor Notify object...
490 require RT::Action::Notify; bless($self, 'RT::Action::Notify');
491 $self->{Argument} = 'Requestor'; $self->Prepare;
492
493 return $rejected;
494 # ------------------------------------------------------------------- #
495         ],
496        CustomCommitCode => '"never needed"',
497        Template          => 'Approval Rejected', },
498     {  Description => "When a ticket has been approved by any approver, add correspondence to the original ticket", # loc
499        Queue             => '___Approvals',
500        ScripCondition    => 'On Resolve',
501        ScripAction       => 'User Defined',
502        CustomPrepareCode => q[
503 # ------------------------------------------------------------------- #
504 return(0) unless ($self->TicketObj->Type eq 'approval');
505
506 my $note;
507 my $t = $self->TicketObj->Transactions;
508 while (my $o = $t->Next) {
509     $note .= $o->Content . "\n" if $o->ContentObj
510             and $o->Content !~ /Default Approval/;
511 }
512
513 foreach my $obj ($self->TicketObj->AllDependedOnBy( Type => 'ticket' )) {
514     $obj->Comment(
515         Content => $self->loc( "Your request has been approved by [_1]. Other approvals may still be pending.", # loc
516             $self->TransactionObj->CreatorObj->Name,
517         ) . "\n" . $self->loc( "Approver's notes: [_1]", # loc
518             $note
519         ),
520     );
521     $T::Approval = $self->TicketObj; # so we can access it inside templates
522     $self->{TicketObj} = $obj;  # we want the original id in the token line
523 }
524
525 # Now magically turn myself into a Requestor Notify object...
526 require RT::Action::Notify; bless($self, 'RT::Action::Notify');
527 $self->{Argument} = 'Requestor'; $self->Prepare;
528
529 return 1;
530 # ------------------------------------------------------------------- #
531         ],
532        CustomCommitCode => '"never needed"',
533        Template => 'Approval Passed' },
534     {  Description => "When a ticket has been approved by all approvers, add correspondence to the original ticket", # loc
535        Queue             => '___Approvals',
536        ScripCondition    => 'On Resolve',
537        ScripAction       => 'User Defined',
538        CustomPrepareCode  => q[
539 # ------------------------------------------------------------------- #
540 # Find all the tickets that depend on this (that this is approving)
541
542 my $Ticket = $self->TicketObj;
543 my @TOP    = $Ticket->AllDependedOnBy( Type => 'ticket' );
544 my $links  = $Ticket->DependedOnBy;
545 my $passed = 0;
546
547 while (my $link = $links->Next) {
548     my $obj = $link->BaseObj;
549     next if ($obj->HasUnresolvedDependencies( Type => 'approval' ));
550
551     if ($obj->Type eq 'ticket') {
552         $obj->Comment(
553             Content     => $self->loc("Your request has been approved."),
554         );
555         $T::Approval  = $Ticket;    # so we can access it inside templates
556         $self->{TicketObj} = $obj;  # we want the original id in the token line
557         $passed = 1;
558     }
559     elsif ($obj->Type eq 'approval') {
560         $obj->SetStatus( Status => 'open', Force => 1 );
561     }
562     elsif ($RT::UseCodeTickets and $obj->Type eq 'code') {
563         my $code = $obj->Transactions->First->Content;
564         my $rv;
565
566         foreach my $TOP (@TOP) {
567             local $@;
568             $rv++ if eval $code;
569             $RT::Logger->error("Cannot eval code: $@") if $@;
570         }
571
572         if ($rv or !@TOP) {
573             $obj->SetStatus( Status     => 'resolved', Force    => 1,);
574         }
575         else {
576             $obj->SetStatus( Status     => 'rejected', Force    => 1,);
577         }
578     }
579 }
580
581 # Now magically turn myself into a Requestor Notify object...
582 require RT::Action::Notify; bless($self, 'RT::Action::Notify');
583 $self->{Argument} = 'Requestor'; $self->Prepare;
584
585 return 0; # ignore $passed;
586 # ------------------------------------------------------------------- #
587         ],
588        CustomCommitCode => '"never needed"',
589        Template => 'All Approvals Passed', },
590
591 );
592
593 @ACL = (
594     { UserId => 'Nobody',      # - principalId
595       Right  => 'OwnTicket', },
596
597     { UserId => 'root',        # - principalid
598       Right  => 'SuperUser', },
599         
600
601 );
602
603 # Predefined searches
604
605 @Attributes = (
606     { Name => 'Search - My Tickets',
607       Description => '[_1] highest priority tickets I own', # loc
608       Content     =>
609       { Format => "'<a href=\"__WebPath__/Ticket/Display.html?id=__id__\">__id__</a>/TITLE:#', '<a href=\"__WebPath__/Ticket/Display.html?id=__id__\">__Subject__</a>/TITLE:Subject', Priority, QueueName, ExtendedStatus",
610         Query   => " Owner = '__CurrentUser__' AND ( Status = 'new' OR Status = 'open')",
611         OrderBy => 'Priority',
612         Order   => 'DESC' },
613     },
614     { Name => 'Search - Unowned Tickets',
615       Description => '[_1] newest unowned tickets', # loc
616       Content     =>
617 # 'Take' #loc
618       { Format => "'<a href=\"__WebPath__/Ticket/Display.html?id=__id__\">__id__</a>/TITLE:#', '<a href=\"__WebPath__/Ticket/Display.html?id=__id__\">__Subject__</a>/TITLE:Subject', QueueName, ExtendedStatus, CreatedRelative, '<A HREF=\"__WebPath__/Ticket/Display.html?Action=Take&id=__id__\">__loc(Take)__</a>/TITLE:&nbsp;' ",
619         Query   => " Owner = 'Nobody' AND ( Status = 'new' OR Status = 'open')",
620         OrderBy => 'Created',
621         Order   => 'DESC' },
622     },
623     { Name => 'HomepageSettings',
624       Description => 'HomepageSettings',
625       Content =>
626       { 'body' => # loc
627         [ { type => 'system', name => 'My Tickets' },
628           { type => 'system', name => 'Unowned Tickets' },
629           { type => 'component',  name => 'QuickCreate'},
630         ],
631         'summary' => # loc
632         [ 
633           { type => 'component', name => 'MyReminders' },
634           { type => 'component', name => 'Quicksearch' },
635           { type => 'component', name => 'RefreshHomepage' },
636         ]
637     },
638 }
639 );