[Rt-commit] rt branch, 4.2/template-column-update-for-disabled-scrips, created. rt-4.2.1-69-g90ba566
? sunnavy
sunnavy at bestpractical.com
Mon Dec 30 09:39:25 EST 2013
The branch, 4.2/template-column-update-for-disabled-scrips has been created
at 90ba56675bc5f288d4483f079f89a3b4c0d4cdc7 (commit)
- Log -----------------------------------------------------------------
commit 90ba56675bc5f288d4483f079f89a3b4c0d4cdc7
Author: sunnavy <sunnavy at bestpractical.com>
Date: Mon Dec 30 22:37:25 2013 +0800
id => name update of template column for disabled scrips
we missed it in 4.1.5 upgrade.
diff --git a/etc/upgrade/4.1.5/content b/etc/upgrade/4.1.5/content
index 0ed1dda..4cf1bdb 100644
--- a/etc/upgrade/4.1.5/content
+++ b/etc/upgrade/4.1.5/content
@@ -6,6 +6,7 @@ our @Initial = (
sub {
require RT::Scrips;
my $scrips = RT::Scrips->new( RT->SystemUser );
+ $scrips->{'find_disabled_rows'} = 1;
$scrips->UnLimit;
while ( my $scrip = $scrips->Next ) {
my $id = $scrip->Template;
diff --git a/etc/upgrade/4.2.2/content b/etc/upgrade/4.2.2/content
index 31e4d9f..762289a 100644
--- a/etc/upgrade/4.2.2/content
+++ b/etc/upgrade/4.2.2/content
@@ -25,5 +25,35 @@ our @Initial = (
}
return 1;
},
+
+ sub {
+ require RT::Scrips;
+ my $scrips = RT::Scrips->new( RT->SystemUser );
+ $scrips->{'find_disabled_rows'} = 1;
+ $scrips->Limit( FIELD => 'Disabled', VALUE => 1 );;
+ while ( my $scrip = $scrips->Next ) {
+ my $id = $scrip->Template;
+ if ( $id =~ /\D/ ) {
+ $RT::Logger->info('Template column for scrip #'. $scrip->id .' already contains characters');
+ next;
+ }
+
+ my $name;
+
+ my $template = RT::Template->new( RT->SystemUser );
+ $template->Load( $id );
+ unless ( $template->id ) {
+ $RT::Logger->error("Scrip #". $scrip->id ." has template set to #$id, but it's not in DB, setting it 'Blank'");
+ $name = 'Blank';
+ } else {
+ $name = $template->Name;
+ }
+
+ my ($status, $msg) = $scrip->_Set( Field => 'Template', Value => $name );
+ unless ( $status ) {
+ $RT::Logger->error("Couldn't set template: $msg");
+ }
+ }
+ },
);
-----------------------------------------------------------------------
More information about the rt-commit
mailing list