[rt-users] rt3, custom scrip action failing commit (AutoTake)
matthew zeier
mrz at intelenet.net
Fri Aug 1 20:14:02 EDT 2003
Ken Bantoft emailed me his code for doing an "AutoTake" but it's not working
for me and it's not clear to me how to debug this. Part of the code was
taken from Bruce's AutoTake scrip from rt2.
I tried changing HasQueueRight to CurrentUserHasQueueRight but that's also
not defined in RT::Action::UserDefined and I don't know where/how it should
be.
Aug 1 17:07:08 help2 RT: AutoAssign: No owner - autoassigning ((eval
1765):5)
Aug 1 17:07:08 help2 RT: Scrip 28 Commit failed: RT::User::HasQueueRight
Unimplemented in RT::Action::UserDefined. ((eval 1766) line 4) Stack:
[/usr/lib/perl5/site_perl/5.8.0/DBIx/SearchBuilder/Record.pm:457] [(eval
1766):4] [/opt/rt3/lib/RT/ScripAction_Overlay.pm:192]
[/opt/rt3/lib/RT/Scrip_Overlay.pm:409]
[/opt/rt3/lib/RT/Scrip_Overlay.pm:344]
[/opt/rt3/lib/RT/Transaction_Overlay.pm:169]
[/opt/rt3/lib/RT/Ticket_Overlay.pm:3789]
[/opt/rt3/lib/RT/Ticket_Overlay.pm:2314]
[/opt/rt3/lib/RT/Interface/Web.pm:397]
[/opt/rt3/share/html/Ticket/Display.html:99]
[/opt/rt3/share/html/Ticket/Update.html:196]
[/opt/rt3/share/html/autohandler:163]
(/opt/rt3/lib/RT/Action/UserDefined.pm:59)
Aug 1 17:07:08 help2 RT: RT::Scrip=HASH(0x948e4cc): Couldn't commit User
Defined (/opt/rt3/lib/RT/Scrip_Overlay.pm:345)
Description: Auto Assign
Condition: On Create
Custom Condition:
Action: User Defined
Custom action preparation code:
my $retval = undef;
if ( defined( $self->TicketObj->OwnerObj->id ) ){
# Only change tickets where ID is *not* already set
if( $self->TicketObj->OwnerObj->Id == $RT::Nobody->Id ){
$RT::Logger->info("AutoAssign: No owner - autoassigning");
$retval = 1;
}
}
return ($retval);
Custom action cleanup code:
my $retval = undef;
# Are they one of the Privileged few?
if ($self->TransactionObj->CreatorObj->Privileged &&
$self->TransactionObj->CreatorObj->Id != $RT::Nobody->Id ) {
# Can they own a ticket in this queue?
if( $self->TransactionObj->CreatorObj->HasQueueRight(
QueueObj=>$self->TicketObj->QueueObj, Right => 'OwnTicket' ) ){
# They can own the ticket. Make it so.
$retval =
$self->TicketObj->SetOwner($self->TransactionObj->CreatorObj->Id );
}
}
return( $retval );
Template: Global Template Blank
--
matthew zeier | "Nothing in life is to be feared.
InteleNet Communications, Inc. | It is only to be understood."
(949) 784-7904 | - Marie Curie
More information about the rt-users
mailing list