[rt-users] Add a Condition as a perl module

Sebastien Person sebastien.person at easter-eggs.com
Wed Mar 31 07:15:06 EST 2004


On Wed, 31 Mar 2004 14:29:50 +0400
"Ruslan U. Zakirov" <cubic at acronis.ru> wrote:

> Sebastien Person wrote:
> > Hi,
> > 
> > I'm trying to add a Scrip Condition as a perl module. I have 2 questions :
> > 
> > 1 - Where the file must be (I'm not sure that the local directory could be
> > used)? 
> > rt/lib/RT/Condition/MyCondition.pm or
> > rt/local/lib/RT/Condition/MyCondition.pm
> Any where where perl could find next module 'RT::Condition::MyCondition'
> 'local' fine too.

Thanks for your answer.
I've tried twice and it work well in the rt/lib/RT/Condition
directory but if I use the 'local' directory I got an error :

---
[Wed Mar 31 11:58:15 2004] [error]: Scrip 19 died. - Can't locate object method
"new" via package "RT::Condition::ReplyToResolvedTicket" at
/home/rt/rt/lib/RT/ScripCondition_Overlay.pm line 155.

Stack:
  [/home/rt/rt/lib/RT/ScripCondition_Overlay.pm:155]
  [/home/rt/rt/lib/RT/Scrip_Overlay.pm:328]
  [/home/rt/rt/lib/RT/Scrips_Overlay.pm:196]
  [/home/rt/rt/lib/RT/Transaction_Overlay.pm:118]
  [/home/rt/rt/lib/RT/Ticket_Overlay.pm:3810]
  [/home/rt/rt/lib/RT/Ticket_Overlay.pm:2325]
  [/home/rt/rt/lib/RT/Interface/Email.pm:709]
  [/home/rt/rt/share/html/REST/1.0/NoAuth/mail-gateway:31]
 (/home/rt/rt/lib/RT/Scrip_Overlay.pm:371)
---

So I copy the RT/Base.pm and RT/Condition/Generic.pm in the 'local' directory
and
that works. Didn't know if it is the good way but I post it in the case it
could help someone else...

> > 
> > 2 - I must insert a row in the DB. I can use the
> > RT::ScripCondition->Create() to achieve this, but I have a question about
> > the 'ApplicableTransTypes' columns. Is it possible to fill it with
> > 'Correspond,Comment' in the same row ? I would like my scrip to be fired in
> > Correspond or Comment transaction type....
> 
> Nope, comma separated list not available.
> Work around:
> 1) use 'Any' for 'ApplicableTransTypes'
> 2) return false in 'sub IsApplicable' of your condition.



More information about the rt-users mailing list