mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-19 00:28:47 +02:00
#150 Review TTO/TTR computation (generalized to ResponseTicket)
SVN:trunk[649]
This commit is contained in:
@@ -43,9 +43,9 @@ class Incident extends ResponseTicket
|
||||
MetaModel::Init_InheritAttributes();
|
||||
MetaModel::Init_InheritLifecycle();
|
||||
|
||||
MetaModel::Init_SetZListItems('details', array('ref', 'title', 'org_id', 'description', 'ticket_log', 'start_date', 'escalation_deadline', 'closure_deadline', 'document_list', 'ci_list', 'contact_list', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
MetaModel::Init_SetZListItems('advanced_search', array('ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'escalation_deadline', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
MetaModel::Init_SetZListItems('standard_search', array('ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'escalation_deadline', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
MetaModel::Init_SetZListItems('details', array('ref', 'title', 'org_id', 'description', 'ticket_log', 'start_date', 'tto_escalation_deadline', 'ttr_escalation_deadline', 'document_list', 'ci_list', 'contact_list', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
MetaModel::Init_SetZListItems('advanced_search', array('ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'tto_escalation_deadline', 'ttr_escalation_deadline', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
MetaModel::Init_SetZListItems('standard_search', array('ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'tto_escalation_deadline', 'ttr_escalation_deadline', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
MetaModel::Init_SetZListItems('list', array('ref', 'title', 'org_id', 'start_date', 'status', 'service_id', 'priority', 'workgroup_id', 'agent_id'));
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ class Incident extends ResponseTicket
|
||||
$oMyMenuGroup = new MenuGroup('IncidentManagement', 40 /* fRank */);
|
||||
new TemplateMenuNode('Incident:Overview', '../modules/itop-incident-mgmt-1.0.0/overview.html', $oMyMenuGroup->GetIndex() /* oParent */, 0 /* fRank */);
|
||||
new OQLMenuNode('Incident:MyIncidents', 'SELECT Incident WHERE agent_id = :current_contact_id', $oMyMenuGroup->GetIndex(), 1 /* fRank */);
|
||||
new OQLMenuNode('Incident:EscalatedIncidents', 'SELECT Incident WHERE status IN ("escalation")', $oMyMenuGroup->GetIndex(), 2 /* fRank */);
|
||||
new OQLMenuNode('Incident:OpenIncidents', 'SELECT Incident WHERE status IN ("new", "assigned", "escalation", "resolved")', $oMyMenuGroup->GetIndex(), 3 /* fRank */);
|
||||
new OQLMenuNode('Incident:EscalatedIncidents', 'SELECT Incident WHERE status IN ("escalated_tto", "escalated_ttr")', $oMyMenuGroup->GetIndex(), 2 /* fRank */);
|
||||
new OQLMenuNode('Incident:OpenIncidents', 'SELECT Incident WHERE status IN ("new", "assigned", "escalated_tto", "escalated_ttr", "resolved")', $oMyMenuGroup->GetIndex(), 3 /* fRank */);
|
||||
|
||||
?>
|
||||
|
||||
@@ -45,9 +45,9 @@ class UserRequest extends ResponseTicket
|
||||
|
||||
MetaModel::Init_AddAttribute(new AttributeString("freeze_reason", array("allowed_values"=>null, "sql"=>"freeze_reason", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
|
||||
MetaModel::Init_SetZListItems('details', array('ref', 'title', 'org_id', 'description', 'ticket_log', 'start_date', 'escalation_deadline', 'closure_deadline', 'document_list', 'ci_list', 'contact_list', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment', 'freeze_reason'));
|
||||
MetaModel::Init_SetZListItems('advanced_search', array('ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'escalation_deadline', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
MetaModel::Init_SetZListItems('standard_search', array('ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'escalation_deadline', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
MetaModel::Init_SetZListItems('details', array('ref', 'title', 'org_id', 'description', 'ticket_log', 'start_date', 'tto_escalation_deadline', 'ttr_escalation_deadline', 'document_list', 'ci_list', 'contact_list', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment', 'freeze_reason'));
|
||||
MetaModel::Init_SetZListItems('advanced_search', array('ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'tto_escalation_deadline', 'ttr_escalation_deadline', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
MetaModel::Init_SetZListItems('standard_search', array('ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'tto_escalation_deadline', 'ttr_escalation_deadline', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
MetaModel::Init_SetZListItems('list', array('ref', 'title', 'org_id', 'start_date', 'status', 'service_id', 'priority', 'workgroup_id', 'agent_id'));
|
||||
|
||||
MetaModel::Init_OverloadStateAttribute('frozen', 'freeze_reason', OPT_ATT_MANDATORY);
|
||||
@@ -87,7 +87,7 @@ $oMyMenuGroup = new MenuGroup('RequestManagement', 30 /* fRank */);
|
||||
|
||||
new TemplateMenuNode('UserRequest:Overview', '../modules/itop-request-mgmt-1.0.0/overview.html', $oMyMenuGroup->GetIndex() /* oParent */, 0 /* fRank */);
|
||||
new OQLMenuNode('UserRequest:MyRequests', 'SELECT UserRequest WHERE agent_id = :current_contact_id', $oMyMenuGroup->GetIndex(), 1 /* fRank */);
|
||||
new OQLMenuNode('UserRequest:EscalatedRequests', 'SELECT UserRequest WHERE status IN ("escalation")', $oMyMenuGroup->GetIndex(), 2 /* fRank */);
|
||||
new OQLMenuNode('UserRequest:OpenRequests', 'SELECT UserRequest WHERE status IN ("new", "assigned", "escalation", "frozen", "resolved")', $oMyMenuGroup->GetIndex(), 3 /* fRank */);
|
||||
new OQLMenuNode('UserRequest:EscalatedRequests', 'SELECT UserRequest WHERE status IN ("escalated_tto", "escalated_ttr")', $oMyMenuGroup->GetIndex(), 2 /* fRank */);
|
||||
new OQLMenuNode('UserRequest:OpenRequests', 'SELECT UserRequest WHERE status IN ("new", "assigned", "escalated_tto", "escalated_ttr", "frozen", "resolved")', $oMyMenuGroup->GetIndex(), 3 /* fRank */);
|
||||
|
||||
?>
|
||||
|
||||
@@ -195,8 +195,10 @@ Dict::Add('EN US', 'English', 'English', array(
|
||||
'Class:ResponseTicket/Attribute:last_update+' => '',
|
||||
'Class:ResponseTicket/Attribute:assignment_date' => 'Assigned',
|
||||
'Class:ResponseTicket/Attribute:assignment_date+' => '',
|
||||
'Class:ResponseTicket/Attribute:escalation_deadline' => 'Escalation deadline',
|
||||
'Class:ResponseTicket/Attribute:escalation_deadline+' => '',
|
||||
'Class:ResponseTicket/Attribute:tto_escalation_deadline' => 'TTO Escalation deadline',
|
||||
'Class:ResponseTicket/Attribute:tto_escalation_deadline+' => '',
|
||||
'Class:ResponseTicket/Attribute:ttr_escalation_deadline' => 'TTR Escalation deadline',
|
||||
'Class:ResponseTicket/Attribute:ttr_escalation_deadline+' => '',
|
||||
'Class:ResponseTicket/Attribute:closure_deadline' => 'Closure deadline',
|
||||
'Class:ResponseTicket/Attribute:closure_deadline+' => '',
|
||||
'Class:ResponseTicket/Attribute:resolution_code' => 'Resolution code',
|
||||
|
||||
@@ -201,17 +201,18 @@ abstract class ResponseTicket extends Ticket
|
||||
MetaModel::Init_AddAttribute(new AttributeDateTime("close_date", array("allowed_values"=>null, "sql"=>"close_date", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeDateTime("last_update", array("allowed_values"=>null, "sql"=>"last_update", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeDateTime("assignment_date", array("allowed_values"=>null, "sql"=>"assignment_date", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeDeadline("escalation_deadline", array("allowed_values"=>null, "sql"=>"escalation_deadline", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeDeadline("tto_escalation_deadline", array("allowed_values"=>null, "sql"=>"tto_escalation_deadline", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeDeadline("ttr_escalation_deadline", array("allowed_values"=>null, "sql"=>"ttr_escalation_deadline", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeDeadline("closure_deadline", array("allowed_values"=>null, "sql"=>"closure_deadline", "default_value"=>null, "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeEnum("resolution_code", array("allowed_values"=>new ValueSetEnum('fixed,duplicate,couldnotreproduce,irrelevant'), "sql"=>"resolution_code", "default_value"=>"fixed", "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeText("solution", array("allowed_values"=>null, "sql"=>"solution", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeEnum("user_satisfaction", array("allowed_values"=>new ValueSetEnum('1,2,3,4'), "sql"=>"user_satisfaction", "default_value"=>"1", "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
MetaModel::Init_AddAttribute(new AttributeText("user_commment", array("allowed_values"=>null, "sql"=>"user_commment", "default_value"=>"", "is_null_allowed"=>true, "depends_on"=>array())));
|
||||
|
||||
MetaModel::Init_SetZListItems('details', array('ref', 'title', 'org_id', 'ticket_log', 'start_date', 'escalation_deadline', 'closure_deadline', 'document_list', 'ci_list', 'contact_list', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
MetaModel::Init_SetZListItems('advanced_search', array('finalclass', 'ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'escalation_deadline', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
MetaModel::Init_SetZListItems('standard_search', array('finalclass', 'ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'escalation_deadline', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
MetaModel::Init_SetZListItems('list', array('finalclass', 'ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'escalation_deadline', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
MetaModel::Init_SetZListItems('details', array('ref', 'title', 'org_id', 'ticket_log', 'start_date', 'tto_escalation_deadline', 'ttr_escalation_deadline', 'closure_deadline', 'document_list', 'ci_list', 'contact_list', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
MetaModel::Init_SetZListItems('advanced_search', array('finalclass', 'ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'tto_escalation_deadline', 'ttr_escalation_deadline', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
MetaModel::Init_SetZListItems('standard_search', array('finalclass', 'ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'tto_escalation_deadline', 'ttr_escalation_deadline', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
MetaModel::Init_SetZListItems('list', array('finalclass', 'ref', 'title', 'org_id', 'start_date', 'status', 'caller_id', 'service_id', 'servicesubcategory_id', 'product', 'impact', 'urgency', 'priority', 'workgroup_id', 'agent_id', 'agent_email', 'related_problem_id', 'related_change_id', 'close_date', 'last_update', 'assignment_date', 'tto_escalation_deadline', 'ttr_escalation_deadline', 'closure_deadline', 'resolution_code', 'solution', 'user_satisfaction', 'user_commment'));
|
||||
|
||||
// Lifecycle
|
||||
MetaModel::Init_DefineState(
|
||||
@@ -228,7 +229,8 @@ abstract class ResponseTicket extends Ticket
|
||||
'start_date' => OPT_ATT_READONLY,
|
||||
'last_update' => OPT_ATT_READONLY,
|
||||
'assignment_date' => OPT_ATT_HIDDEN,
|
||||
'escalation_deadline' => OPT_ATT_READONLY,
|
||||
'tto_escalation_deadline' => OPT_ATT_READONLY,
|
||||
'ttr_escalation_deadline' => OPT_ATT_HIDDEN,
|
||||
'closure_deadline' => OPT_ATT_HIDDEN,
|
||||
'close_date' => OPT_ATT_HIDDEN,
|
||||
'org_id' => OPT_ATT_MUSTCHANGE,
|
||||
@@ -269,8 +271,8 @@ abstract class ResponseTicket extends Ticket
|
||||
'agent_id' => OPT_ATT_MUSTPROMPT | OPT_ATT_MANDATORY,
|
||||
'agent_email' => OPT_ATT_READONLY,
|
||||
'workgroup_id' => OPT_ATT_MUSTPROMPT | OPT_ATT_MANDATORY,
|
||||
'closure_deadline' => OPT_ATT_HIDDEN,
|
||||
'escalation_deadline' => OPT_ATT_READONLY,
|
||||
'tto_escalation_deadline' => OPT_ATT_HIDDEN,
|
||||
'ttr_escalation_deadline' => OPT_ATT_READONLY,
|
||||
),
|
||||
)
|
||||
);
|
||||
@@ -279,6 +281,8 @@ abstract class ResponseTicket extends Ticket
|
||||
array(
|
||||
"attribute_inherit" => 'assigned',
|
||||
"attribute_list" => array(
|
||||
'agent_id' => OPT_ATT_MUSTPROMPT | OPT_ATT_MANDATORY,
|
||||
'workgroup_id' => OPT_ATT_MUSTPROMPT | OPT_ATT_MANDATORY,
|
||||
),
|
||||
)
|
||||
);
|
||||
@@ -305,7 +309,7 @@ abstract class ResponseTicket extends Ticket
|
||||
'resolution_code' => OPT_ATT_MUSTPROMPT,
|
||||
'solution' => OPT_ATT_MUSTPROMPT,
|
||||
'closure_deadline' => OPT_ATT_READONLY,
|
||||
'escalation_deadline' => OPT_ATT_HIDDEN,
|
||||
'ttr_escalation_deadline' => OPT_ATT_HIDDEN,
|
||||
),
|
||||
)
|
||||
);
|
||||
@@ -338,10 +342,10 @@ abstract class ResponseTicket extends Ticket
|
||||
|
||||
MetaModel::Init_DefineTransition("assigned", "ev_reassign", array("target_state"=>"assigned", "actions"=>array(), "user_restriction"=>null));
|
||||
MetaModel::Init_DefineTransition("assigned", "ev_timeout", array("target_state"=>"escalated_ttr", "actions"=>array(), "user_restriction"=>null));
|
||||
MetaModel::Init_DefineTransition("assigned", "ev_resolve", array("target_state"=>"resolved", "actions"=>array(), "user_restriction"=>null));
|
||||
MetaModel::Init_DefineTransition("assigned", "ev_resolve", array("target_state"=>"resolved", "actions"=>array('SetClosureDeadline'), "user_restriction"=>null));
|
||||
|
||||
MetaModel::Init_DefineTransition("escalated_ttr", "ev_reassign", array("target_state"=>"escalated_ttr", "actions"=>array(), "user_restriction"=>null));
|
||||
MetaModel::Init_DefineTransition("escalated_ttr", "ev_resolve", array("target_state"=>"resolved", "actions"=>array(), "user_restriction"=>null));
|
||||
MetaModel::Init_DefineTransition("escalated_ttr", "ev_resolve", array("target_state"=>"resolved", "actions"=>array('SetClosureDeadline'), "user_restriction"=>null));
|
||||
|
||||
MetaModel::Init_DefineTransition("resolved", "ev_reassign", array("target_state"=>"assigned", "actions"=>array(), "user_restriction"=>null));
|
||||
MetaModel::Init_DefineTransition("resolved", "ev_close", array("target_state"=>"closed", "actions"=>array('SetClosureDate'), "user_restriction"=>null));
|
||||
@@ -349,6 +353,12 @@ abstract class ResponseTicket extends Ticket
|
||||
|
||||
// Lifecycle actions
|
||||
//
|
||||
public function SetClosureDeadline($sStimulusCode)
|
||||
{
|
||||
$iMaxWaitHours = 24;
|
||||
$this->Set('closure_deadline', time() + $iMaxWaitHours * 3600);
|
||||
return true;
|
||||
}
|
||||
public function SetClosureDate($sStimulusCode)
|
||||
{
|
||||
$this->Set('close_date', time());
|
||||
@@ -459,25 +469,25 @@ abstract class ResponseTicket extends Ticket
|
||||
{
|
||||
//echo "<p>TTO: SLT found: {$aSLT['SLT']}, value: {$aSLT['value']}</p>\n";
|
||||
$iStartDate = AttributeDateTime::GetAsUnixSeconds($this->Get('start_date'));
|
||||
$this->Set('escalation_deadline', $iStartDate + $aSLT['value']);
|
||||
$this->Set('tto_escalation_deadline', $iStartDate + $aSLT['value']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->Set('escalation_deadline', null);
|
||||
$this->Set('tto_escalation_deadline', null);
|
||||
}
|
||||
$aSLT = $this->ComputeSLT('TTR');
|
||||
if ($aSLT != null)
|
||||
{
|
||||
//echo "<p>TTR: SLT found: {$aSLT['SLT']}, value: {$aSLT['value']}</p>\n";
|
||||
$iStartDate = AttributeDateTime::GetAsUnixSeconds($this->Get('start_date'));
|
||||
$this->Set('closure_deadline', $iStartDate + $aSLT['value']);
|
||||
$this->Set('ttr_escalation_deadline', $iStartDate + $aSLT['value']);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->Set('closure_deadline', null);
|
||||
$this->Set('ttr_escalation_deadline', null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determines if the ticket must be hilighted in the list, if we're about to miss a SLA for instance
|
||||
*/
|
||||
@@ -487,7 +497,7 @@ abstract class ResponseTicket extends Ticket
|
||||
switch($this->GetState())
|
||||
{
|
||||
case 'new':
|
||||
$oEscalationDeadline = $this->Get('escalation_deadline');
|
||||
$oEscalationDeadline = $this->Get('tto_escalation_deadline');
|
||||
if ($oEscalationDeadline != null)
|
||||
{
|
||||
// A SLA is running
|
||||
@@ -506,13 +516,13 @@ abstract class ResponseTicket extends Ticket
|
||||
break;
|
||||
|
||||
case 'assigned':
|
||||
$oClosureDeadline = $this->Get('closure_deadline');
|
||||
if ($oClosureDeadline != null)
|
||||
$oEscalationDeadline = $this->Get('ttr_escalation_deadline');
|
||||
if ($oEscalationDeadline != null)
|
||||
{
|
||||
// A SLA is running
|
||||
$iStartDate = AttributeDateTime::GetAsUnixSeconds($this->Get('start_date'));
|
||||
$iClosureDeadline = AttributeDateTime::GetAsUnixSeconds($oClosureDeadline);
|
||||
$ratio = ($iClosureDeadline - time())/($iClosureDeadline - $iStartDate);
|
||||
$iEscalationDeadline = AttributeDateTime::GetAsUnixSeconds($oEscalationDeadline);
|
||||
$ratio = ($iEscalationDeadline - time())/($iEscalationDeadline - $iStartDate);
|
||||
if ($ratio <= 0)
|
||||
{
|
||||
$sHilightClass = HILIGHT_CLASS_CRITICAL;
|
||||
|
||||
@@ -33,24 +33,31 @@ $oMyChange->Set("date", time());
|
||||
$oMyChange->Set("userinfo", "Automatic updates");
|
||||
$iChangeId = $oMyChange->DBInsertNoReload();
|
||||
|
||||
// Bug: only TTO is being handled for the beta version
|
||||
//
|
||||
$oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT Incident WHERE status = \'new\' AND escalation_deadline < NOW()'));
|
||||
$oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT ResponseTicket WHERE status = \'new\' AND tto_escalation_deadline <= NOW()'));
|
||||
while ($oToEscalate = $oSet->Fetch())
|
||||
{
|
||||
$oToEscalate->ApplyStimulus('ev_timeout');
|
||||
$oToEscalate->Set('escalation_deadline', null);
|
||||
//$oToEscalate->Set('tto_escalation_deadline', null);
|
||||
$oToEscalate->DBUpdateTracked($oMyChange);
|
||||
echo "<p>ticket ".$oToEscalate->Get('ref')." reached TTO ESCALATION deadline</p>\n";
|
||||
}
|
||||
|
||||
$oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT Incident WHERE status = \'assigned\' AND closure_deadline < NOW()'));
|
||||
$oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT ResponseTicket WHERE status = \'assigned\' AND ttr_escalation_deadline <= NOW()'));
|
||||
while ($oToEscalate = $oSet->Fetch())
|
||||
{
|
||||
$oToEscalate->ApplyStimulus('ev_timeout');
|
||||
$oToEscalate->Set('closure_deadline', null);
|
||||
//$oToEscalate->Set('ttr_escalation_deadline', null);
|
||||
$oToEscalate->DBUpdateTracked($oMyChange);
|
||||
echo "<p>ticket ".$oToEscalate->Get('ref')." reached TTR ESCALATION deadline</p>\n";
|
||||
}
|
||||
|
||||
$oSet = new DBObjectSet(DBObjectSearch::FromOQL('SELECT ResponseTicket WHERE status = \'resolved\' AND closure_deadline <= NOW()'));
|
||||
while ($oToEscalate = $oSet->Fetch())
|
||||
{
|
||||
$oToEscalate->ApplyStimulus('ev_close');
|
||||
//$oToEscalate->Set('closure_deadline', null);
|
||||
$oToEscalate->DBUpdateTracked($oMyChange);
|
||||
echo "<p>ticket ".$oToEscalate->Get('ref')." reached closure deadline</p>\n";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user