RT# 75628 - Added AutoreplyOrCorrespondence template to freeside core RT.
[freeside.git] / rt / etc / initialdata
1 # Initial data for a fresh RT installation.
2
3 @Users = (
4     {  Name         => 'root',
5        Gecos        => 'root',
6        RealName     => 'Enoch Root',
7        Password     => 'password',
8        EmailAddress => "root\@localhost",
9        Comments     => 'SuperUser',
10        Privileged   => '1',
11     },
12 );
13
14 @Groups = (
15 );
16
17 @Queues = ({ Name              => 'General',
18              Description       => 'The default queue',
19              CorrespondAddress => "",
20              CommentAddress    => "", },
21            { Name        => '___Approvals',
22              Lifecycle   => 'approvals',
23              Description => 'A system-internal queue for the approvals system',
24              Disabled    => 2, } );
25
26 @ScripActions = (
27
28     {  Name        => 'Autoreply To Requestors',    # loc
29        Description =>
30 'Always sends a message to the requestors independent of message sender' ,                                            # loc
31        ExecModule => 'Autoreply',
32        Argument   => 'Requestor' },
33     { Name        => 'Notify Requestors',                    # loc
34       Description => 'Sends a message to the requestors',    # loc
35       ExecModule  => 'Notify',
36       Argument    => 'Requestor' },
37     { Name        => 'Notify Owner as Comment',              # loc
38       Description => 'Sends mail to the owner',              # loc
39       ExecModule  => 'NotifyAsComment',
40       Argument    => 'Owner' },
41     { Name        => 'Notify Owner',                         # loc
42       Description => 'Sends mail to the owner',              # loc
43       ExecModule  => 'Notify',
44       Argument    => 'Owner' },
45     { Name        => 'Notify Ccs as Comment',              # loc
46       Description => 'Sends mail to the Ccs as a comment', # loc
47       ExecModule  => 'NotifyAsComment',
48       Argument    => 'Cc' },
49     { Name        => 'Notify Ccs',                                   # loc
50       Description => 'Sends mail to the Ccs',                        # loc
51       ExecModule  => 'Notify',
52       Argument    => 'Cc' },
53     { Name        => 'Notify AdminCcs as Comment',                        # loc
54       Description => 'Sends mail to the administrative Ccs as a comment', # loc
55       ExecModule  => 'NotifyAsComment',
56       Argument    => 'AdminCc' },
57     { Name        => 'Notify AdminCcs',                                   # loc
58       Description => 'Sends mail to the administrative Ccs',              # loc
59       ExecModule  => 'Notify',
60       Argument    => 'AdminCc' },
61
62     { Name        => 'Notify Requestors and Ccs as Comment',              # loc
63       Description => 'Send mail to requestors and Ccs as a comment',      # loc
64       ExecModule  => 'NotifyAsComment',
65       Argument    => 'Requestor,Cc' },
66
67 # deprecated
68 #    { Name        => 'Notify Requestors and Ccs',                         # loc
69 #      Description => 'Send mail to requestors and Ccs',                   # loc
70 #      ExecModule  => 'Notify',
71 #      Argument    => 'Requestor,Cc' },
72
73 # not yet deprecated
74     { Name        => 'Notify Owner, Requestors, Ccs and AdminCcs as Comment',    # loc
75       Description => 'Send mail to owner and all watchers as a "comment"',          # loc
76       ExecModule  => 'NotifyAsComment',
77       Argument    => 'All' },
78     { Name        => 'Notify Owner, Requestors, Ccs and AdminCcs',               # loc
79       Description => 'Send mail to owner and all watchers',                         # loc
80       ExecModule  => 'Notify',
81       Argument    => 'All' },
82     { Name        => 'Notify Other Recipients as Comment',                # loc
83       Description => 'Sends mail to explicitly listed Ccs and Bccs',      # loc
84       ExecModule  => 'NotifyAsComment',
85       Argument    => 'OtherRecipients' },
86 # deprecated
87 #    { Name        => 'Notify Other Recipients',                           # loc
88 #      Description => 'Sends mail to explicitly listed Ccs and Bccs',      # loc
89 #      ExecModule  => 'Notify',
90 #      Argument    => 'OtherRecipients' },
91
92     { Name        => 'User Defined',                                      # loc
93       Description => 'Perform a user-defined action',                     # loc
94       ExecModule  => 'UserDefined', },
95     {  Name        => 'Create Tickets',                                    # loc
96        Description =>
97          'Create new tickets based on this scrip\'s template',             # loc
98        ExecModule => 'CreateTickets', },
99     { Name        => 'Open Tickets',                                      # loc
100       Description => 'Open tickets on correspondence',                    # loc
101       ExecModule  => 'AutoOpen' },
102     { Name        => 'Extract Subject Tag',                               # loc
103       Description => 'Extract tags from a Transaction\'s subject and add them to the Ticket\'s subject.', # loc
104       ExecModule  => 'ExtractSubjectTag' },
105
106     #freeside
107     { Name        => 'Set Priority',
108       Description => 'Set ticket priority',
109       ExecModule  => 'SetPriority',
110       Argument    => '',
111     },
112     { Name        => 'Cancel Scheduled Resolve',
113       Description => 'Set ticket not to resolve in the future',
114       ExecModule  => 'SetWillResolve',
115       Argument    => '',
116     },
117     { Name        => 'Scheduled Resolve',
118       Description => 'Resolve ticket if its WillResolve date has passed',
119       ExecModule  => 'ScheduledResolve',
120       Argument    => '',
121     },
122 # combine these into a single action so they can see each other in the headers
123     { Name        => 'Notify Requestors, Ccs, and Other Recipients',
124       Description => 'Send mail to requestors, watchers, and explicit Ccs',
125       ExecModule  => 'Notify',
126       Argument    => 'Requestor,Cc,OtherRecipients',
127     },
128 );
129
130 @ScripConditions = (
131     { Name                 => 'On Create',                                # loc
132       Description          => 'When a ticket is created',                 # loc
133       ApplicableTransTypes => 'Create',
134       ExecModule           => 'AnyTransaction', },
135
136     { Name                 => 'On Transaction',                           # loc
137       Description          => 'When anything happens',                    # loc
138       ApplicableTransTypes => 'Any',
139       ExecModule           => 'AnyTransaction', },
140     {
141
142       Name                 => 'On Correspond',                             # loc
143       Description          => 'Whenever correspondence comes in',          # loc
144       ApplicableTransTypes => 'Correspond',
145       ExecModule           => 'AnyTransaction', },
146
147     {
148
149       Name                 => 'On Forward',                                # loc
150       Description          => 'Whenever a ticket or transaction is forwarded', # loc
151       ApplicableTransTypes => 'Forward Transaction,Forward Ticket',
152       ExecModule           => 'AnyTransaction', },
153
154     {
155
156       Name                 => 'On Forward Ticket',                         # loc
157       Description          => 'Whenever a ticket is forwarded',            # loc
158       ApplicableTransTypes => 'Forward Ticket',
159       ExecModule           => 'AnyTransaction', },
160
161     {
162
163       Name                 => 'On Forward Transaction',                    # loc
164       Description          => 'Whenever a transaction is forwarded',       # loc
165       ApplicableTransTypes => 'Forward Transaction',
166       ExecModule           => 'AnyTransaction', },
167
168     {
169
170       Name                 => 'On Comment',                                # loc
171       Description          => 'Whenever comments come in',                 # loc
172       ApplicableTransTypes => 'Comment',
173       ExecModule           => 'AnyTransaction' },
174     {
175
176       Name                 => 'On Status Change',                          # loc
177       Description          => 'Whenever a ticket\'s status changes',       # loc
178       ApplicableTransTypes => 'Status',
179       ExecModule           => 'AnyTransaction',
180
181     },
182     {
183
184       Name                 => 'On Priority Change',                       # loc
185       Description          => 'Whenever a ticket\'s priority changes',    # loc
186       ApplicableTransTypes => 'Set',
187       ExecModule           => 'PriorityChange',
188     },
189     {
190
191       Name                 => 'On Owner Change',                           # loc
192       Description          => 'Whenever a ticket\'s owner changes',        # loc
193       ApplicableTransTypes => 'Any',
194       ExecModule           => 'OwnerChange',
195
196     },
197     {
198
199       Name                 => 'On Queue Change',                           # loc
200       Description          => 'Whenever a ticket\'s queue changes',        # loc
201       ApplicableTransTypes => 'Set',
202       ExecModule           => 'QueueChange',
203
204     },
205     {  Name                 => 'On Resolve',                               # loc
206        Description          => 'Whenever a ticket is resolved',            # loc
207        ApplicableTransTypes => 'Status',
208        ExecModule           => 'StatusChange',
209        Argument             => 'resolved'
210
211     },
212     {  Name                 => 'On Reject',                                # loc
213        Description          => 'Whenever a ticket is rejected',            # loc
214        ApplicableTransTypes => 'Status',
215        ExecModule           => 'StatusChange',
216        Argument             => 'rejected'
217
218     },
219     {  Name                 => 'User Defined',                             # loc
220        Description          => 'Whenever a user-defined condition occurs', # loc
221        ApplicableTransTypes => 'Any',
222        ExecModule           => 'UserDefined'
223
224     },
225
226     {  Name                 => 'On Close',                                 # loc
227        Description          => 'Whenever a ticket is closed', # loc
228        ApplicableTransTypes => 'Status,Set',
229        ExecModule           => 'CloseTicket',
230     },
231     {  Name                 => 'On Reopen',                                # loc
232        Description          => 'Whenever a ticket is reopened', # loc
233        ApplicableTransTypes => 'Status,Set',
234        ExecModule           => 'ReopenTicket',
235     },
236
237     #freeside
238     {  Name                 => 'On Custom Field Transaction',
239        Description          => 'When a custom field is changed',
240        ExecModule           => 'CustomFieldTransaction',
241        ApplicableTransTypes => 'Any',
242     },
243     {  Name                 => 'On Custom Field Change',
244        Description          => 'When a custom field is changed to some value',
245        ExecModule           => 'CustomFieldChange',
246        ApplicableTransTypes => 'Any',
247     },
248
249 );
250
251 @Templates = (
252     { Queue       => '0',
253       Name        => 'Blank',                                             # loc
254       Description => 'A blank template',                                  # loc
255       Content     => '', },
256     {  Queue       => '0',
257        Name        => 'Autoreply',                                         # loc
258        Description => 'Default Autoresponse template',                     # loc
259        Content     => 'Subject: AutoReply: {$Ticket->Subject}
260
261
262 Greetings,
263
264 This message has been automatically generated in response to the
265 creation of a trouble ticket regarding:
266         "{$Ticket->Subject()}", 
267 a summary of which appears below.
268
269 There is no need to reply to this message right now.  Your ticket has been
270 assigned an ID of { $Ticket->SubjectTag }.
271
272 Please include the string:
273
274          { $Ticket->SubjectTag }
275
276 in the subject line of all future correspondence about this issue. To do so, 
277 you may reply to this message.
278
279                         Thank you,
280                         {$Ticket->QueueObj->CorrespondAddress()}
281
282 -------------------------------------------------------------------------
283 {$Transaction->Content()}
284 '
285     },
286
287     {  Queue       => '0',
288        Name        => 'AutoreplyOrCorrespondence',                      # loc
289        Description => 'Plaintext AutoreplyOrCorrespondence template',   # loc
290        Content     => q[{
291       use RT::Template;
292       my $creator_name = $Ticket->CreatorObj->Name;
293       my $requestors = $Ticket->Requestors->UserMembersObj;
294       my ( $c_requestor, $r_count ) = ( 0, 0 );
295       while ( my $r = $requestors->Next() ) {
296           if ( $r->Name eq $creator_name ) {
297               $c_requestor++;
298           }
299           else {
300               $r_count++;
301           }
302       }
303       my $template = new RT::Template($RT::SystemUser);
304       my $template_name;
305
306       #if the creator is not a requestor or
307       #there is more than one requestor ( who's not the creator )
308       #use the Correspondence template
309       if ( ! $c_requestor || $r_count ) {
310           $template_name = 'Correspondence';
311       }
312       else {
313           #otherwise use the Autoreply template
314           $template_name = 'Autoreply';
315       }
316
317       #Load the Queue Template
318       $template->LoadQueueTemplate(
319           Queue => $Ticket->Queue,
320           Name => $template_name,
321       );
322       #if there's no Queue Template attempt to find a Global one.
323       unless ( $template->id ) {
324           $template->LoadGlobalTemplate( $template_name );
325           unless ( $template->id ) {
326               $RT::Logger->error("Could not load template : $template_name")
327           }
328       }
329       #Process embedded fields & expressions of true templates;
330       #note that we can only meaningfully use the body
331       my($ret, $msg) = $template->Parse(
332                            TicketObj => $Ticket,
333                            TransactionObj => $Transaction,
334                        );
335       $ret ? $template->MIMEObj->stringify : $msg;
336     }
337 ],
338     },
339     {  Queue       => '0',
340        Name        => 'AutoreplyOrCorrespondence in HTML',              # loc
341        Description => 'HTML AutoreplyOrCorrespondence template',   # loc
342        Content     => q[{
343       use RT::Template;
344       my $creator_name = $Ticket->CreatorObj->Name;
345       my $requestors = $Ticket->Requestors->UserMembersObj;
346       my ( $c_requestor, $r_count ) = ( 0, 0 );
347       while ( my $r = $requestors->Next() ) {
348           if ( $r->Name eq $creator_name ) {
349               $c_requestor++;
350           }
351           else {
352               $r_count++;
353           }
354       }
355       my $template = new RT::Template($RT::SystemUser);
356       my $template_name;
357
358       #if the creator is not a requestor or
359       #there is more than one requestor ( who's not the creator )
360       #use the Correspondence template
361       if ( ! $c_requestor || $r_count ) {
362           $template_name = 'Correspondence in HTML';
363       }
364       else {
365           #otherwise use the Autoreply in HTML template
366           $template_name = 'Autoreply in HTML';
367       }
368
369       #Load the Queue Template
370       $template->LoadQueueTemplate(
371           Queue => $Ticket->Queue,
372           Name => $template_name,
373       );
374       #if there's no Queue Template attempt to find a Global one.
375       unless ( $template->id ) {
376           $template->LoadGlobalTemplate( $template_name );
377           unless ( $template->id ) {
378               $RT::Logger->error("Could not load template : $template_name")
379           }
380       }
381       #Process embedded fields & expressions of true templates;
382       #note that we can only meaningfully use the body
383       my($ret, $msg) = $template->Parse(
384                            TicketObj => $Ticket,
385                            TransactionObj => $Transaction,
386                        );
387       $ret ? $template->MIMEObj->stringify : $msg;
388     }
389 ],
390     },
391     {  Queue       => '0',
392        Name        => 'Transaction',                     # loc
393        Description => 'Default transaction template',    # loc
394        Content     => 'RT-Attach-Message: yes
395
396
397 {$Transaction->CreatedAsString}: Request {$Ticket->id} was acted upon.
398  Transaction: {$Transaction->Description}
399        Queue: {$Ticket->QueueObj->Name}
400      Subject: {$Transaction->Subject || $Ticket->Subject || "(No subject given)"}
401        Owner: {$Ticket->OwnerObj->Name}
402   Requestors: {$Ticket->RequestorAddresses}
403       Status: {$Ticket->Status}
404  Ticket <URL: {RT->Config->Get(\'WebURL\')}Ticket/Display.html?id={$Ticket->id} >
405
406
407 {$Transaction->Content()}
408 '
409     },
410
411     {
412
413       Queue       => '0',
414       Name        => 'Admin Correspondence',                     # loc
415       Description => 'Default admin correspondence template',    # loc
416       Content     => 'RT-Attach-Message: yes
417
418
419 <URL: {RT->Config->Get(\'WebURL\')}Ticket/Display.html?id={$Ticket->id} >
420
421 {$Transaction->Content()}
422 '
423     },
424
425     {  Queue       => '0',
426        Name        => 'Correspondence',                          # loc
427        Description => 'Default correspondence template',         # loc
428        Content     => 'RT-Attach-Message: yes
429
430 {$Transaction->Content()}
431 '
432     },
433
434     {  Queue       => '0',
435        Name        => 'Admin Comment',                           # loc
436        Description => 'Default admin comment template',          # loc
437        Content     =>
438 'Subject: [Comment] {my $s=($Transaction->Subject||$Ticket->Subject||""); $s =~ s/\\[Comment\\]\\s*//g; $s =~ s/^Re:\\s*//i; $s;}
439 RT-Attach-Message: yes
440
441
442 {RT->Config->Get(\'WebURL\')}Ticket/Display.html?id={$Ticket->id}
443 This is a comment.  It is not sent to the Requestor(s):
444
445 {$Transaction->Content()}
446 '
447     },
448
449     {  Queue       => '0',
450        Name        => 'Status Change',                                     # loc
451        Description => 'Ticket status changed',                             # loc
452        Content     => 'Subject: Status Changed to: {$Transaction->NewValue}
453
454
455 {RT->Config->Get(\'WebURL\')}Ticket/Display.html?id={$Ticket->id}
456
457 {$Transaction->Content()}
458 '
459     },
460
461     {
462
463       Queue       => '0',
464       Name        => 'Resolved',                 # loc
465       Description => 'Ticket Resolved',          # loc
466       Content     => 'Subject: Resolved: {$Ticket->Subject}
467
468 According to our records, your request has been resolved. If you have any
469 further questions or concerns, please respond to this message.
470 '
471     },
472     {  Queue       => '___Approvals',
473        Name        => "New Pending Approval",    # loc
474        Description =>
475          "Notify Owners and AdminCcs of new items pending their approval", # loc
476        Content => 'Subject: New Pending Approval: {$Ticket->Subject}
477
478 Greetings,
479
480 There is a new item pending your approval: "{$Ticket->Subject()}", 
481 a summary of which appears below.
482
483 Please visit {RT->Config->Get(\'WebURL\')}Approvals/Display.html?id={$Ticket->id}
484 to approve or reject this ticket, or {RT->Config->Get(\'WebURL\')}Approvals/ to
485 batch-process all your pending approvals.
486
487 -------------------------------------------------------------------------
488 {$Transaction->Content()}
489 '
490     },
491     {  Queue       => '___Approvals',
492        Name        => "Approval Passed",    # loc
493        Description =>
494          "Notify Requestor of their ticket has been approved by some approver", # loc
495        Content => 'Subject: Ticket Approved: {$Ticket->Subject}
496
497 Greetings,
498
499 Your ticket has been approved by { eval { $Approver->Name } }.
500 Other approvals may be pending.
501
502 Approver\'s notes: { $Notes }
503 '
504     },
505     {  Queue       => '___Approvals',
506        Name        => "All Approvals Passed",    # loc
507        Description =>
508          "Notify Requestor of their ticket has been approved by all approvers", # loc
509        Content => 'Subject: Ticket Approved: {$Ticket->Subject}
510
511 Greetings,
512
513 Your ticket has been approved by { eval { $Approver->Name } }.
514 Its Owner may now start to act on it.
515
516 Approver\'s notes: { $Notes }
517 '
518     },
519     {  Queue       => '___Approvals',
520        Name        => "Approval Rejected",    # loc
521        Description =>
522          "Notify Owner of their rejected ticket", # loc
523        Content => 'Subject: Ticket Rejected: {$Ticket->Subject}
524
525 Greetings,
526
527 Your ticket has been rejected by { eval { $Approver->Name } }.
528
529 Approver\'s notes: { $Notes }
530 '
531     },
532     {  Queue       => '___Approvals',
533        Name        => "Approval Ready for Owner",    # loc
534        Description =>
535          "Notify Owner of their ticket has been approved and is ready to be acted on", # loc
536        Content => 'Subject: Ticket Approved: {$Ticket->Subject}
537
538 Greetings,
539
540 The ticket has been approved, you may now start to act on it.
541
542 '
543     },
544     {  Queue       => 0,
545        Name        => "Forward",    # loc
546        Description => "Heading of a forwarded message", # loc
547        Content => q{
548 This is a forward of transaction #{$Transaction->id} of ticket #{ $Ticket->id }
549 }
550     },
551     {  Queue       => 0,
552        Name        => "Forward Ticket",    # loc
553        Description => "Heading of a forwarded Ticket", # loc
554        Content => q{
555
556 This is a forward of ticket #{ $Ticket->id }
557 }
558     },
559     {  Queue       => 0,
560        Name        => "Error: public key",    # loc
561        Description =>
562          "Inform user that he has problems with public key and couldn't recieve encrypted content", # loc
563        Content => q{Subject: We have no your public key or it's wrong
564
565 You received this message as we have no your public PGP key or we have a problem with your key. Inform the administrator about the problem.
566 }
567     },
568     {  Queue       => 0,
569        Name        => "Error to RT owner: public key",    # loc
570        Description =>
571          "Inform RT owner that user(s) have problems with public keys", # loc
572        Content => q{Subject: Some users have problems with public keys
573
574 You received this message as RT has problems with public keys of the following user:
575 {
576     foreach my $e ( @BadRecipients ) {
577         $OUT .= "* ". $e->{'Message'} ."\n";
578     }
579 }}
580     },
581     {  Queue       => 0,
582        Name        => "Error: no private key",    # loc
583        Description =>
584          "Inform user that we received an encrypted email and we have no private keys to decrypt", # loc
585        Content => q{Subject: we received message we cannot decrypt
586
587 You sent an encrypted message with subject '{ $Message->head->get('Subject') }',
588 but we have no private key it's encrypted to.
589
590 Please, check that you encrypt messages with correct keys
591 or contact the system administrator.}
592     },
593     {  Queue       => 0,
594        Name        => "Error: bad GnuPG data",    # loc
595        Description =>
596          "Inform user that a message he sent has invalid GnuPG data", # loc
597        Content => q{Subject: We received a message we cannot handle
598
599 You sent us a message that we cannot handle due to corrupted GnuPG signature or encrypted block. we get the following error(s):
600 { foreach my $msg ( @Messages ) {
601     $OUT .= "* $msg\n";
602   }
603 }}
604     },
605     {  Queue       => 0,
606        Name        => "PasswordChange",    # loc
607        Description =>
608          "Inform user that his password has been reset", # loc
609        Content => q{Subject: [{RT->Config->Get('rtname')}] Password reset
610
611 Greetings,
612
613 Someone at {$ENV{'REMOTE_ADDR'}} requested a password reset for you on {RT->Config->Get('WebURL')}
614
615 Your new password is:
616   {$NewPassword}
617 }
618     },
619
620                {   Queue       => '0',
621                    Name        => 'Email Digest',    # loc
622                    Description => 'Email template for periodic notification digests',  # loc
623                    Content => q[Subject: RT Email Digest
624
625 { $Argument }
626 ],
627                },
628
629 {
630     Queue       => 0,
631     Name        => "Error: Missing dashboard",    # loc
632     Description =>
633       "Inform user that a dashboard he subscribed to is missing", # loc
634     Content => q{Subject: [{RT->Config->Get('rtname')}] Missing dashboard!
635
636 Greetings,
637
638 You are subscribed to a dashboard that is currently missing. Most likely, the dashboard was deleted.
639
640 RT will remove this subscription as it is no longer useful. Here's the information RT had about your subscription:
641
642 DashboardID:  { $SubscriptionObj->SubValue('DashboardId') }
643 Frequency:    { $SubscriptionObj->SubValue('Frequency') }
644 Hour:         { $SubscriptionObj->SubValue('Hour') }
645 {
646     $SubscriptionObj->SubValue('Frequency') eq 'weekly'
647     ? "Day of week:  " . $SubscriptionObj->SubValue('Dow')
648     : $SubscriptionObj->SubValue('Frequency') eq 'monthly'
649       ? "Day of month: " . $SubscriptionObj->SubValue('Dom')
650       : ''
651 }
652 }
653 },
654     {  Queue       => 0,
655        Name        => 'Custom Field Transaction',
656        Description => 'Custom field value changed',
657        Content     => q[Subject: {$Transaction->BriefDescription()}
658
659 {RT->Config->Get('WebURL')}Ticket/Display.html?id={$Ticket->id}
660
661 {$Transaction->Content()}
662 ],
663     },
664
665 );
666
667 @Scrips = (
668     {  Description    => 'On Correspond Open Tickets',
669        ScripCondition => 'On Correspond',
670        ScripAction    => 'Open Tickets',
671        Template       => 'Blank' },
672     {  Description    => 'On Owner Change Notify Owner',
673        ScripCondition => 'On Owner Change',
674        ScripAction    => 'Notify Owner',
675        Template       => 'Transaction' },
676     {  Description    => 'On Create Autoreply To Requestors',
677        ScripCondition => 'On Create',
678        ScripAction    => 'AutoReply To Requestors',
679        Template       => 'AutoReply' },
680     {  Description    => 'On Create Notify AdminCcs',
681        ScripCondition => 'On Create',
682        ScripAction    => 'Notify AdminCcs',
683        Template       => 'Transaction' },
684     {  Description    => 'On Correspond Notify AdminCcs',
685        ScripCondition => 'On Correspond',
686        ScripAction    => 'Notify AdminCcs',
687        Template       => 'Admin Correspondence' },
688 #    {  Description    => 'On Correspond Notify Requestors and Ccs',
689 #       ScripCondition => 'On Correspond',
690 #       ScripAction    => 'Notify Requestors And Ccs',
691 #       Template       => 'Correspondence' },
692 #    {  Description    => 'On Correspond Notify Other Recipients',
693 #       ScripCondition => 'On Correspond',
694 #       ScripAction    => 'Notify Other Recipients',
695 #       Template       => 'Correspondence' },
696     {  Description    => 'On Correspond Notify Requestors, Ccs, and Other Recipients',
697        ScripCondition => 'On Correspond',
698        ScripAction    => 'Notify Requestors, Ccs, and Other Recipients',
699        Template       => 'Correspondence', },
700     {  Description    => 'On Comment Notify AdminCcs as Comment',
701        ScripCondition => 'On Comment',
702        ScripAction    => 'Notify AdminCcs As Comment',
703        Template       => 'Admin Comment' },
704     {  Description    => 'On Comment Notify Other Recipients as Comment',
705        ScripCondition => 'On Comment',
706        ScripAction    => 'Notify Other Recipients As Comment',
707        Template       => 'Correspondence' },
708     {  Description    => 'On Resolve Notify Requestors',
709        ScripCondition => 'On Resolve',
710        ScripAction    => 'Notify Requestors',
711        Template       => 'Resolved' },
712     {  Description    => "On transaction, add any tags in the transaction's subject to the ticket's subject",
713        ScripCondition => 'On Transaction',
714        ScripAction    => 'Extract Subject Tag',
715        Template       => 'Blank' },
716     {  Description    => 'On Correspond, cancel future resolve',
717        ScripCondition => 'On Correspond',
718        ScripAction    => 'Cancel Scheduled Resolve',
719        Template       => 'Blank' },
720 );
721
722 @ACL = (
723     { UserId => 'root',        # - principalid
724       Right  => 'SuperUser', },
725
726     { GroupDomain => 'SystemInternal',
727       GroupType => 'privileged',
728       Right  => 'ShowApprovalsTab', },
729
730 );
731
732 # Predefined searches
733
734 @Attributes = (
735     { Name => 'Search - My Tickets',
736       Description => '[_1] highest priority tickets I own', # loc
737       Content     =>
738       { Format =>  q{'<a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a>/TITLE:#',}
739                  . q{'<a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a>/TITLE:Subject',}
740                  . q{Priority, QueueName, ExtendedStatus},
741         Query   => " Owner = '__CurrentUser__' AND ( Status = 'new' OR Status = 'open')",
742         OrderBy => 'Priority',
743         Order   => 'DESC'
744       },
745     },
746     { Name => 'Search - Unowned Tickets',
747       Description => '[_1] newest unowned tickets', # loc
748       Content     =>
749 # 'Take' #loc
750       { Format =>  q{'<a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a>/TITLE:#',}
751                  . q{'<a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a>/TITLE:Subject',}
752                  . q{QueueName, ExtendedStatus, CreatedRelative, }
753                  . q{'<A HREF="__WebPath__/Ticket/Display.html?Action=Take&id=__id__">__loc(Take)__</a>/TITLE:NBSP'},
754         Query   => " Owner = 'Nobody' AND ( Status = 'new' OR Status = 'open')",
755         OrderBy => 'Created',
756         Order   => 'DESC'
757       },
758     },
759     { Name => 'Search - Bookmarked Tickets',
760       Description => 'Bookmarked Tickets', #loc
761       Content     =>
762       { Format => q{'<a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a>/TITLE:#',}
763                 . q{'<a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a>/TITLE:Subject',}
764                 . q{Priority, QueueName, ExtendedStatus, Bookmark},
765         Query   => "id = '__Bookmarked__'",
766         OrderBy => 'LastUpdated',
767         Order   => 'DESC' },
768     },
769     {
770         Name        => 'HomepageSettings',
771         Description => 'HomepageSettings',
772         Content     => {
773             'body' =>    # loc
774               [
775                 {
776                     type => 'system',
777                     name => 'My Tickets',           # loc
778                 },
779                 {
780                     type => 'system',
781                     name => 'Unowned Tickets'       # loc
782                 },
783                 {
784                     type => 'system',
785                     name => 'Bookmarked Tickets'    # loc
786                 },
787                 {
788                     type => 'component',
789                     name => 'QuickCreate'           # loc
790                 },
791               ],
792             'summary' =>                            # loc
793               [
794                 {
795                     type => 'component',
796                     name => 'MyReminders'           # loc
797                 },
798                 {
799                     type => 'component',
800                     name => 'Quicksearch'           # loc
801                 },
802                 {
803                     type => 'component',
804                     name => 'Dashboards'            # loc
805                 },
806                 {
807                     type => 'component',
808                     name => 'RefreshHomepage'       # loc
809                 },
810               ],
811         },
812     },
813 );
814
815 # freeside upgrade
816 # Obsolete/erroneous scrips
817 # If
818 #   $Delete_Scrips{conditionname}{actionname}{templatename}
819 # exists, and the scrip was created by the system user, it 
820 # will be deleted on upgrade.  Lowercase all the names here.
821
822 %Delete_Scrips = (
823   'on correspond' => {
824     'notify requestors and ccs' => { 'correspondence' => 1 },
825     'notify other recipients'   => { 'correspondence' => 1 },
826   }
827 );
828
829 # -*- perl -*-
830
831 push @ScripActions, (
832
833     { Name        => 'Extract Custom Field Values',          # loc
834       Description => 'extract cf-values out of a message',    # loc
835       ExecModule  => 'ExtractCustomFieldValues' },
836
837     { Name        => 'Extract Custom Field Values With Code in Template', # loc
838       Description => 'extract cf-values out of a message with a Text::Template template',    # loc
839       ExecModule  => 'ExtractCustomFieldValuesWithCodeInTemplate' }
840
841 );
842
843 push @Templates, (
844     {  Queue       => '0',
845        Name        => 'CustomFieldScannerExample',                     # loc
846        Description => 'Example Template for ExtractCustomFieldValues', # loc
847        Content     => <<'EOTEXT'
848 #### Syntax:
849 # CF Name | Header name or "Body" | MatchString(re) | Postcmd | Options
850
851 #### Allowed Options:
852
853 # q - (quiet) Don't record a transaction for adding the custom field
854 #     value
855 # * - (wildcard) The MatchString regex should contain _two_
856 #     capturing groups, the first of which is the CF name,
857 #     the second of which is the value.  If this option is
858 #     given, the <cf-name> field is ignored.
859
860 #### Examples:
861
862 # 1. Put the content of the "X-MI-Test" header into the "testcf"
863 #    custom field:
864 # testcf|X-MI-Test|.*
865
866 # 2. Scan the body for Host:name and put name into the "bodycf" custom
867 #    field:
868 # bodycf|Body|Host:\s*(\w+)
869
870 # 3. Scan the "X-MI-IP" header for an IP-Adresse and get the hostname
871 #    by reverse-resolving it:
872 # Hostname|X-MI-IP|\d+\.\d+\.\d+\.\d+|use Socket; ($value) = gethostbyaddr(inet_aton($value),AF_INET);
873
874 # 4. scan the "CC" header for an many email addresses, and add them to
875 #    a custom field named "parsedCCs". If "parsedCCs" is a multivalue
876 #    CF, then this should yield separate values for all email adress
877 #    found.
878 # parsedCCs|CC|.*|$value =~ s/^\s+//; $value =~ s/\s+$//;
879
880 # 5. Looks for an "Email:" field in the body of the email, then loads
881 #    up that user and makes them privileged The blank first field
882 #    means the automatic CustomField setting is not invoked.
883 # |Body|Email:\s*(.+)$|my $u = RT::User->new($RT::SystemUser); $u->LoadByEmail($value); $u->SetPrivileged(1)|
884
885 # 6. Looks for any text of the form "Set CF Name: Value" in the body,
886 #    and sets the CF named "CF Name" to the given value, which may be
887 #    multi-line.  The '*' option controls the wildcard nature of this
888 #    example.
889 # Separator=!
890 # !Body!^Set ([^\n:]*?):\s*((?s).*?)(?:\Z|\n\Z|\n\n)!!*
891
892 # 7. Looks for the regex anywhere in the headers and stores the match
893 #    in the AllHeaderSearch CF
894 # AllHeaderSearch|Headers|Site:\s*(\w+)
895
896 # 8. If you need to dynamically build your matching, and want to trigger on headers and body
897 #    and invode some arbitrary code like example 5
898 # Separator=~~
899 # {
900 #    my $action = 'use My::Site; My::Site::SetSiteID( Ticket => $self->TicketObj, Site => $_ );';
901 #
902 #    for my $regex (My::Site::ValidRegexps) {
903 #        for my $from ('headers', 'body') {
904 #            $OUT .= join '~~',
905 #                '', # CF name
906 #                $from,
907 #                $regex,
908 #                $action;
909 #            $OUT .= "\n";
910 #        }
911 #    }
912 # }
913
914 EOTEXT
915     }
916 );
917
918 1;