RT 4.2.11, ticket#13852
[freeside.git] / rt / etc / upgrade / 4.2.4 / content
1 use strict;
2 use warnings;
3
4 our @ScripActions = (
5     { Name        => 'Open Inactive Tickets',                             # loc
6       Description => 'Open inactive tickets',                             # loc
7       ExecModule  => 'AutoOpenInactive' },
8 );
9
10 # Ignore the above if there is already an AutoOpenInactive in the
11 # database -- i.e. originally a 4.2 install, or someone added one
12 # themselves.
13 our @Initial;
14 push @Initial, sub {
15     my $exist = RT::ScripAction->new( RT->SystemUser );
16     $exist->LoadByCols( ExecModule => 'AutoOpenInactive' );
17     @ScripActions = () if $exist->Id;
18 };
19
20 push @Initial, sub {
21     my $queue = RT::Queue->new( RT->SystemUser );
22     my ($ok, $msg) = $queue->Load('___Approvals');
23     unless ($ok) {
24         RT->Logger->warning("Unable to load ___Approvals: $msg");
25         return;
26     }
27     unless ($queue->Disabled == 2) {
28         RT->Logger->warning("Going to force ___Approvals queue to be Disabled = 2");
29         ($ok, $msg) = $queue->SetDisabled( 2 );
30         unless ($ok) {
31             RT->Logger->error("Unable to set ___Approvals.Disabled = 2: $msg");
32             return;
33         }
34     }
35
36     unless ($queue->Lifecycle eq "approvals") {
37         RT->Logger->warning("Going to force ___Approvals queue to the approvals lifecycle");
38         ($ok, $msg) = $queue->SetLifecycle( "approvals" );
39         unless ($ok) {
40             RT->Logger->error("Unable to set ___Approvals lifecycle: $msg");
41             return;
42         }
43     }
44
45     return 1;
46
47 };