summaryrefslogtreecommitdiff
path: root/rt/etc/upgrade/3.8.9/content
diff options
context:
space:
mode:
Diffstat (limited to 'rt/etc/upgrade/3.8.9/content')
-rw-r--r--rt/etc/upgrade/3.8.9/content63
1 files changed, 63 insertions, 0 deletions
diff --git a/rt/etc/upgrade/3.8.9/content b/rt/etc/upgrade/3.8.9/content
new file mode 100644
index 0000000..8a28f7d
--- /dev/null
+++ b/rt/etc/upgrade/3.8.9/content
@@ -0,0 +1,63 @@
+@Initial = (
+ sub {
+ use strict;
+ $RT::Logger->debug('Make sure local links are local');
+
+ use RT::URI::fsck_com_rt;
+ my $prefix = RT::URI::fsck_com_rt->LocalURIPrefix . '/ticket/';
+
+ foreach my $dir (qw(Target Base)) {
+ my $found;
+ do {
+ $found = 0;
+ my $links = RT::Links->new( $RT::SystemUser );
+ $links->Limit( FIELD => $dir, OPERATOR => 'STARTSWITH', VALUE => $prefix );
+ $links->Limit( FIELD => 'Local'.$dir, VALUE => 0 );
+ $links->Limit(
+ ENTRYAGGREGATOR => 'OR',
+ FIELD => 'Local'.$dir,
+ OPERATOR => 'IS',
+ VALUE => 'NULL',
+ );
+ $links->RowsPerPage( 1000 );
+ while ( my $link = $links->Next ) {
+ $found++;
+ my $uri = $link->$dir();
+ $uri =~ s/^\Q$prefix//;
+ if ( int($uri) eq $uri && $uri > 0 ) {
+ my $method = 'SetLocal'. $dir;
+ my ($status, $msg) = $link->$method( $uri );
+ unless ( $status ) {
+ die "Couldn't change local $dir: $msg";
+ }
+ } else {
+ die "$dir URI looks like local, but is not parseable";
+ }
+ }
+ } while $found == 1000;
+ }
+ },
+ sub {
+ my $queue = RT::Queue->new( $RT::SystemUser );
+ $queue->Load('___Approvals');
+ return unless $queue->id;
+
+ for my $name (
+ 'All Approvals Passed', 'Approval Passed', 'Approval Rejected'
+ )
+ {
+ my $template = RT::Template->new($RT::SystemUser);
+ $template->LoadQueueTemplate( Name => $name, Queue => $queue->id );
+ next unless $template->id;
+ my $content = $template->Content;
+
+ # there is only one OwnerObj->Name normally, so no need /g
+ if ( $content =~
+s!(?<=Your ticket has been (?:approved|rejected) by { eval { )\$Approval->OwnerObj->Name!\$Approver->Name!
+ )
+ {
+ $template->SetContent($content);
+ }
+ }
+ },
+);