lwang
1
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
My guess would be that TicketObj still has the old status when the scrip
is running. Haven’t checked though.
Is there a reason you didn’t use the StatusChange Condition similar toOn Resolve? That’s what I would have done. Rolf. lwang 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@lists.bestpractical.com
The rt-devel Archives
Request Tracker Wiki 11/17/05, lwang lwang@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@lists.bestpractical.com
The rt-devel Archives
Best regards, Ruslan.
lwang
4
Grossman,
Yes, you are right. It works after I change the code.
“RT Essentials” by O’Reilly tells me wrong story.
Wang
Rolf Grossmann wrote:
Really!? So it’s not “RT Essentials” misstake, but RT’s bug, because
TicketObj should have new status.On 11/18/05, lwang lwang@clusterfs.com wrote:
Grossman,
Yes, you are right. It works after I change the code.
“RT Essentials” by O’Reilly tells me wrong story.
Wang
Rolf Grossmann wrote:
My guess would be that TicketObj still has the old status when the scrip
is running. Haven’t checked though.
Is there a reason you didn’t use the StatusChange Condition similar to
On Resolve? That’s what I would have done. Rolf. lwang 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@lists.bestpractical.com
The rt-devel Archives
Rt-devel mailing list
Rt-devel@lists.bestpractical.com
The rt-devel Archives
Best regards, Ruslan.
lwang
6
I’m using 3.5.5 and “RT Essentials” is about 3.4.4.
Ruslan Zakirov wrote: