CurrentUser to owner in Create.html

Hello!

We have installed RT 5.0.1 to our 2 separate QA environments. Our RT is heavily modified and now we came across to a problem. In 4.4.4 and also previous RT’s, modification works

Problem is we want to add ticket creator as an owner. It is done in RT4 at /usr/local/lib/rt*/html/Ticket/Create.html by changing Default value:

{ name => ‘Owner’,
comp => ‘/Elements/SelectOwner’,
args => {
Name => “Owner”,
#Default => $ARGS{Owner} || RT->Nobody->Id,
Default => $ARGS{Owner} || $session{CurrentUser}->Id,
DefaultValue => 0,
QueueObj => $QueueObj,
},
},

This also works on RT 5.0.1 BUT. Every time queue is changed on ticket creation page, Owner field is cleared. What makes it strange, if queue is changed second time, Owner (username) comes back.
So every second time it clears username and every second time it comes back.

We tried taking all Scrips out of action and didn’t work. Can anyone help? :slight_smile:

Just a thought: is the DefaultValue causing an issue possibly?

I tried taking DefaultValue off and also changing it to 1. Didn’t work…

OK, how about if you set $ARGS{'Owner'} to $session{CurrentUser}->Id if $ARGS{'Owner'} isn’t already set?

Found solution and it works now :slight_smile: It was on Elements/SelectOwnerAutocomplete file
by changing:
if ( $Default and not $Default =~ /\D/ ) {
my $user = RT::User->new( $session{‘CurrentUser’} );
to:
if ( $Default ) {
my $user = RT::User->new( $session{‘CurrentUser’} );

Isn’t it again too heavy modification for such a thing? :slight_smile: Why don’t you use a simple on-create scrip which sets the owner to the creator value? That could ease the future upgrades :slight_smile: