[rt-users] assigning a ticket to a user

Robert Long rlong at bluegecko.net
Thu Apr 26 18:59:41 EDT 2007


here is the test to see if there isn't an owner and if the current actor
is an adminCC.

# if the owner isn't Nobody don't worry about it.
return 0 unless ($self->TicketObj->OwnerObj->Name eq "Nobody");

# load the current user as a principal
my $actor = RT::Principal->new(  $RT::SystemUser );
$actor->Load( $self->TransactionObj->CreatorObj->Id );

# perldoc Ticket_Overlay.pm
return 1 if IsWatcher { Type => 'AdminCC', PrincipalId => $actor };
return 0;



For setting the current actor as the owner, I'll leave that up to you. 
( perldoc Ticket.pm, look for 'SetOwner' - there are examples on the wiki)

.r'





Ramon Loureiro wrote:
> Thank you!
> But, as I understand, this makes the requestor=creator to be the owner, do
> it?
> I´d like the first watcher who answers the email to be the owner...
>
> thanks for answering!!!
>
>   
>> Try
>>
>> -----------------------
>> my $Ticket = $self->TicketObj;
>> my $Transaction = $self->TransactionObj;
>> my $CreatorId = $Transaction->CreatorObj->Id;
>> my $Queue = $Ticket->QueueObj;
>> my $val = $Transaction->Type eq 'Correspond' &&
>> $Queue->IsAdminCc($CreatorId);
>> $Ticket->SetOwner($CreatorId) if $val;
>> return 1;
>> ----------------------
>>
>> At 02:17 PM 4/26/2007, Ramon Loureiro wrote:
>>     
>>> Hi,
>>> I`d like to solve this situation:
>>>
>>> A Requestor send an email to one queue.
>>> Two watchers receive the corresponding email.
>>>
>>> When one of the watchers answers the email I'd like him to be the owner
>>> of
>>> the ticket if he is an AdminCC
>>>
>>> what is the AdminCC id?
>>> $self->TicketObj->QueueObj->AdminCc->id  ?????
>>>
>>> -------------------------------------------------------------
>>> my $Value = $self->TicketObj->QueueObj->AdminCc->id ;
>>> $self->TicketObj->_Set(Field => 'Owner', Value => $Value);
>>> return 1;
>>> -------------------------------------------------------------
>>>
>>> thank you!
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>>>
>>> Community help: http://wiki.bestpractical.com
>>> Commercial support: sales at bestpractical.com
>>>
>>>
>>> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
>>> Buy a copy at http://rtbook.bestpractical.com
>>>       
>> --
>> Gene LeDuc, GSEC
>> Security Analyst
>> San Diego State University
>>
>>
>>     
>
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
> Buy a copy at http://rtbook.bestpractical.com
>   




More information about the rt-users mailing list