From Request Tracker Wiki
Jump to navigation Jump to search

HomePage > Contributions > ReplyToResolved



this is a simple scrip to catch correspondence/reply to ticket marked 'resolved'

the scrip condition

Save this file as e.g. /usr/local/share/request-tracker3.6/lib/RT/Condition/

package RT::Condition::ReplyToResolvedTicket;

use strict;
use base qw(RT::Condition::Generic); # thanks Ruslan for the suggestion
sub IsApplicable {
   my $self = shift;
   my $ticket = $self->TicketObj;
   my $transaction = $self->TransactionObj;
   if ((($transaction->Type eq 'Correspond') || ($transaction->Type eq 'Comment'))  &&
       $ticket->Status eq 'resolved' &&
       $transaction->Creator != 1)  { # prevent loop
   else {
eval "require RT::Condition::ReplyToResolvedTicket_Vendor";
die $@ if ($@ && $@ !~ qr{^Can't locate RT/Condition/});
eval "require RT::Condition::ReplyToResolved_Local";
die $@ if ($@ && $@ !~ qr{^Can't locate RT/Condition/});


The following Perl script is used to register i.e. active the above code in RT and is no longer necessary afterwards:

 use strict;
 use Unicode::String qw(utf8 latin1);
 # Replace this with your RT_LIB_PATH
 use lib "/home/rt/rt/lib";
 # Replace this with your RT_ETC_PATH
 use lib "/home/rt/rt/etc";
 use RT;
 use RT::Interface::CLI qw( CleanEnv GetCurrentUser );
 use RT::ScripCondition;
 ##Drop setgid permissions
 ##Get the current user all loaded
 our $CurrentUser = GetCurrentUser();
 unless( $CurrentUser->Id )
   print "No RT user found. Please consult your RT administrator.\n";
   exit 1;
 my $sc = new RT::ScripCondition($CurrentUser);
            Name                 => 'On Reply to Resolved Ticket',
            Description          => "Lors d'une r�ponse � un ticket r�solu",
            ExecModule           => 'ReplyToResolvedTicket',
            ApplicableTransTypes => 'Any'


If you face problems with this scrip take a look at the NotResolved condition scrip as is it very similar, and I have detailled it more.


I personally use it with the ForkIntoNewTicket scrip action in order to open a new ticket on reply to resolved ticket. I also have disabled the global scrip On Reply Open by setting "Stage:" to "disabled". For the new script use the following values:

Description: Replies to resolved tickets create a new ticket.

Condition:     On Reply To Resolved Ticket
Action:    Force Correspondence into new Ticket
Template:  Global Template: Correspondence
Stage:     TransactionCreate