[rt-users] Scrip errors

Ruslan U. Zakirov Ruslan.Zakirov at miet.ru
Fri May 6 03:07:10 EDT 2005


Please, allways Cc to the list.

Andrew Xenides wrote:
> Ok, nothing in the logs. Basically what I want for the ticket to be taken by
> anyone that does something to a ticket that is currently owned by nobody. I
> have put this script under global.
> 
> This is my conditions
> 
> On Transaction User Defined with template Blank 
> 
> This is my Custom action preparation code:
> my $ticket = $self->TicketObj;
> if ($ticket->Owner ne "Nobody") {
Owner method returns user's ID!
You should use:
return unless $ticket->Owner == $RT::Nobody->Id;

>     return undef;
> }
> my $trans = $self->TransactionObj;
> if (!$trans->CurrentUserHasRight("TakeTicket")) {
this can be
return unless $ticket->CurrentUserHasRight("TakeTicket");

>     return undef;
> }
> $self->{'newowner'} = $trans->Creator;
I don't remeber could you save this or not.
IMHO you don't get any advantages from saving and can avoid it to be 
[backward|forward]compatible.

> return 1;
> 
> This is the Custom action cleanup code:
> $self->TicketObj->SetOwner($self->{'newowner'});
my $ticket = $self->TicketObj;
my ($status, $msg) = $ticket->SetOwner( $self->Transaction->Creator );
unless( $status ) {
	$RT::Logger->error( "Couldn't set owner: $msg" );
	return 0;
}
return 1;

> return 1;
> 
> This is the log when a reply is made to a job
> 
[snip]

--
Regards, Ruslan.



More information about the rt-users mailing list