NotResolved
HomePage > Contributions > NotResolved
NotResolved
Summary
It's just a simple condition which looks to see if the ticket isn't marked as 'resolved'. But, as I managed to write it, with the help of the mailing list and the Wiki, I want to share it. And it could, maybe, help someone else to faster understand the way to use his own conditions.
The perl module
With the help of the 'local' mecanism you can customize RT to fit your needs and keep them along the updates. First you need to create a local directory for your own Conditions
$mkdir rt/local/lib/RT/Condition/
In this directory you could add all the conditions you will write. For example let's write one :
package RT::Condition::NotResolved; # declare our package name use strict; use base qw(RT::Condition::Generic);# nherit from generic sub IsApplicable { # the method called by RT my $self = shift; my $ticket = $self->TicketObj; # we are able to retrieve the ticket object if ($ticket->Status ne 'resolved') { # we want to check if the ticket is resolved return(1); # if true, we can return 1, and the scrip action associated # will be executed } else { return(undef); # if false, we don't want that the scrip action will be executed } } eval "require RT::Condition::NotResolved_Vendor"; die $@ if ($@ && $@ !~ qr{^Can't locate RT/Condition/NotResolved_Vendor.pm}); eval "require RT::Condition::NotResolved_Local"; die $@ if ($@ && $@ !~ qr{^Can't locate RT/Condition/NotResolved_Local.pm}); 1;
^^ I put the file here : rt/local/lib/RT/Condition/NotResolved.pm
Tell RT that we have a new scrip condition
Now we must inform RT that we have added a new scrip condition in order to let people use it. Use the following data file and AddDatabaseRecords instructions:
@ScripConditions = ( { Name => "Lors d'une r�ponse � un ticket non r�solu", # short description Description => "Lors d'une r�ponse � un ticket non r�solu", # long description ExecModule => 'NotResolved', # name of our module ApplicableTransTypes => 'Correspond', # the transaction type in which # the condition will be called }, { Name => "Lors d'un commentaire � un ticket non r�solu", Description => "Lors d'un commentaire � un ticket non r�solu", ExecModule => 'NotResolved', ApplicableTransTypes => 'Comment', } );
as you can see we can use the same module for different transaction type. Available transaction types are:
- Any
- Create
- Correspond
- Comment
- Status
- Set
Conclusion
Now you can simply use it directly from the web RT interface.
Thanks
I want to thanks all people that have help me to better understand RT.