Hide owner fields for privileged users


#1

Hi,

I want to know if there is any way I can hide the owner field on ticket creation for privileged users.

Thanks


#2

Hi Iacob

you could modify the html in /opt/rt4/local/html/Ticket/Create.html to be something like this:
<input type=“hidden” class=“hidden” name=“Owner” value="<% RT->Nobody->Id %>" />

regards
Garry


#3

Hi Booth,

I can’t find Create.html in /opt/rt4/local/html/Ticket . I found Create.html in /opt/rt4/share/html/Ticket but, I do not found that input tag <input type=“hidden” class=“hidden” name=“Owner” value="<% RT->Nobody->Id %>" /> . I thought about this solution, but I was thinking there might be other solutions.


#4

Hi Berar

You need to copy the Create.html from share to local and then modify whatever you’ve got for the owner input field, to be hidden

regards
Garry


#5

It looks like you should be able to use a callback in opt/rt4/share/html/Ticket/Elements/EditBasics called “MassageFields” to remove the owner field.

You would create a file:

/opt/rt4/local/Callbacks/MyCallbacks/Ticket/Elements/EditBasics/MassageFields

With the following content:

<%init>
return unless $Fields and $m->request_path =~ /\/Ticket\/Update\.html/;

my @new_field_args;
foreach my $field_args (@{$Fields}) {
    if ( $field_args->{name} ne 'Owner' ) {
        push @new_field_args, $field_args;
    }
}
@{$Fields} = @new_field_args;
</%init>

<%args>
$Fields   => undef;
</%args>

I haven’t tested this code much but it looks like it should be a good start for you.

Regards,
Craig


#6

Thanks for the help !
The solution for me was the following:

copy the Create.html from the /opt/rt4/share/html/Ticket/Create.html to /opt/rt4/local/html/Ticket/Create.html and then I make a copy of the file SelectOwner -> SelectOwner2 from /opt/rt4/share/html/Elements/SelectOwner that was render in the html to display the Owners, and comment out all of the lines from the SelectOwner2 file, and I change the path of the file in Create.html to the new SelectOwner2 file.