]>
Commit | Line | Data |
---|---|---|
01e3b242 MKG |
1 | @ScripConditions = ( |
2 | { Name => 'On Reject', # loc | |
3 | Description => 'Whenever a ticket is rejected', # loc | |
4 | ApplicableTransTypes => 'Status', | |
5 | ExecModule => 'StatusChange', | |
6 | Argument => 'rejected' | |
7 | ||
8 | }, | |
9 | ); | |
10 | ||
11 | @Final = ( | |
12 | sub { | |
13 | $RT::Logger->debug("Going to correct descriptions of notify actions in the DB"); | |
14 | ||
15 | my $actions = RT::ScripActions->new( RT->SystemUser ); | |
16 | $actions->Limit( | |
17 | FIELD => 'ExecModule', | |
18 | VALUE => 'Notify', | |
19 | ); | |
20 | $actions->Limit( | |
21 | FIELD => 'Argument', | |
22 | VALUE => 'All', | |
23 | ); | |
24 | while ( my $action = $actions->Next ) { | |
25 | my ($status, $msg) = $action->__Set( Field => 'Name', Value => 'Notify Owner, Requestors, Ccs and AdminCcs' ); | |
26 | $RT::Logger->warning( "Couldn't change action name: $msg" ) | |
27 | unless $status; | |
28 | ||
29 | ($status, $msg) = $action->__Set( Field => 'Description', Value => 'Send mail to owner and all watchers' ); | |
30 | $RT::Logger->warning( "Couldn't change action description: $msg" ) | |
31 | unless $status; | |
32 | } | |
33 | ||
34 | $actions = RT::ScripActions->new( RT->SystemUser ); | |
35 | $actions->Limit( | |
36 | FIELD => 'ExecModule', | |
37 | VALUE => 'NotifyAsComment', | |
38 | ); | |
39 | $actions->Limit( | |
40 | FIELD => 'Argument', | |
41 | VALUE => 'All', | |
42 | ); | |
43 | while ( my $action = $actions->Next ) { | |
44 | my ($status, $msg) = $action->__Set( Field => 'Name', Value => 'Notify Owner, Requestors, Ccs and AdminCcs as Comment' ); | |
45 | $RT::Logger->warning( "Couldn't change action name: $msg" ) | |
46 | unless $status; | |
47 | ||
48 | ($status, $msg) = $action->__Set( Field => 'Description', Value => 'Send mail to owner and all watchers as a "comment"' ); | |
49 | $RT::Logger->warning( "Couldn't change action description: $msg" ) | |
50 | unless $status; | |
51 | } | |
52 | ||
53 | $RT::Logger->debug("Corrected descriptions of notify actions in the DB."); | |
54 | return 1; | |
55 | }, | |
56 | ); | |
57 | ||
58 | ||
59 | { | |
60 | $RT::Logger->debug("Going to add in Extract Subject Tag actions if they were missed during a previous upgrade"); | |
61 | ||
62 | $actions = RT::ScripActions->new( RT->SystemUser ); | |
63 | $actions->Limit( | |
64 | FIELD => 'ExecModule', | |
65 | VALUE => 'ExtractSubjectTag', | |
66 | ); | |
67 | my $extract_action = $actions->First; | |
68 | ||
69 | if ( $extract_action && $extract_action->Id ) { | |
70 | $RT::Logger->debug("You appear to already have an Extract Subject Tag action, skipping"); | |
71 | return 1; | |
72 | } else { | |
73 | $RT::Logger->debug("Didn't find an existing Extract Subject Tag action, adding it"); | |
74 | push @ScripActions, ( | |
75 | { Name => 'Extract Subject Tag', # loc | |
76 | Description => 'Extract tags from a Transaction\'s subject and add them to the Ticket\'s subject.', # loc | |
77 | ExecModule => 'ExtractSubjectTag' | |
78 | }, | |
79 | ); | |
80 | ||
81 | $RT::Logger->debug("Adding Extract Subject Tag Scrip"); | |
82 | push @Scrips, ( | |
83 | { Description => "On transaction, add any tags in the transaction's subject to the ticket's subject", | |
84 | ScripCondition => 'On Transaction', | |
85 | ScripAction => 'Extract Subject Tag', | |
86 | Template => 'Blank' | |
87 | }, | |
88 | ); | |
89 | } | |
90 | } | |
91 |