SOLVED: [rt-users] RT Scrip: Comment undefs ticket?
Todd Chapman
rt at chaka.net
Tue Sep 7 14:34:43 EDT 2004
Solved. I accidentally used 'foreach' when I should hae been using
'while' I know it was staring me in the face. :)
-Todd
On Tue, Sep 07, 2004 at 11:13:46AM -0400, Todd Chapman wrote:
> Making a copy before the comment allows a work around. But why
> is this happening?
>
> -Todd
>
> On Tue, Sep 07, 2004 at 11:09:05AM -0400, Todd Chapman wrote:
> > BTW, this is RT 3.0.10.
> >
> > Thanks.
> >
> > -Todd
> >
> > On Tue, Sep 07, 2004 at 11:07:14AM -0400, Todd Chapman wrote:
> > > Here is a small part of a larger scrip I am writing
> > > to reject children of a rejected ticket.
> > >
> > > Once I added the Comment line the SetStatus stopped
> > > working. Why would the Comment undef the ticekt object?
> > >
> > >
> > > if ($self->TicketObj->HasOpenChildren) {
> > > my $OpenChildren = $self->TicketObj->OpenChildren;
> > > foreach (my $child = $OpenChildren->Next) {
> > > $RT::Logger->debug("Before Comment: " . $child);
> > > $child->Comment(Content => "This ticket is being marked 'rejected' because it's parent had been rejected.");
> > > $RT::Logger->debug("After Comment: " . $child);
> > > $child->SetStatus('rejected');
> > > }
> > > }
> > >
> > >
> > > Sep 7 10:41:43 slah001 RT: Before Comment: RT::Ticket=HASH(0x9c47f50)
> > > Sep 7 10:41:43 slah001 RT: Guessed encoding: ascii
> > > Sep 7 10:41:43 slah001 RT: Guessed encoding: ascii
> > > Sep 7 10:41:43 slah001 RT: Converting 'ascii' to 'utf-8' for text/plain -
> > > Sep 7 10:41:43 slah001 RT: <rt-3.0.10-3716-8734.8.49914632532261 at gedas.com> #3716/8734 - Scrip 7 (/opt/rt3/lib/RT/Action/SendEmail.pm:92)
> > > Sep 7 10:41:43 slah001 RT: <rt-3.0.10-3716-8734.8.49914632532261 at gedas.com> No recipients found. Not sending. (/opt/rt3/lib/RT/Action/SendEmail.pm:257)
> > > Sep 7 10:41:44 slah001 RT: <rt-3.0.10-3716-8734.7.28305001446849 at gedas.com> #3716/8734 - Scrip 8 (/opt/rt3/lib/RT/Action/SendEmail.pm:92)
> > > Sep 7 10:41:44 slah001 RT: <rt-3.0.10-3716-8734.7.28305001446849 at gedas.com> No recipients found. Not sending. (/opt/rt3/lib/RT/Action/SendEmail.pm:257)
> > > Sep 7 10:41:44 slah001 RT: After Comment:
> > > Sep 7 10:41:44 slah001 RT: Scrip 30 Commit failed: Can't call method "SetStatus" on an undefined value at (eval 15262) line 133. Stack: [(eval 15262):133] [/opt/rt3/lib/RT/ScripAction_Overlay.pm:207] [/opt/rt3/lib/RT/Scrip_Overlay.pm:417] [/opt/rt3/lib/RT/Scrip_Overlay.pm:352] [/opt/rt3/lib/RT/Scrips_Overlay.pm:196] [/opt/rt3/lib/RT/Transaction_Overlay.pm:118] [/opt/rt3/lib/RT/Ticket_Overlay.pm:3810] [/opt/rt3/lib/RT/Ticket_Overlay.pm:3953] [/opt/rt3/lib/RT/Ticket_Overlay.pm:3324] [/opt/rt3/lib/RT/Interface/Web.pm:951] [/opt/rt3/lib/RT/Interface/Web.pm:1073] [/opt/rt3/share/html/Ticket/Display.html:112] [/opt/rt3/local/html/Ticket/Update.html:198] [/opt/rt3/share/html/autohandler:196] (/opt/rt3/lib/RT/Action/UserDefined.pm:59)
> > > Sep 7 10:41:44 slah001 RT: RT::Scrip=HASH(0x9d15630): Couldn't commit User Defined (/opt/rt3/lib/RT/Scrip_Overlay.pm:353)
> > >
> > > _______________________________________________
> > > http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> > >
> > > Be sure to check out the RT wiki at http://wiki.bestpractical.com
> > _______________________________________________
> > http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> >
> > Be sure to check out the RT wiki at http://wiki.bestpractical.com
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Be sure to check out the RT wiki at http://wiki.bestpractical.com
More information about the rt-users
mailing list