summaryrefslogtreecommitdiff
path: root/rt/etc/upgrade/4.2.4/content
blob: c56e3691120e786667135c6469db6a42bd80a26c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use strict;
use warnings;

our @ScripActions = (
    { Name        => 'Open Inactive Tickets',                             # loc
      Description => 'Open inactive tickets',                             # loc
      ExecModule  => 'AutoOpenInactive' },
);

# Ignore the above if there is already an AutoOpenInactive in the
# database -- i.e. originally a 4.2 install, or someone added one
# themselves.
our @Initial;
push @Initial, sub {
    my $exist = RT::ScripAction->new( RT->SystemUser );
    $exist->LoadByCols( ExecModule => 'AutoOpenInactive' );
    @ScripActions = () if $exist->Id;
};

push @Initial, sub {
    my $queue = RT::Queue->new( RT->SystemUser );
    my ($ok, $msg) = $queue->Load('___Approvals');
    unless ($ok) {
        RT->Logger->warning("Unable to load ___Approvals: $msg");
        return;
    }
    unless ($queue->Disabled == 2) {
        RT->Logger->warning("Going to force ___Approvals queue to be Disabled = 2");
        ($ok, $msg) = $queue->SetDisabled( 2 );
        unless ($ok) {
            RT->Logger->error("Unable to set ___Approvals.Disabled = 2: $msg");
            return;
        }
    }

    unless ($queue->Lifecycle eq "approvals") {
        RT->Logger->warning("Going to force ___Approvals queue to the approvals lifecycle");
        ($ok, $msg) = $queue->SetLifecycle( "approvals" );
        unless ($ok) {
            RT->Logger->error("Unable to set ___Approvals lifecycle: $msg");
            return;
        }
    }

    return 1;

};