[rt-users] Help with perl code to resolve all children tickets

Kenneth Crocker kfcrocker at lbl.gov
Tue Jan 25 11:49:35 EST 2011


Kevin,

AHHH. I'll check it out.

Thanks.

Kenn
LBNL

On Mon, Jan 24, 2011 at 6:59 PM, Kevin Falcone <falcone at bestpractical.com>wrote:

> On Mon, Jan 24, 2011 at 12:06:02PM -0800, Kenneth Crocker wrote:
> >    To list,
> >
> >    I was fooling around with the idea of creating a scrip that would
> allow the resolution of a
> >    parent ticket to automatically resolve all children tickets. I thought
> this would be helpful
> >    if a developer had a bunch of sub-tasks/tickets and they didn't want
> to go in and "resolve"
> >    each one individually, they could just "resolve" the parent and that
> would cause a cascade
> >    effect to go ahead and resolve all the children. This is the code I
> developed:
> >
> >    # Resolve all Ticket children when the Ticket is resolved
> >
> >    if (defined($id))
> >    {
> >    $tickets->FromSQL('Type = "ticket" AND MemberOf="'.$id.'"');
> >    # Loop thru all Children
> >    while (my $child = $tickets->Next) {
> >    next unless( $child->Status =~ /^(?:new|open|stalled)$/ );
> >    $RT::Logger->info("Closing associated child");
> >    $child->SetStatus("resolved");
> >
> >    This worked fine except in the situation where a "Child" ticket was
> also a "Depends/on"
> >    ticket. The cascade stops. Well, that made sense, but I want to get
> around that.
> >
> >    So I tried to force it with:
> >
> >    # Resolve all Ticket children when the Ticket is resolved
> >
> >    ........
> >    ........
> >    $child->SetStatus("resolved", 'Force');
> >
> >    This didn't work. The top parent was resolved, but no cascade effect
> to any of the "child"
> >    tickets at all, even when there was no "DependsOn" relationship.
> >
> >    I looked at the log and it shows the first ticket resolved, but no
> errors after that and yet,
> >    the children weren't resolved.
> >
> >    Without the "Force", it works just fine, up to the ticket with the
> "DependsOn"child.
> >
> >    So .... I went to several Perl handbooks (Perl Cookbook by O'Reilly,
> Perl for Dummies, etc.)
> >    and found nothing on the "Set" command, let alone the "Force" option.
> >    I went to the RT Essentials book and found nothing.
>
> The relevant documentation is found in perldoc
> lib/RT/Ticket_Overlay.pm . You're passing incorrect arguments to
> SetStatus
>
> >    I am NOT a perl programmer, but understand enough basic perl to be
> able to clone a scrip or
> >    two and modify it with what little perl knowledge(?) I have.
> >
> >    Obviously, I don't know enough about perl to figure this one out.
> >
> >    Can anyone help me out with some perl clues/instruction here?
> >
> >    Thanks in advance.
> >
> >    Kenn
> >    LBNL
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110125/9f2be854/attachment.htm>


More information about the rt-users mailing list