On Mon 10.Aug'09 at 12:00:35 -0700, Joel Hartshorn wrote:
> Is there a simple way to make the sender of an emailed ticket the owner upon
> receipt instead of "Nobody"?
>
> Joel Hartshorn
> Internet Engineer/New Media
> The Seattle Times Company
> 206 464 2323
> nwsource.com | seattletimes.com
That assumes that the sender is a privileged user, right?
We use the following code to make the sender of any FOLLOWUP to a ticket
the owner, if it's unowned. I bet changing 'Correspond' to 'Create' would
do what you want.:
Custom condition:
my $txn = $self->TransactionObj;
return 0 unless $txn->Type eq 'Correspond';
my $ticket = $self->TicketObj;
return 0 if $ticket->OwnerObj->id != $RT::Nobody->id;
my $actor = $txn->CreatorObj;
return 0 if $actor->id == $RT::SystemUser->id;
return 0 unless $actor->PrincipalObj->HasRight(
Object => $ticket,
Right => 'OwnTicket',
);
return 1;
Custom prepare:
$self->{'set_owner_to'} = $self->TransactionObj->CreatorObj->id;
return 1;
Custom commit:
my ($status, $msg) = $self->TicketObj->SetOwner( $self->{'set_owner_to'} );
unless ( $status ) {
$RT::Logger->error("Couldn't set owner: $msg");
return 0;
}
return 1;
pgpZ4s4ghvXtE.pgp
Description: PGP signature
_______________________________________________ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: [email protected] Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
