]>
Commit | Line | Data |
---|---|---|
af59614d MKG |
1 | use strict; |
2 | use warnings; | |
01e3b242 | 3 | |
af59614d MKG |
4 | our @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 | |
27 | sub 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 | |
38 | 1; |