[Rt-devel] duplicating a scrip in code

Todd Chapman todd at chaka.net
Thu Jan 5 23:44:10 EST 2006


On Fri, Jan 06, 2006 at 03:27:17PM +1100, Jens Porup wrote:
> On Thu, Jan 05, 2006 at 11:10:44PM -0500, Todd Chapman wrote:
> > On Fri, Jan 06, 2006 at 12:48:38PM +1100, Jens Porup wrote:
> > > But what about getter and setter methods, though, after ticket
> > > creation? Like:
> > > 
> > >         $Ticket->SetParent('123');
> > >         $Ticket->SetChildren('234');
> > 
> > See Ticket::AddLink
> > 
> > > 
> > > This is because after I set the Parent value for the child ticket,
> > > I now have to set the Children value for the parent ticket, but 
> > > there doesn't seem to be a subroutine in the Ticket*.pm modules
> > > to do that.
> > 
> > No you don't. By definition link are bi-directional.
> 
> After further testing, it looks like 
> 
>         $TicketObj->Create(
>                             Queue => "Inventory",
>                             Owner => $creator,
>                             Parent => $id, #parent bit fails
>                         );
> 
> does not work. 
> 
> No Parent link is being created, nor reciprocal Children links created.
> 
> Hence my question about creating links.
> 
> > > Another tack:
> > > 
> > > Where is the code that takes a create ticket template and sets
> > > up all the reciprocal relationships? Is there really no way
> > > for me to plugin to that code, and have it set up all this
> > > stuff for me?
> > 
> > Good luck on doing it the hard way.
> 
> I'm trying to do it the *obvious* way. That the RT API does not provide
> an interface for me to do it the obvious way is a reflection on the code base,
> not on me. 
> 
> If done properly, what I'm asking how to do should be one line of code:
> 
> 	$Ticket->RunScrip()
> 
> with a possible optional parameter of an associated template.

Scrips are only run as a result of a transaction, so that
wouldn't make sense.

> 
> Jens


More information about the Rt-devel mailing list