Sorry for all the messages today.

My boss just pointed out something odd: our script to make a ticket
requestor into the owner works fine, in that viewing the ticket shows the
owner. However, a search that turns up multiple tickets will have many
owners listed as "nobody in particular". Clicking such a ticket reveals an
owner, though. Why would the search sometimes refuse to show the owner,
while the ticket page lists one? I haven't modified the results page at
all, and while I did modify the ticket display some, I never touched the
part that shows the owner. Here's the script (I didn't write it, I borrowed
it):


# get actor ID
my $Actor = $self->TransactionObj->Creator;
#if actor is RT_SystemUser then get out of here
return 1 if $Actor == $RT::SystemUser->id;
#prevents a ticket being assigned to an unprivileged user, comment out if
you want this
return 1 unless $self->TransactionObj->CreatorObj->Privileged;
#get out unless ticket owner is nobody
return 1 unless $self->TicketObj->Owner == $RT::Nobody->id;
#try to change owner
$RT::Logger->info("Auto assign ticket #". $self->TicketObj->id ." to user
#". $Actor );
my ($status, $msg) = $self->TicketObj->_Set(Field => 'Owner', Value =>
$Actor, RecordTransaction => 0);
unless( $status ) {
    $RT::Logger->error( "Impossible to assign the ticket to $Actor: $msg" );
    return undef;
}

return 1;

-- 
Alex Hall
Automatic Distributors, IT department
ah...@autodist.com
---------
RT 4.4 and RTIR training sessions, and a new workshop day! 
https://bestpractical.com/training
* Los Angeles - January 9-11 2017

Reply via email to