4 "Going to add [OLD] prefix to all templates in approvals queue."
5 ." If you have never used approvals, you can safely delete all the"
6 ." templates with the [OLD] prefix. Leave the new Approval templates because"
7 ." you may eventually want to start using approvals."
10 my $approvals_q = RT::Queue->new( RT->SystemUser );
11 $approvals_q->Load('___Approvals');
12 unless ( $approvals_q->id ) {
13 $RT::Logger->error("You have no approvals queue.");
17 my $templates = RT::Templates->new( RT->SystemUser );
18 $templates->LimitToQueue( $approvals_q->id );
19 while ( my $tmpl = $templates->Next ) {
20 my ($status, $msg) = $tmpl->SetName( "[OLD] ". $tmpl->Name );
22 $RT::Logger->error("Couldn't rename template #". $tmpl->id .": $msg");
29 { GroupDomain => 'SystemInternal',
30 GroupType => 'privileged',
31 Right => 'ShowApprovalsTab', },
35 { Queue => '___Approvals',
36 Name => "New Pending Approval", # loc
38 "Notify Owners and AdminCcs of new items pending their approval", # loc
39 Content => 'Subject: New Pending Approval: {$Ticket->Subject}
43 There is a new item pending your approval: "{$Ticket->Subject()}",
44 a summary of which appears below.
46 Please visit {RT->Config->Get(\'WebURL\')}Approvals/Display.html?id={$Ticket->id}
47 to approve or reject this ticket, or {RT->Config->Get(\'WebURL\')}Approvals/ to
48 batch-process all your pending approvals.
50 -------------------------------------------------------------------------
51 {$Transaction->Content()}
54 { Queue => '___Approvals',
55 Name => "Approval Passed", # loc
57 "Notify Requestor of their ticket has been approved by some approver", # loc
58 Content => 'Subject: Ticket Approved: {$Ticket->Subject}
62 Your ticket has been approved by { eval { $Approval->OwnerObj->Name } }.
63 Other approvals may be pending.
65 Approver\'s notes: { $Notes }
68 { Queue => '___Approvals',
69 Name => "All Approvals Passed", # loc
71 "Notify Requestor of their ticket has been approved by all approvers", # loc
72 Content => 'Subject: Ticket Approved: {$Ticket->Subject}
76 Your ticket has been approved by { eval { $Approval->OwnerObj->Name } }.
77 Its Owner may now start to act on it.
79 Approver\'s notes: { $Notes }
82 { Queue => '___Approvals',
83 Name => "Approval Rejected", # loc
85 "Notify Owner of their rejected ticket", # loc
86 Content => 'Subject: Ticket Rejected: {$Ticket->Subject}
90 Your ticket has been rejected by { eval { $Approval->OwnerObj->Name } }.
92 Approver\'s notes: { $Notes }
95 { Queue => '___Approvals',
96 Name => "Approval Ready for Owner", # loc
98 "Notify Owner of their ticket has been approved and is ready to be acted on", # loc
99 Content => 'Subject: Ticket Approved: {$Ticket->Subject}
103 The ticket has been approved, you may now start to act on it.
111 $RT::Logger->debug("Going to adjust dashboards");
112 my $sys = RT::System->new(RT->SystemUser);
114 my $attrs = RT::Attributes->new( RT->SystemUser );
116 my @dashboards = $attrs->Named('Dashboard');
118 if (@dashboards == 0) {
119 $RT::Logger->debug("You have no dashboards. Skipped.");
123 for my $attr (@dashboards) {
124 my $props = $attr->Content;
125 if (exists $props->{Searches}) {
129 my ($privacy, $id, $desc) = @$_;
132 portlet_type => 'search',
135 description => $desc,
138 } @{ delete $props->{Searches} }
142 my ($status, $msg) = $attr->SetContent( $props );
143 $RT::Logger->error($msg) unless $status;
146 $RT::Logger->debug("Fixed.");
150 my $approvals_q = RT::Queue->new( RT->SystemUser );
151 $approvals_q->Load('___Approvals');
152 unless ( $approvals_q->id ) {
153 $RT::Logger->error("You have no approvals queue.");
158 my ($tmp_fh, $tmp_fn) = File::Temp::tempfile( 'rt-approvals-scrips-XXXX', CLEANUP => 0 );
160 $RT::Logger->error("Couldn't create temporary file.");
164 $RT::Logger->warning(
165 "IMPORTANT: We're going to delete all scrips in Approvals queue"
166 ." and save them in '$tmp_fn' file."
169 require Data::Dumper;
171 my $scrips = RT::Scrips->new( RT->SystemUser );
172 $scrips->LimitToQueue( $approvals_q->id );
173 while ( my $scrip = $scrips->Next ) {
175 map { $tmp->{ $_ } = $scrip->_Value( $_ ) }
176 $scrip->ReadableAttributes;
178 print $tmp_fh Data::Dumper::Dumper( \%tmp );
180 my ($status, $msg) = $scrip->Delete;
182 $RT::Logger->error( "Couldn't delete scrip: $msg");