[rt-users] Prevent resolution of Ticket that owner is 'Nobody'
Murillo Azambuja Gonçalves
murillo at ifi.unicamp.br
Thu Jul 16 16:28:58 EDT 2015
I resolved that issue editing the plugin file "MandatoryOnTransition.pm"
(v. 0.09), by doing it accept the Owner field:
line 206
line 207
...
our @CORE_SUPPORTED = qw(Content TimeWorked TimeTaken *Owner*);
our @CORE_TICKET = qw(TimeWorked *Owner*);
our %CORE_FOR_UPDATE = (
TimeWorked => 'UpdateTimeWorked',
TimeTaken => 'UpdateTimeWorked',
Content => 'UpdateContent',
*Owner => 'Owner',*
);
our %CORE_FOR_CREATE = (
TimeWorked => 'TimeWorked',
Content => 'Content',
*Owner => 'Owner',*
);
...
line 221
...
line 338
...
# Check core fields, after canonicalization for update
for my $field (@$core) {
# Will we have a value on update/create?
my $arg = $args{'Ticket'}
? $CORE_FOR_UPDATE{$field}
: $CORE_FOR_CREATE{$field};
next unless $arg;
next if defined $ARGSRef->{$arg} and length $ARGSRef->{$arg};
*if($field eq 'Owner' and $args{'Ticket'}->$field() == $RT::Nobody->id) {**
** push @errors,**
** $CurrentUser->loc("[_1] is required when changing the
status to [_2]",**
** $field, $ARGSRef->{Status});**
** }*
# Do we have a value currently?
# In Create the ticket hasn't been created yet.
next if grep { $_ eq $field } @CORE_TICKET
and ($args{'Ticket'} && $args{'Ticket'}->$field());
(my $label = $field) =~ s/(?<=[a-z])(?=[A-Z])/ /g; # /
push @errors,
$CurrentUser->loc("[_1] is required when changing the
status to [_2]",
$label, $ARGSRef->{Status});
}
line 365
...
I wanted to do it without changes in the source code, but i couldn't
find a way until this moment.
If anybody has a better idea or knows how to do it without changes in
the code please tell me.
Anyway here's how I solved that.
Regards,
Murillo Azambuja Gonçalves
____________________________________________________
On 07/16/2015 12:05 PM, Murillo Azambuja Gonçalves wrote:
> This can not be done here.
> In some queues those responsible for sending transactions (including
> tickets resolution) are not directly involved in the work of tickets.
>
> Even I used the scrip "AutoSetOwner
> <http://requesttracker.wikia.com/wiki/AutoSetOwner>" as a basis to
> create mine.
>
> Anyway thanks for your answer.
> Would have another suggestion?
> Murillo Azambuja Gonçalves
> ____________________________________________________
> On 07/16/2015 11:37 AM, Matt Zagrabelny wrote:
>> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20150716/b6baeb77/attachment.htm>
More information about the rt-users
mailing list