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