[rt-users] round-robin auto assignment?
Todd Chapman
rt at chaka.net
Tue Dec 28 17:40:33 EST 2004
Sorry. Use this:
$self->TicketObj->SetOwner
On Tue, Dec 28, 2004 at 03:03:14PM -0800, matthew zeier wrote:
>
> >
> >$Transaction->TicketObj->SetOwner
> >
>
> Similiar error.
>
> [Tue Dec 28 23:01:49 2004] [error]: Scrip 57 Prepare failed: Global symbol
> "$Ticket" requires explicit package name at (eval 2195) line 6.
> Global symbol "$Transaction" requires explicit package name at (eval 2195)
> line 18.
> Global symbol "$Transaction" requires explicit package name at (eval 2195)
> line 24.
> syntax error at (eval 2195) line 24, near "->SetOwner["
> (/opt/rt3/lib/RT/Action/UserDefined.pm:65)
>
>
>
> my @owners = qw( 2306 904 1880 ); #could create a group for this
> push(@owners, @owners);
>
> my $tickets = RT::Tickets->new($RT::System);
> $tickets->LimitQueue(VALUE => 'ICI Internal');
> $tickets->LimitId(VALUE => $Ticket->Id, OPERATOR => '!=');
> $tickets->OrderBy( FIELD => 'id', ORDER => 'DESC' );
> my $last_ticket = $tickets->First;
> my $last_owner = $last_ticket->Owner->Id;
>
> my $i = 0;
> my $isSet = 0;
> my $new_owner;
>
> foreach $i ( @owners) {
> if ($owners[$i] == $last_owner) {
> $new_owner = $owners[$i+1];
> $Transaction->TicketObj->SetOwner($new_owner);
> $isSet = 1;
> }
> }
>
> if (!($isSet)) {
> $Transaction->TicketObj->SetOwner[int(rand($#owners))];
> }
More information about the rt-users
mailing list