2 Name => '___Approvals',
3 Description => 'A system-internal queue for the approvals system',
15 Queue => '___Approvals',
16 Name => "New Pending Approval", # loc
17 Description => "Notify Owners and AdminCcs of new items pending their approval", # loc
18 Content => 'Subject: New Pending Approval: {$Ticket->Subject}
22 There is a new item pending your approval: "{$Ticket->Subject()}",
23 a summary of which appears below.
25 Please visit {$RT::WebURL}Approvals/Display.html?id={$Ticket->id}
26 to approve or reject this ticket, or {$RT::WebURL}Approvals/ to
27 batch-process all your pending approvals.
29 -------------------------------------------------------------------------
30 {$Transaction->Content()}
40 { Name => 'Open Tickets',
41 Description => 'Open tickets on correspondence',
42 ExecModule => 'AutoOpen' },
47 { ScripCondition => 'On Correspond',
48 ScripAction => 'Open Tickets',
52 { ScripCondition => 'On Create',
53 ScripAction => 'AutoReply To Requestors',
54 Template => 'AutoReply' },
55 { ScripCondition => 'On Create',
56 ScripAction => 'Notify AdminCcs',
57 Template => 'Transaction' },
58 { ScripCondition => 'On Correspond',
59 ScripAction => 'Notify AdminCcs',
60 Template => 'Admin Correspondence' },
61 { ScripCondition => 'On Correspond',
62 ScripAction => 'Notify Requestors And Ccs',
63 Template => 'Correspondence' },
64 { ScripCondition => 'On Correspond',
65 ScripAction => 'Notify Other Recipients',
66 Template => 'Correspondence' },
67 { ScripCondition => 'On Comment',
68 ScripAction => 'Notify AdminCcs As Comment',
69 Template => 'Admin Comment' },
70 { ScripCondition => 'On Comment',
71 ScripAction => 'Notify Other Recipients As Comment',
72 Template => 'Correspondence' },
73 { ScripCondition => 'On Resolve',
74 ScripAction => 'Notify Requestors',
75 Template => 'Resolved' },
79 Description => "When an approval ticket is created, notify the Owner and AdminCc of the item awaiting their approval", # loc
80 Queue => '___Approvals',
81 ScripCondition => 'On Create',
82 ScripAction => 'Notify AdminCcs',
83 Template => 'New Pending Approval'
86 Description => "If an approval is rejected, reject the original and delete pending approvals", # loc
87 Queue => '___Approvals',
88 ScripCondition => 'On Status Change',
89 ScripAction => 'User Defined',
90 CustomCommitCode => q[
91 # ------------------------------------------------------------------- #
92 return(1) unless ( lc($self->TransactionObj->NewValue) eq "rejected" or
93 lc($self->TransactionObj->NewValue) eq "deleted" );
95 my $links = $self->TicketObj->DependedOnBy;
96 foreach my $link (@{ $links->ItemsArrayRef }) {
97 my $obj = $link->BaseObj;
98 if ($obj->QueueObj->IsActiveStatus($obj->Status)) {
99 if ($obj->Type eq 'ticket') {
101 Content => $self->loc("Your request was rejected."),
104 Status => 'rejected',
117 $links = $self->TicketObj->DependsOn;
118 foreach my $link (@{ $links->ItemsArrayRef }) {
119 my $obj = $link->TargetObj;
120 if ($obj->QueueObj->IsActiveStatus($obj->Status)) {
129 # ------------------------------------------------------------------- #
131 CustomPrepareCode => '1',
132 Template => 'Admin Comment',
135 Description => "When a ticket has been approved by any approver, add correspondence to the original ticket", # loc
136 Queue => '___Approvals',
137 ScripCondition => 'On Resolve',
138 ScripAction => 'User Defined',
139 CustomPrepareCode => 'return(1);',
140 CustomCommitCode => q[
141 # ------------------------------------------------------------------- #
142 return(1) unless ($self->TicketObj->Type eq 'approval');
144 foreach my $obj ($self->TicketObj->AllDependedOnBy( Type => 'ticket' )) {
146 Content => $self->loc( "Your request has been approved by [_1]. Other approvals may still be pending.", # loc
147 $self->TransactionObj->CreatorObj->Name,
148 ) . "\n" . $self->loc( "Approver's notes: [_1]", # loc
149 $self->TicketObj->Transactions->Last->Content,
156 # ------------------------------------------------------------------- #
158 Template => 'Admin Comment'
161 Description => "When a ticket has been approved by all approvers, add correspondence to the original ticket", # loc
162 Queue => '___Approvals',
163 ScripCondition => 'On Resolve',
164 ScripAction => 'User Defined',
165 CustomPrepareCode => 'return(1);',
166 CustomCommitCode => q[
167 # ------------------------------------------------------------------- #
168 # Find all the tickets that depend on this (that this is approving)
170 my $Ticket = $self->TicketObj;
171 my @TOP = $Ticket->AllDependedOnBy( Type => 'ticket' );
172 my $links = $Ticket->DependedOnBy;
174 while (my $link = $links->Next) {
175 my $obj = $link->BaseObj;
176 next if ($obj->HasUnresolvedDependencies( Type => 'approval' ));
178 if ($obj->Type eq 'ticket') {
180 Content => $self->loc("Your request has been approved."),
184 elsif ($obj->Type eq 'code') {
185 my $code = $obj->Transactions->First->Content;
188 foreach my $TOP (@TOP) {
191 $RT::Logger->error("Cannot eval code: $@") if $@;
195 $obj->SetStatus( Status => 'resolved', Force => 1,);
198 $obj->SetStatus( Status => 'rejected', Force => 1,);
204 # ------------------------------------------------------------------- #
206 Template => 'Admin Comment',