[Rt-devel] Question about user defined condition
Ruslan Zakirov
ruslan.zakirov at gmail.com
Thu Nov 17 16:49:20 EST 2005
http://wiki.bestpractical.com/?OnStatusChange
On 11/17/05, lwang <lwang at clusterfs.com> wrote:
> Hi there,
>
> I have put the following piece of code in
> /opt/rt3/local/lib/RT/Condition/OnDelete.pm
>
> package RT::Condition::OnDelete;
> require RT::Condition::Generic;
>
> use strict;
> use vars qw/@ISA/;
> @ISA = qw(RT::Condition::Generic);
>
> sub IsApplicable {
> my $self = shift;
> return ($self->TicketObj->status eq 'deleted');
> }
>
> 1;
>
> And then enabled it by the following code:
> #!/usr/bin/perl
>
> use strict;
> use lib "/opt/rt3/lib/";
>
> use RT;
> use RT::Interface::CLI qw( CleanEnv GetCurrentUser );
> use RT::ScripCondition;
>
> CleanEnv();
> RT::LoadConfig();
> RT::Init();
>
> my $user = GetCurrentUser();
> unless( $user->Id ) {
> print "No RT user found. Please consult your RT administrator.\n";
> exit 1;
> }
>
> my $sc = RT::ScripCondition->new($user);
>
> $sc->Create( Name => "On Delete",
> Description=> "When a ticket is deleted",
> ExecModule => "OnDelete",
> ApplicableTransTypes=> 'Status',
> );
>
>
> And then I set a scrip to notify the owner on deletion. However the
> owner never get a notification. BTW, my email server works well.
>
> Any suggestion is appreciated.
>
> Wang
> _______________________________________________
> Rt-devel mailing list
> Rt-devel at lists.bestpractical.com
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
>
--
Best regards, Ruslan.
More information about the Rt-devel
mailing list