[rt-users] Sender to Owner
Jesse Vincent
jesse at bestpractical.com
Mon Aug 10 18:20:28 EDT 2009
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090810/dea59b6c/attachment.sig>
More information about the rt-users
mailing list