[rt-users] Condition error

Leon rt at tux.datalink.co.za
Thu Feb 16 07:34:14 EST 2006


I have used the Reply to resolved ticket condition from the wiki 
contribution page and I can’t get it to work.

I have found an old post where someone tried to copy the Base.pm and 
Generic.pm to the Local folders and that worked for them ( not for me), 
I tried copying the ReplyToResolvedTicket.pm to the lib folder, but it 
also didn’t work.



It looks like it can’t create an object of type ReplyToResolvedTicket 
for some reason, but I am not sure if this is the case or why. Any help 
would really be appreciated.



I get the following errors:



[Thu Feb 16 11:51:30 2006] [error]: Scrip IsApplicable 15 died. - Can't 
locate object method "new" via package 
"RT::Condition::ReplyToResolvedTicket" at 
/opt/rt3/lib/RT/ScripCondition_Overlay.pm line 181.



Stack:
   [/opt/rt3/lib/RT/ScripCondition_Overlay.pm:181]
   [/opt/rt3/lib/RT/Scrip_Overlay.pm:433]
   [/opt/rt3/lib/RT/Scrips_Overlay.pm:229]
   [/opt/rt3/lib/RT/Transaction_Overlay.pm:162]
   [/opt/rt3/lib/RT/Record.pm:1431]
   [/opt/rt3/lib/RT/Ticket_Overlay.pm:2404]
   [/opt/rt3/lib/RT/Ticket_Overlay.pm:2319]
   [/opt/rt3/lib/RT/Interface/Email.pm:793]
   [/opt/rt3/share/html/REST/1.0/NoAuth/mail-gateway:56]
  (/opt/rt3/lib/RT/Scrip_Overlay.pm:447)



Here is the ReplyToResolvedTicket.pm file, that is located in
/opt/rt3/local/RT/Condition/
--------------
package RT::Condition::ReplyToResolved;
require RT::Condition::Generic;

use strict;
use vars qw/@ISA/;
@ISA = qw(RT::Condition::Generic);

##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
         return(1);
     }
     else {
         return(undef);
     }
}
eval "require RT::Condition::ReplyToResolvedTicket_Vendor";
die $@ if ($@ && $@ !~ qr{^Can't locate 
RT/Condition/ReplyToResolved_Vendor.pm});
eval "require RT::Condition::ReplyToResolved_Local";
die $@ if ($@ && $@ !~ qr{^Can't locate 
RT/Condition/ReplyToResolved_Local.pm});
1;
--------------------------

Here is the script that I used to add the condition to the database:
--------------------------
#!/usr/local/bin/perl
use strict;
use Unicode::String qw(utf8 latin1);

# Replace this with your RT_LIB_PATH
use lib "/opt/rt3/lib";

# Replace this with your RT_ETC_PATH
use lib "/opt/rt3/etc";

use RT;
use RT::Interface::CLI qw( CleanEnv GetCurrentUser );
use RT::ScripCondition;
CleanEnv();
RT::LoadConfig();
RT::Init();

##Drop setgid permissions
##RT::DropSetGIDPermissions();
##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);

$sc->Create(
             Name                 => 'On Reply to Resolved Ticket',
             Description          => "On Reply to Resolved Ticket",
             ExecModule           => 'ReplyToResolvedTicket',
             ApplicableTransTypes => 'Any'
             );
--------------------------

This is the scrip that I added to RT to test with:
Desc: ReplyToResolved
Condition: On Reply to Resolved Ticket
Action: Userdefined
Template: Global Template: Blank
Stage:TransactionCreate

Custom action Prepration code: 1;
Custom action cleanup code: 1;

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the rt-users mailing list