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