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;
15 $desc = gen_scrip_description( $scrip );
17 my ($status, $msg) = $scrip->SetDescription( $desc );
19 print STDERR "Couldn't set description of a scrip: $msg";
21 print "Added description to scrip #". $scrip->id ."\n";
27 sub gen_scrip_description {
32 $condition = $scrip->ConditionObj->Name
33 || $scrip->ConditionObj->Description
34 || ('On Condition #'. $scrip->Condition);
39 print STDERR "Reference to missing scrip condition found. If you have ScripCondition = 0 in the Scrips table, update with a real condition number.\n";
40 $condition = 'On undefined Condition # 0';
43 my $action = $scrip->ActionObj->Name
44 || $scrip->ActionObj->Description
45 || ('Run Action #'. $scrip->Action);
46 return join ' ', $condition, $action;