From 02e6658439735d43bac2a2c6b648d1e7e1092ca2 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Thu, 24 Oct 2013 08:11:40 +0000 Subject: [PATCH] #804 tickets' highlighting is now based on the computation performed by the stopwatch, in order to support non 24x7 working hours SVN:trunk[2952] --- .../datamodel.itop-incident-mgmt-itil.xml | 70 +++++++++--------- .../datamodel.itop-request-mgmt-itil.xml | 73 +++++++++---------- .../datamodel.itop-request-mgmt.xml | 14 ++-- 3 files changed, 75 insertions(+), 82 deletions(-) diff --git a/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml b/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml index bf7b81704..4bd87b9d1 100755 --- a/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml +++ b/datamodels/2.x/itop-incident-mgmt-itil/datamodel.itop-incident-mgmt-itil.xml @@ -1417,42 +1417,40 @@ $sHilightClass = ''; switch($this->GetState()) { - case 'new': - case 'approved': - $iEscalationDeadline = $this->Get('tto_escalation_deadline'); - if ($iEscalationDeadline != null) - { - // A SLA is running - $iStartDate = AttributeDateTime::GetAsUnixSeconds($this->Get('start_date')); - $ratio = ($iEscalationDeadline - time())/($iEscalationDeadline - $iStartDate); - if ($ratio <= 0) - { - $sHilightClass = HILIGHT_CLASS_CRITICAL; - } - else if ($ratio <= 0.25) - { - $sHilightClass = HILIGHT_CLASS_WARNING; - } - } - break; - - case 'assigned': - $iEscalationDeadline = $this->Get('ttr_escalation_deadline'); - if ($iEscalationDeadline != null) - { - // A SLA is running - $iStartDate = AttributeDateTime::GetAsUnixSeconds($this->Get('start_date')); - $ratio = ($iEscalationDeadline - time())/($iEscalationDeadline - $iStartDate); - if ($ratio <= 0) - { - $sHilightClass = HILIGHT_CLASS_CRITICAL; - } - else if ($ratio <= 0.25) - { - $sHilightClass = HILIGHT_CLASS_WARNING; - } - } - break; + case 'new': + case 'approved': + $iEscalationDeadline = $this->Get('tto_escalation_deadline'); + if ($iEscalationDeadline != null) + { + // A SLA is running + $oTTOStopWatch = $this->Get('tto'); + if ($oTTOStopWatch->IsThresholdPassed(100)) + { + $sHilightClass = HILIGHT_CLASS_CRITICAL; + } + else if ($oTTOStopWatch->IsThresholdPassed(75)) + { + $sHilightClass = HILIGHT_CLASS_WARNING; + } + } + break; + + case 'assigned': + $iEscalationDeadline = $this->Get('ttr_escalation_deadline'); + if ($iEscalationDeadline != null) + { + // A SLA is running + $oTTRStopWatch = $this->Get('ttr'); + if ($oTTRStopWatch->IsThresholdPassed(100)) + { + $sHilightClass = HILIGHT_CLASS_CRITICAL; + } + else if ($oTTRStopWatch->IsThresholdPassed(75)) + { + $sHilightClass = HILIGHT_CLASS_WARNING; + } + } + break; case 'escalated_tto': case 'escalated_ttr': diff --git a/datamodels/2.x/itop-request-mgmt-itil/datamodel.itop-request-mgmt-itil.xml b/datamodels/2.x/itop-request-mgmt-itil/datamodel.itop-request-mgmt-itil.xml index 0d8298955..1799bd83b 100755 --- a/datamodels/2.x/itop-request-mgmt-itil/datamodel.itop-request-mgmt-itil.xml +++ b/datamodels/2.x/itop-request-mgmt-itil/datamodel.itop-request-mgmt-itil.xml @@ -1806,44 +1806,41 @@ { $sHilightClass = ''; switch($this->GetState()) - { - case 'new': - case 'approved': - $iEscalationDeadline = $this->Get('tto_escalation_deadline'); - if ($iEscalationDeadline != null) - { - // A SLA is running - $iStartDate = AttributeDateTime::GetAsUnixSeconds($this->Get('start_date')); - $ratio = ($iEscalationDeadline - time())/($iEscalationDeadline - $iStartDate); - if ($ratio <= 0) - { - $sHilightClass = HILIGHT_CLASS_CRITICAL; - } - else if ($ratio <= 0.25) - { - $sHilightClass = HILIGHT_CLASS_WARNING; - } - } - break; - - case 'assigned': - $iEscalationDeadline = $this->Get('ttr_escalation_deadline'); - if ($iEscalationDeadline != null) - { - // A SLA is running - $iStartDate = AttributeDateTime::GetAsUnixSeconds($this->Get('start_date')); - $ratio = ($iEscalationDeadline - time())/($iEscalationDeadline - $iStartDate); - if ($ratio <= 0) - { - $sHilightClass = HILIGHT_CLASS_CRITICAL; - } - else if ($ratio <= 0.25) - { - $sHilightClass = HILIGHT_CLASS_WARNING; - } - } - break; - + { + case 'new': + case 'approved': + $iEscalationDeadline = $this->Get('tto_escalation_deadline'); + if ($iEscalationDeadline != null) + { + // A SLA is running + $oTTOStopWatch = $this->Get('tto'); + if ($oTTOStopWatch->IsThresholdPassed(100)) + { + $sHilightClass = HILIGHT_CLASS_CRITICAL; + } + else if ($oTTOStopWatch->IsThresholdPassed(75)) + { + $sHilightClass = HILIGHT_CLASS_WARNING; + } + } + break; + + case 'assigned': + $iEscalationDeadline = $this->Get('ttr_escalation_deadline'); + if ($iEscalationDeadline != null) + { + // A SLA is running + $oTTRStopWatch = $this->Get('ttr'); + if ($oTTRStopWatch->IsThresholdPassed(100)) + { + $sHilightClass = HILIGHT_CLASS_CRITICAL; + } + else if ($oTTRStopWatch->IsThresholdPassed(75)) + { + $sHilightClass = HILIGHT_CLASS_WARNING; + } + } + break; case 'escalated_tto': case 'escalated_ttr': $sHilightClass = HILIGHT_CLASS_CRITICAL; diff --git a/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml b/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml index cbab1c8c7..2b75b68c0 100755 --- a/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml +++ b/datamodels/2.x/itop-request-mgmt/datamodel.itop-request-mgmt.xml @@ -1799,13 +1799,12 @@ if ($iEscalationDeadline != null) { // A SLA is running - $iStartDate = AttributeDateTime::GetAsUnixSeconds($this->Get('start_date')); - $ratio = ($iEscalationDeadline - time())/($iEscalationDeadline - $iStartDate); - if ($ratio <= 0) + $oTTOStopWatch = $this->Get('tto'); + if ($oTTOStopWatch->IsThresholdPassed(100)) { $sHilightClass = HILIGHT_CLASS_CRITICAL; } - else if ($ratio <= 0.25) + else if ($oTTOStopWatch->IsThresholdPassed(75)) { $sHilightClass = HILIGHT_CLASS_WARNING; } @@ -1817,13 +1816,12 @@ if ($iEscalationDeadline != null) { // A SLA is running - $iStartDate = AttributeDateTime::GetAsUnixSeconds($this->Get('start_date')); - $ratio = ($iEscalationDeadline - time())/($iEscalationDeadline - $iStartDate); - if ($ratio <= 0) + $oTTRStopWatch = $this->Get('ttr'); + if ($oTTRStopWatch->IsThresholdPassed(100)) { $sHilightClass = HILIGHT_CLASS_CRITICAL; } - else if ($ratio <= 0.25) + else if ($oTTRStopWatch->IsThresholdPassed(75)) { $sHilightClass = HILIGHT_CLASS_WARNING; }