mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-02 06:58:49 +02:00
code cleanup
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// Copyright (C) 2010-2017 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -85,8 +85,12 @@ class ormStopWatch
|
||||
/**
|
||||
* Get the working elapsed time since the start of the stop watch
|
||||
* even if it is currently running
|
||||
* @param oAttDef AttributeDefinition Attribute hosting the stop watch
|
||||
* @param oObject Hosting object (used for query parameters)
|
||||
*
|
||||
* @param AttributeDefinition oAttDef Attribute hosting the stop watch
|
||||
* @param Object oObject Hosting object (used for query parameters)
|
||||
*
|
||||
* @return int|mixed
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function GetElapsedTime($oAttDef, $oObject)
|
||||
{
|
||||
@@ -260,6 +264,16 @@ class ormStopWatch
|
||||
return $iRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $oObject
|
||||
* @param $oAttDef
|
||||
* @param $iPercent
|
||||
* @param $iStartTime
|
||||
* @param $iDurationSec
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \CoreException
|
||||
*/
|
||||
protected function ComputeDeadline($oObject, $oAttDef, $iPercent, $iStartTime, $iDurationSec)
|
||||
{
|
||||
$sWorkingTimeComputer = $oAttDef->Get('working_time_computing');
|
||||
@@ -267,11 +281,6 @@ class ormStopWatch
|
||||
{
|
||||
$sWorkingTimeComputer = class_exists('SLAComputation') ? 'SLAComputation' : 'DefaultWorkingTimeComputer';
|
||||
}
|
||||
$aCallSpec = array($sWorkingTimeComputer, '__construct');
|
||||
if (!is_callable($aCallSpec))
|
||||
{
|
||||
//throw new CoreException("Pas de constructeur pour $sWorkingTimeComputer!");
|
||||
}
|
||||
$oComputer = new $sWorkingTimeComputer();
|
||||
$aCallSpec = array($oComputer, 'GetDeadline');
|
||||
if (!is_callable($aCallSpec))
|
||||
@@ -285,6 +294,15 @@ class ormStopWatch
|
||||
return $iRet;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $oObject
|
||||
* @param $oAttDef
|
||||
* @param $iStartTime
|
||||
* @param $iEndTime
|
||||
*
|
||||
* @return mixed
|
||||
* @throws \CoreException
|
||||
*/
|
||||
protected function ComputeDuration($oObject, $oAttDef, $iStartTime, $iEndTime)
|
||||
{
|
||||
$sWorkingTimeComputer = $oAttDef->Get('working_time_computing');
|
||||
@@ -398,7 +416,7 @@ class ormStopWatch
|
||||
$aThresholdData['triggered'] = false;
|
||||
$aThresholdData['overrun'] = null;
|
||||
}
|
||||
else
|
||||
// else
|
||||
{
|
||||
// The new threshold is in the past
|
||||
// Note: the overrun can be wrong, but the correct algorithm to compute
|
||||
@@ -558,7 +576,7 @@ class CheckStopWatchThresholds implements iBackgroundProcess
|
||||
CMDBObject::SetTrackInfo("Automatic - threshold triggered");
|
||||
|
||||
$oMyChange = CMDBObject::GetCurrentChange();
|
||||
$oObj->DBUpdateTracked($oMyChange, true /*skip security*/);
|
||||
$oObj->DBUpdateTracked($oMyChange);
|
||||
}
|
||||
|
||||
// Activate any existing trigger
|
||||
|
||||
Reference in New Issue
Block a user