6 RT->Logger->debug('Make sure local links are local');
8 use RT::URI::fsck_com_rt;
9 my $prefix = RT::URI::fsck_com_rt->LocalURIPrefix . '/ticket/';
11 foreach my $dir (qw(Target Base)) {
15 my $links = RT::Links->new( RT->SystemUser );
16 $links->Limit( FIELD => $dir, OPERATOR => 'STARTSWITH', VALUE => $prefix );
17 $links->Limit( FIELD => 'Local'.$dir, VALUE => 0 );
19 ENTRYAGGREGATOR => 'OR',
20 FIELD => 'Local'.$dir,
24 $links->RowsPerPage( 1000 );
25 while ( my $link = $links->Next ) {
27 my $uri = $link->$dir();
28 $uri =~ s/^\Q$prefix//;
29 if ( int($uri) eq $uri && $uri > 0 ) {
30 my $method = 'SetLocal'. $dir;
31 my ($status, $msg) = $link->$method( $uri );
33 die "Couldn't change local $dir: $msg";
36 die "$dir URI looks like local, but is not parseable";
39 } while $found == 1000;
43 my $queue = RT::Queue->new( $RT::SystemUser );
44 $queue->Load('___Approvals');
45 return unless $queue->id;
48 'All Approvals Passed', 'Approval Passed', 'Approval Rejected'
51 my $template = RT::Template->new($RT::SystemUser);
52 $template->LoadQueueTemplate( Name => $name, Queue => $queue->id );
53 next unless $template->id;
54 my $content = $template->Content;
56 # there is only one OwnerObj->Name normally, so no need /g
58 s!(?<=Your ticket has been (?:approved|rejected) by \{ eval \{ )\$Approval->OwnerObj->Name!\$Approver->Name!
61 $template->SetType('Perl');
62 $template->SetContent($content);