SLA Extension config problems while manipulating due date

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?

I paste my current config. Any help/diection is appreciated.

Andy

%RT::ServiceAgreements = (
Default => ‘4h’,
QueueDefault => {
‘a1-rt’ => ‘1h’,
‘a2-rt’ => ‘4h’,
‘z1-rt’ => ‘1d’,
‘z2-rt’ => ‘10d’,
},
Levels => {
‘1h’ => {
Response => { RealMinutes => 601 ,
IgnoreOnStatuses => [‘stalled’] },
Resolve => { RealMinutes => 60
1 , IgnoreOnStatuses
=> [‘stalled’] },
},
‘4h’ => {
Response => { RealMinutes => 601 },
Resolve => { RealMinutes => 60
4 },
},
‘1d’ => {
Response => { RealMinutes => 601 },
Resolve => { RealMinutes => 60
24 },
},
‘10d’ => {
Response => { RealMinutes => 601 },
Resolve => { RealMinutes => 60
240 },
},
},

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

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/PabloOn 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.

README - metacpan.org

Unfortunately, the answer is no without further enhancement of the SLA
extension.

-kevin

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)

That information is in the transaction table, you would have to walk
$Ticket->Transactions looking for Status changes in and out of the ignored states and
calculating. Obviously this could be expensive, so some form of
caching is more common (but this would require either an Attribute or
another Custom Field).

In theory, it sounds like a nice feature, but I worry at the
implementation.

-kevin