[rt-users] round-robin auto assignment?

matthew zeier mrz at intelenet.net
Tue Dec 28 18:36:33 EST 2004


>
> $self->TicketObj->SetOwner

Hey, that was it.  But I guess now I'm missing one other piece of data - 
currentuser?

I promise after I get this resolved, I'll sign up for the one day RT 
developer training session!

[Tue Dec 28 23:30:34 2004] [error]: Scrip 57 Prepare failed: No currentuser 
at /opt/rt3/lib/RT/Base.pm line 123
        RT::Base::loc('RT::System=HASH(0x9d9940c)', 'Queue') called at 
/opt/rt3/lib/RT/Base.pm line 118
        RT::Base::loc('RT::Tickets=HASH(0x9d3cd78)', 'Queue') called at 
/opt/rt3/lib/RT/Tickets_Overlay.pm line 1047
        RT::Tickets::LimitQueue('RT::Tickets=HASH(0x9d3cd78)', 'VALUE', 'ICI 
Internal') called at (eval 2529) line 5
        eval '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 => $self->TicketObj->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];
        $self->TicketObj->SetOwner($new_owner);
        $isSet = 1;
    }
}

if (!($isSet)) {
    my $randOwner = int(rand($#owners));
    $randOwner = $owners[$randOwner];
    $self->TicketObj->SetOwner($randOwner);
}




More information about the rt-users mailing list