Putting 4.2.0 on top of 4.0.17
[usit-rt.git] / etc / upgrade / 3.7.19 / content
CommitLineData
af59614d
MKG
1use strict;
2use warnings;
01e3b242 3
af59614d
MKG
4our @Final = (
5 sub {
6 require RT::Scrips;
7 my $scrips = RT::Scrips->new( RT->SystemUser );
8 $scrips->{'with_disabled_column'} = 0;
9 $scrips->Limit( FIELD => 'Description', OPERATOR => 'IS', VALUE => 'NULL' );
10 $scrips->Limit( FIELD => 'Description', VALUE => '' );
11 while ( my $scrip = $scrips->Next ) {
12 my $desc = $scrip->Description;
13 next if defined $desc && length $desc;
01e3b242 14
af59614d 15 $desc = gen_scrip_description( $scrip );
01e3b242 16
af59614d
MKG
17 my ($status, $msg) = $scrip->SetDescription( $desc );
18 unless ( $status ) {
19 print STDERR "Couldn't set description of a scrip: $msg";
20 } else {
21 print "Added description to scrip #". $scrip->id ."\n";
22 }
01e3b242 23 }
af59614d
MKG
24 },
25);
01e3b242
MKG
26
27sub gen_scrip_description {
28 my $scrip = shift;
29 my $condition = $scrip->ConditionObj->Name
30 || $scrip->ConditionObj->Description
31 || ('On Condition #'. $scrip->Condition);
32 my $action = $scrip->ActionObj->Name
33 || $scrip->ActionObj->Description
34 || ('Run Action #'. $scrip->Action);
35 return join ' ', $condition, $action;
36}
01e3b242
MKG
37
381;