[rt-users] SLA Extension config problems while manipulating due date

Pablo Fernandez pablo.fernandez at cscs.ch
Fri Feb 28 03:36:24 EST 2014


Hi,

On a similar note, I was trying to understand where is this limitation
coming from, and had a dive into the source code, in the hope for an
easy patch. I found out where is the SLA field (re-)set, in the
RT-Extension-SLA/lib/RT/Action/SLA_SetDue.pm file:


sub Commit {
    my $self = shift;

    my $ticket = $self->TicketObj;
    my $txn = $self->TransactionObj;
    my $level = $ticket->FirstCustomFieldValue('SLA');

    my ($last_reply, $is_requestor) = $self->LastEffectiveAct;
    $RT::Logger->debug(
        'Last effective '. ($is_requestor? '':'non-') .'requestors\' reply'
        .' to ticket #'. $ticket->id .' is txn #'. $last_reply->id
    );

    my $response_due = $self->Due(
        Ticket => $ticket,
        Level => $level,
        Type => $is_requestor? 'Response': 'KeepInLoop',
        Time => $last_reply->CreatedObj->Unix,
    );

    my $resolve_due = $self->Due(
        Ticket => $ticket,
        Level => $level,
        Type => 'Resolve',
        Time => $ticket->CreatedObj->Unix,
    );

    my $due;
    $due = $response_due if defined $response_due;
    $due = $resolve_due unless defined $due;
    $due = $resolve_due if defined $due && defined $resolve_due &&
$resolve_due < $due;

    return $self->SetDateField( Due => $due );
}


The Reponse type is nice and dynamic... but the Resolve type is very
static: either the ticket original due date, or nothing.
It would be ideal to make it $ticket->CreatedObj->Unix +
TIME_SPENT_IN_IGNORED_STATES.

Is there a way we can query how much time did a ticket spend in one state?
(this is probably a question for the rt-devel list, I will subscribe if
needed)

Thanks!!
BR/Pablo


On 02/27/2014 10:53 PM, Kevin Falcone wrote:
> On Thu, Feb 27, 2014 at 10:58:48AM +0100, Andrea Zimmerli wrote:
>>    Hi,
>>
>>    I'm using RT 3.8.17 and installed RT::Extension::SLA 0.07, currently testing it.
>>    When I set a ticket status to "Stalled" the due date gets unset, and this is what I want.
>>
>>    However, when I set the ticket status back to "open", the due date is set back
>>    to the original value, it may correspond already to a past date.
>>
>>    Do you know if there is a way to have the due date set automatically
>>    to a time in future, i.e. now+QueuePriority?
>>    Response => { RealMinutes => 60*1 , IgnoreOnStatuses => ['stalled'] },
> Looking at the docs for IgnoreOnStatuses, there's a NOTE that
> addresses what you want.
>
> https://metacpan.org/source/TSIBLEY/RT-Extension-SLA-0.07/README#L240
>
> Unfortunately, the answer is no without further enhancement of the SLA
> extension.
>
> -kevin
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20140228/2658ef09/attachment.htm>


More information about the rt-users mailing list