[rt-users] Prevent resolution of Ticket that owner is 'Nobody'
Matt Zagrabelny
mzagrabe at d.umn.edu
Thu Jul 16 10:37:50 EDT 2015
Hi,
I didn't read everything in your email. :)
Have you considered a lifecycle where only the Owner is granted the
right to resolve the ticket?
-m
On Thu, Jul 16, 2015 at 9:34 AM, Murillo Azambuja Gonçalves
<murillo at ifi.unicamp.br> wrote:
> Hi all,
>
> I'm using RT 4.2.8 and would like to prevent ticket resolution in which the
> owner is "Nobody".
> For that I'm doing two steps:
>
> Change the custom condition of scrip "On Resolve Notify Requestors" to not
> notify requesters if Owner is 'Nobody':
>
> Description: On Resolve Notify Requestors
> Condition: User Defined
> Action: Notify Requestors
> Template: resolved in HTML
>
> Custom condition:
> if((
> ($self->TransactionObj->Type eq 'Status') or
> ($self->TransactionObj->Type eq 'Set' and
> $self->TransactionObj->Field eq 'Status')
> ) and
> $self->TransactionObj->NewValue eq 'resolved'
> ) {
> if($self->TicketObj->Owner == $RT::Nobody->id) {
> $RT::Logger->debug("Do not notify requestors if Owner is
> Nobody");
> return 0;
> } else {
> return 1;
> }
> }
>
> return 0;
>
> Create scrip to change status from resolved to it's old value:
>
> Description: On Resolve Check Owner
> Condition: On Resolve
> Action: User Defined
> Template: Blank
>
> Custom action commits code:
> # 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;
>
> return 1 unless $self->TicketObj->Owner == $RT::Nobody->id;
>
> my ($status, $msg) =
> $self->TicketObj->SetStatus($self->TransactionObj->OldValue);
> unless($status) {
> $RT::Logger->error("Error when setting new status: $msg");
> return undef;
> }
>
> $RT::Logger->debug("Status changed");
>
> return 1;
>
> (The scrips above are divided just for separation of concerns purposes)
>
> It works, but the message that appears confuses the user: "Status changed
> from 'open' to 'resolved'". But in fact, the status of the ticket is "open"
> (setted in scrip above).
>
> Actually I would like to "lock" the screen, warning the user that it is
> necessary to assign an owner before resolving the ticket.
>
> Someone suggests a better solution? How could I lock the screen and display
> a message to the user?
>
> I tried using the plugin "MandatoryOnTransition" for this purpose, but does
> not work because it just considers empty fields, and the owner is set to
> "Nobody", not empty:
> Set (% MandatoryOnTransition,
> '*' => {
> '* -> Resolved' => ['TimeWorked', 'Owner'],
> },
> );
>
> Please help me.
>
> Thanks in advance.
>
> --
> Murillo Azambuja Gonçalves
More information about the rt-users
mailing list