4 $RT::Logger->debug('Make sure local links are local');
6 use RT::URI::fsck_com_rt;
7 my $prefix = RT::URI::fsck_com_rt->LocalURIPrefix . '/ticket/';
9 foreach my $dir (qw(Target Base)) {
13 my $links = RT::Links->new( $RT::SystemUser );
14 $links->Limit( FIELD => $dir, OPERATOR => 'STARTSWITH', VALUE => $prefix );
15 $links->Limit( FIELD => 'Local'.$dir, VALUE => 0 );
17 ENTRYAGGREGATOR => 'OR',
18 FIELD => 'Local'.$dir,
22 $links->RowsPerPage( 1000 );
23 while ( my $link = $links->Next ) {
25 my $uri = $link->$dir();
26 $uri =~ s/^\Q$prefix//;
27 if ( int($uri) eq $uri && $uri > 0 ) {
28 my $method = 'SetLocal'. $dir;
29 my ($status, $msg) = $link->$method( $uri );
31 die "Couldn't change local $dir: $msg";
34 die "$dir URI looks like local, but is not parseable";
37 } while $found == 1000;
41 my $queue = RT::Queue->new( $RT::SystemUser );
42 $queue->Load('___Approvals');
43 return unless $queue->id;
46 'All Approvals Passed', 'Approval Passed', 'Approval Rejected'
49 my $template = RT::Template->new($RT::SystemUser);
50 $template->LoadQueueTemplate( Name => $name, Queue => $queue->id );
51 next unless $template->id;
52 my $content = $template->Content;
54 # there is only one OwnerObj->Name normally, so no need /g
56 s!(?<=Your ticket has been (?:approved|rejected) by { eval { )\$Approval->OwnerObj->Name!\$Approver->Name!
59 $template->SetContent($content);