config.layout needs to be generated
[freeside.git] / rt / etc / 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     => 'Enoch Root',
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              => 'General',
63              Description       => 'The default queue',
64              CorrespondAddress => "",
65              CommentAddress    => "", },
66            { Name        => '___Approvals',
67              Description => 'A system-internal queue for the approvals system',
68              Disabled    => 2, } );
69
70 @ScripActions = (
71
72     {  Name        => 'Autoreply To Requestors',    # loc
73        Description =>
74 'Always sends a message to the requestors independent of message sender' ,                                            # loc
75        ExecModule => 'Autoreply',
76        Argument   => 'Requestor' },
77     { Name        => 'Notify Requestors',                    # loc
78       Description => 'Sends a message to the requestors',    # loc
79       ExecModule  => 'Notify',
80       Argument    => 'Requestor' },
81     { Name        => 'Notify Owner as Comment',              # loc
82       Description => 'Sends mail to the owner',              # loc
83       ExecModule  => 'NotifyAsComment',
84       Argument    => 'Owner' },
85     { Name        => 'Notify Owner',                         # loc
86       Description => 'Sends mail to the owner',              # loc
87       ExecModule  => 'Notify',
88       Argument    => 'Owner' },
89     { Name        => 'Notify AdminCcs as Comment',                        # loc
90       Description => 'Sends mail to the administrative Ccs as a comment', # loc
91       ExecModule  => 'NotifyAsComment',
92       Argument    => 'AdminCc' },
93     { Name        => 'Notify AdminCcs',                                   # loc
94       Description => 'Sends mail to the administrative Ccs',              # loc
95       ExecModule  => 'Notify',
96       Argument    => 'AdminCc' },
97
98     { Name        => 'Notify Requestors and Ccs as Comment',              # loc
99       Description => 'Send mail to requestors and Ccs as a comment',      # loc
100       ExecModule  => 'NotifyAsComment',
101       Argument    => 'Requestor,Cc' },
102
103     { Name        => 'Notify Requestors and Ccs',                         # loc
104       Description => 'Send mail to requestors and Ccs',                   # loc
105       ExecModule  => 'Notify',
106       Argument    => 'Requestor,Cc' },
107
108     { Name        => 'Notify Requestors, Ccs and AdminCcs as Comment',    # loc
109       Description => 'Send mail to all watchers as a "comment"',          # loc
110       ExecModule  => 'NotifyAsComment',
111       Argument    => 'All' },
112     { Name        => 'Notify Requestors, Ccs and AdminCcs',               # loc
113       Description => 'Send mail to all watchers',                         # loc
114       ExecModule  => 'Notify',
115       Argument    => 'All' },
116     { Name        => 'Notify Other Recipients as Comment',                # loc
117       Description => 'Sends mail to explicitly listed Ccs and Bccs',      # loc
118       ExecModule  => 'NotifyAsComment',
119       Argument    => 'OtherRecipients' },
120     { Name        => 'Notify Other Recipients',                           # loc
121       Description => 'Sends mail to explicitly listed Ccs and Bccs',      # loc
122       ExecModule  => 'Notify',
123       Argument    => 'OtherRecipients' },
124     { Name        => 'User Defined',                                      # loc
125       Description => 'Perform a user-defined action',                     # loc
126       ExecModule  => 'UserDefined', },
127     {  Name        => 'Create Tickets',                                    # loc
128        Description =>
129          'Create new tickets based on this scrip\'s template',             # loc
130        ExecModule => 'CreateTickets', },
131     { Name        => 'Open Tickets',
132       Description => 'Open tickets on correspondence',                    # loc
133       ExecModule  => 'AutoOpen' },
134 );
135
136 @ScripConditions = (
137     { Name                 => 'On Create',                                # loc
138       Description          => 'When a ticket is created',                 # loc
139       ApplicableTransTypes => 'Create',
140       ExecModule           => 'AnyTransaction', },
141
142     { Name                 => 'On Transaction',                           # loc
143       Description          => 'When anything happens',                    # loc
144       ApplicableTransTypes => 'Any',
145       ExecModule           => 'AnyTransaction', },
146     {
147
148       Name                 => 'On Correspond',                             # loc
149       Description          => 'Whenever correspondence comes in',          # loc
150       ApplicableTransTypes => 'Correspond',
151       ExecModule           => 'AnyTransaction', },
152
153     {
154
155       Name                 => 'On Comment',                                # loc
156       Description          => 'Whenever comments come in',                 # loc
157       ApplicableTransTypes => 'Comment',
158       ExecModule           => 'AnyTransaction' },
159     {
160
161       Name                 => 'On Status Change',                          # loc
162       Description          => 'Whenever a ticket\'s status changes',       # loc
163       ApplicableTransTypes => 'Status',
164       ExecModule           => 'AnyTransaction',
165
166     },
167     {
168
169       Name                 => 'On Owner Change',                           # loc
170       Description          => 'Whenever a ticket\'s owner changes',        # loc
171       ApplicableTransTypes => 'Any',
172       ExecModule           => 'OwnerChange',
173
174     },
175     {
176
177       Name                 => 'On Queue Change',                           # loc
178       Description          => 'Whenever a ticket\'s queue changes',        # loc
179       ApplicableTransTypes => 'Set',
180       ExecModule           => 'QueueChange',
181
182     },
183     {  Name                 => 'On Resolve',                               # loc
184        Description          => 'Whenever a ticket is resolved',            # loc
185        ApplicableTransTypes => 'Status',
186        ExecModule           => 'StatusChange',
187        Argument             => 'resolved'
188
189     },
190
191     {  Name                 => 'User Defined',                             # loc
192        Description          => 'Whenever a user-defined condition occurs', # loc
193        ApplicableTransTypes => 'Any',
194        ExecModule           => 'UserDefined'
195
196     },
197
198 );
199
200 @Templates = (
201     { Queue       => '0',
202       Name        => 'Blank',                                             # loc
203       Description => 'A blank template',                                  # loc
204       Content     => '', },
205     {  Queue       => '0',
206        Name        => 'Autoreply',                                         # loc
207        Description => 'Default Autoresponse template',                     # loc
208        Content     => 'Subject: AutoReply: {$Ticket->Subject}
209
210
211 Greetings,
212
213 This message has been automatically generated in response to the
214 creation of a trouble ticket regarding:
215         "{$Ticket->Subject()}", 
216 a summary of which appears below.
217
218 There is no need to reply to this message right now.  Your ticket has been
219 assigned an ID of [{$rtname} #{$Ticket->id()}].
220
221 Please include the string:
222
223          [{$rtname} #{$Ticket->id}]
224
225 in the subject line of all future correspondence about this issue. To do so, 
226 you may reply to this message.
227
228                         Thank you,
229                         {$Ticket->QueueObj->CorrespondAddress()}
230
231 -------------------------------------------------------------------------
232 {$Transaction->Content()}
233 '
234     },
235
236     {  Queue       => '0',
237        Name        => 'Transaction',                     # loc
238        Description => 'Default transaction template',    # loc
239        Content     => 'RT-Attach-Message: yes
240
241
242 {$Transaction->CreatedAsString}: Request {$Ticket->id} was acted upon.
243 Transaction: {$Transaction->Description}
244        Queue: {$Ticket->QueueObj->Name}
245      Subject: {$Transaction->Subject || $Ticket->Subject || "(No subject given)"}
246        Owner: {$Ticket->OwnerObj->Name}
247   Requestors: {$Ticket->RequestorAddresses}
248       Status: {$Ticket->Status}
249  Ticket <URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id} >
250
251
252 {$Transaction->Content()}
253 '
254     },
255
256     {
257
258       Queue       => '0',
259       Name        => 'Admin Correspondence',                     # loc
260       Description => 'Default admin correspondence template',    # loc
261       Content     => 'RT-Attach-Message: yes
262
263
264 <URL: {$RT::WebURL}Ticket/Display.html?id={$Ticket->id} >
265
266 {$Transaction->Content()}
267 '
268     },
269
270     {  Queue       => '0',
271        Name        => 'Correspondence',                          # loc
272        Description => 'Default correspondence template',         # loc
273        Content     => 'RT-Attach-Message: yes
274
275 {$Transaction->Content()}
276 '
277     },
278
279     {  Queue       => '0',
280        Name        => 'Admin Comment',                           # loc
281        Description => 'Default admin comment template',          # loc
282        Content     =>
283 'Subject: [Comment] {my $s=($Transaction->Subject||$Ticket->Subject); $s =~ s/\\[Comment\\]//g; $comment =~ s/^Re//i; $s;}
284
285
286 {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}
287 This is a comment.  It is not sent to the Requestor(s):
288
289 {$Transaction->Content()}
290 '
291     },
292
293     {  Queue       => '0',
294        Name        => 'Status Change',                                     # loc
295        Description => 'Ticket status changed',                             # loc
296        Content     => 'Subject: Status Changed to: {$Transaction->NewValue}
297
298
299 {$RT::WebURL}Ticket/Display.html?id={$Ticket->id}
300
301 {$Transaction->Content()}
302 '
303     },
304
305     {
306
307       Queue       => '0',
308       Name        => 'Resolved',                 # loc
309       Description => 'Ticket Resolved',          # loc
310       Content     => 'Subject: Resolved: {$Ticket->Subject}
311
312 According to our records, your request has been resolved. If you have any
313 further questions or concerns, please respond to this message.
314 '
315     },
316     {  Queue       => '___Approvals',
317        Name        => "New Pending Approval",    # loc
318        Description =>
319          "Notify Owners and AdminCcs of new items pending their approval", # loc
320        Content => 'Subject: New Pending Approval: {$Ticket->Subject}
321
322 Greetings,
323
324 There is a new item pending your approval: "{$Ticket->Subject()}", 
325 a summary of which appears below.
326
327 Please visit {$RT::WebURL}Approvals/Display.html?id={$Ticket->id}
328 to approve or reject this ticket, or {$RT::WebURL}Approvals/ to
329 batch-process all your pending approvals.
330
331 -------------------------------------------------------------------------
332 {$Transaction->Content()}
333 '
334     },
335     {  Queue       => '___Approvals',
336        Name        => "Approval Passed",    # loc
337        Description =>
338          "Notify Owner of their ticket has been approved by some approver", # loc
339        Content => 'Subject: Ticket Rejected: {$Ticket->Subject}
340
341 Greetings,
342
343 Your ticket has been approved by { eval { $Approval->OwnerObj->Name } }.
344 Other approvals may be pending.
345 '
346     },
347     {  Queue       => '___Approvals',
348        Name        => "All Approvals Passed",    # loc
349        Description =>
350          "Notify Owner of their ticket has been approved by all approvers", # loc
351        Content => 'Subject: Ticket Rejected: {$Ticket->Subject}
352
353 Greetings,
354
355 Your ticket has been approved.  Its Owner may now start to act on it.
356 '
357     },
358     {  Queue       => '___Approvals',
359        Name        => "Approval Rejected",    # loc
360        Description =>
361          "Notify Owner of their rejected ticket", # loc
362        Content => 'Subject: Ticket Rejected: {$Ticket->Subject}
363
364 Greetings,
365
366 Your ticket has been rejected by { eval { $Approval->OwnerObj->Name } }.
367 '
368     },
369 );
370 # }}}
371
372 @Scrips = (
373     {  ScripCondition => 'On Correspond',
374        ScripAction    => 'Open Tickets',
375        Template       => 'Blank' },
376     {  ScripCondition => 'On Create',
377        ScripAction    => 'AutoReply To Requestors',
378        Template       => 'AutoReply' },
379     {  ScripCondition => 'On Create',
380        ScripAction    => 'Notify AdminCcs',
381        Template       => 'Transaction' },
382     {  ScripCondition => 'On Correspond',
383        ScripAction    => 'Notify AdminCcs',
384        Template       => 'Admin Correspondence' },
385     {  ScripCondition => 'On Correspond',
386        ScripAction    => 'Notify Requestors And Ccs',
387        Template       => 'Correspondence' },
388     {  ScripCondition => 'On Correspond',
389        ScripAction    => 'Notify Other Recipients',
390        Template       => 'Correspondence' },
391     {  ScripCondition => 'On Comment',
392        ScripAction    => 'Notify AdminCcs As Comment',
393        Template       => 'Admin Comment' },
394     {  ScripCondition => 'On Comment',
395        ScripAction    => 'Notify Other Recipients As Comment',
396        Template       => 'Correspondence' },
397     {  ScripCondition => 'On Resolve',
398        ScripAction    => 'Notify Requestors',
399        Template       => 'Resolved' },
400     {  Description => "When an approval ticket is created, notify the Owner and AdminCc of the item awaiting their approval",    # loc
401        Queue          => '___Approvals',
402        ScripCondition => 'User Defined',
403        CustomIsApplicableCode => q[
404             $self->TicketObj->Type eq 'approval'        and
405             $self->TransactionObj->Field eq 'Status'    and
406             $self->TransactionObj->NewValue eq 'open'   and
407             eval { $T::Approving = ($self->TicketObj->AllDependedOnBy( Type => 'ticket' ))[0] }
408        ],
409        ScripAction    => 'Notify Owner',
410        Template       => 'New Pending Approval' },
411     {  Description => "If an approval is rejected, reject the original and delete pending approvals",    # loc
412        Queue            => '___Approvals',
413        ScripCondition   => 'On Status Change',
414        ScripAction      => 'User Defined',
415        CustomPrepareCode => q[
416 # ------------------------------------------------------------------- #
417 return(0) unless ( lc($self->TransactionObj->NewValue) eq "rejected" or
418                    lc($self->TransactionObj->NewValue) eq "deleted" );
419
420 my $rejected = 0;
421 my $links = $self->TicketObj->DependedOnBy;
422 foreach my $link (@{ $links->ItemsArrayRef }) {
423     my $obj = $link->BaseObj;
424     if ($obj->QueueObj->IsActiveStatus($obj->Status)) {
425         if ($obj->Type eq 'ticket') {
426             $obj->Comment(
427                 Content => $self->loc("Your request was rejected."),
428             );
429             $obj->SetStatus(
430                 Status  => 'rejected',
431                 Force   => 1,
432             );
433
434             $T::Approval = $self->TicketObj; # so we can access it inside templates
435             $self->{TicketObj} = $obj;  # we want the original id in the token line
436             $rejected = 1;
437         }
438         else {
439             $obj->SetStatus(
440                 Status  => 'deleted',
441                 Force   => 1,
442             );
443         }
444     }
445 }
446
447 $links = $self->TicketObj->DependsOn;
448 foreach my $link (@{ $links->ItemsArrayRef }) {
449     my $obj = $link->TargetObj;
450     if ($obj->QueueObj->IsActiveStatus($obj->Status)) {
451         $obj->SetStatus(
452             Status      => 'deleted',
453             Force       => 1,
454         );
455     }
456 }
457
458 # Now magically turn myself into a Requestor Notify object...
459 require RT::Action::Notify; bless($self, 'RT::Action::Notify');
460 $self->{Argument} = 'Requestor'; $self->Prepare;
461
462 return $rejected;
463 # ------------------------------------------------------------------- #
464         ],
465        CustomCommitCode => '"never needed"',
466        Template          => 'Approval Rejected', },
467     {  Description => "When a ticket has been approved by any approver, add correspondence to the original ticket", # loc
468        Queue             => '___Approvals',
469        ScripCondition    => 'On Resolve',
470        ScripAction       => 'User Defined',
471        CustomPrepareCode => q[
472 # ------------------------------------------------------------------- #
473 return(0) unless ($self->TicketObj->Type eq 'approval');
474
475 my $note;
476 my $t = $self->TicketObj->Transactions;
477 while (my $o = $t->Next) {
478     $note .= $o->Content . "\n" if $o->ContentObj
479             and $o->Content !~ /Default Approval/;
480 }
481
482 foreach my $obj ($self->TicketObj->AllDependedOnBy( Type => 'ticket' )) {
483     $obj->Comment(
484         Content => $self->loc( "Your request has been approved by [_1]. Other approvals may still be pending.", # loc
485             $self->TransactionObj->CreatorObj->Name,
486         ) . "\n" . $self->loc( "Approver's notes: [_1]", # loc
487             $note
488         ),
489     );
490     $T::Approval = $self->TicketObj; # so we can access it inside templates
491     $self->{TicketObj} = $obj;  # we want the original id in the token line
492 }
493
494 # Now magically turn myself into a Requestor Notify object...
495 require RT::Action::Notify; bless($self, 'RT::Action::Notify');
496 $self->{Argument} = 'Requestor'; $self->Prepare;
497
498 return 1;
499 # ------------------------------------------------------------------- #
500         ],
501        CustomCommitCode => '"never needed"',
502        Template => 'Approval Passed' },
503     {  Description => "When a ticket has been approved by all approvers, add correspondence to the original ticket", # loc
504        Queue             => '___Approvals',
505        ScripCondition    => 'On Resolve',
506        ScripAction       => 'User Defined',
507        CustomPrepareCode  => q[
508 # ------------------------------------------------------------------- #
509 # Find all the tickets that depend on this (that this is approving)
510
511 my $Ticket = $self->TicketObj;
512 my @TOP    = $Ticket->AllDependedOnBy( Type => 'ticket' );
513 my $links  = $Ticket->DependedOnBy;
514 my $passed = 0;
515
516 while (my $link = $links->Next) {
517     my $obj = $link->BaseObj;
518     next if ($obj->HasUnresolvedDependencies( Type => 'approval' ));
519
520     if ($obj->Type eq 'ticket') {
521         $obj->Comment(
522             Content     => $self->loc("Your request has been approved."),
523         );
524         $T::Approval  = $Ticket;    # so we can access it inside templates
525         $self->{TicketObj} = $obj;  # we want the original id in the token line
526         $passed = 1;
527     }
528     elsif ($obj->Type eq 'approval') {
529         $obj->SetStatus( Status => 'open', Force => 1 );
530     }
531     elsif ($RT::UseCodeTickets and $obj->Type eq 'code') {
532         my $code = $obj->Transactions->First->Content;
533         my $rv;
534
535         foreach my $TOP (@TOP) {
536             local $@;
537             $rv++ if eval $code;
538             $RT::Logger->error("Cannot eval code: $@") if $@;
539         }
540
541         if ($rv or !@TOP) {
542             $obj->SetStatus( Status     => 'resolved', Force    => 1,);
543         }
544         else {
545             $obj->SetStatus( Status     => 'rejected', Force    => 1,);
546         }
547     }
548 }
549
550 # Now magically turn myself into a Requestor Notify object...
551 require RT::Action::Notify; bless($self, 'RT::Action::Notify');
552 $self->{Argument} = 'Requestor'; $self->Prepare;
553
554 return 0; # ignore $passed;
555 # ------------------------------------------------------------------- #
556         ],
557        CustomCommitCode => '"never needed"',
558        Template => 'All Approvals Passed', },
559
560 );
561
562 @ACL = (
563     { UserId => 'Nobody',      # - principalId
564       Right  => 'OwnTicket', },
565
566     { UserId => 'root',        # - principalid
567       Right  => 'SuperUser', },
568
569 );