4 our @ScripConditions = (
5 { Name => 'On Reject', # loc
6 Description => 'Whenever a ticket is rejected', # loc
7 ApplicableTransTypes => 'Status',
8 ExecModule => 'StatusChange',
16 RT->Logger->debug("Going to correct descriptions of notify actions in the DB");
18 my $actions = RT::ScripActions->new( RT->SystemUser );
20 FIELD => 'ExecModule',
27 while ( my $action = $actions->Next ) {
28 my ($status, $msg) = $action->__Set( Field => 'Name', Value => 'Notify Owner, Requestors, Ccs and AdminCcs' );
29 RT->Logger->warning( "Couldn't change action name: $msg" )
32 ($status, $msg) = $action->__Set( Field => 'Description', Value => 'Send mail to owner and all watchers' );
33 RT->Logger->warning( "Couldn't change action description: $msg" )
37 $actions = RT::ScripActions->new( RT->SystemUser );
39 FIELD => 'ExecModule',
40 VALUE => 'NotifyAsComment',
46 while ( my $action = $actions->Next ) {
47 my ($status, $msg) = $action->__Set( Field => 'Name', Value => 'Notify Owner, Requestors, Ccs and AdminCcs as Comment' );
48 RT->Logger->warning( "Couldn't change action name: $msg" )
51 ($status, $msg) = $action->__Set( Field => 'Description', Value => 'Send mail to owner and all watchers as a "comment"' );
52 RT->Logger->warning( "Couldn't change action description: $msg" )
56 RT->Logger->debug("Corrected descriptions of notify actions in the DB.");
61 our (@ScripActions, @Scrips);
63 RT->Logger->debug("Going to add in Extract Subject Tag actions if they were missed during a previous upgrade");
65 my $actions = RT::ScripActions->new( RT->SystemUser );
67 FIELD => 'ExecModule',
68 VALUE => 'ExtractSubjectTag',
70 my $extract_action = $actions->First;
72 if ( $extract_action && $extract_action->Id ) {
73 RT->Logger->debug("You appear to already have an Extract Subject Tag action, skipping");
76 RT->Logger->debug("Didn't find an existing Extract Subject Tag action, adding it");
78 { Name => 'Extract Subject Tag', # loc
79 Description => 'Extract tags from a Transaction\'s subject and add them to the Ticket\'s subject.', # loc
80 ExecModule => 'ExtractSubjectTag'
84 RT->Logger->debug("Adding Extract Subject Tag Scrip");
86 my $action = RT::ScripAction->new( RT->SystemUser );
87 $action->Load( 'Extract Subject Tag' );
88 my $condition = RT::ScripCondition->new( RT->SystemUser );
89 $condition->Load( 'On Transaction' );
90 my $template = RT::Template->new( RT->SystemUser );
91 $template->LoadByName( Name => 'Blank', Queue => 0 );
92 my $scrip = RT::Scrip->new( RT->SystemUser );
93 $scrip->RT::Record::Create(
94 Description => "On transaction, add any tags in the transaction's subject to the ticket's subject",
95 ScripCondition => $condition->id,
96 ScripAction => $action->id,
97 Template => $template->id,
98 Stage => 'TransactionCreate',