mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
N°8692 - Notification - placeholder attributesubitem
This commit is contained in:
@@ -8985,12 +8985,15 @@ class AttributeStopWatch extends AttributeDefinition
|
||||
switch ($sThresholdCode) {
|
||||
case 'deadline':
|
||||
if ($value) {
|
||||
if (is_int($value)) {
|
||||
if (is_numeric($value)) {
|
||||
if (!is_int($value)) {
|
||||
$value = intval($value);
|
||||
}
|
||||
$sDate = date(AttributeDateTime::GetInternalFormat(), $value);
|
||||
$sRet = AttributeDeadline::FormatDeadline($sDate);
|
||||
} else {
|
||||
$sRet = $value;
|
||||
}
|
||||
} else {
|
||||
$sRet = $value;
|
||||
}
|
||||
} else {
|
||||
$sRet = '';
|
||||
}
|
||||
|
||||
@@ -347,4 +347,20 @@ PHP
|
||||
return $oAttribute;
|
||||
}
|
||||
|
||||
public function testDisplayStopwatch()
|
||||
{
|
||||
$aUserRequestCustomParams = [
|
||||
'title' => "Test DisplayStopwatch",
|
||||
];
|
||||
$oUserRequest = $this->CreateUserRequest(456, $aUserRequestCustomParams);
|
||||
$oAttDef = MetaModel::GetAttributeDef(get_class($oUserRequest), 'ttr_escalation_deadline');
|
||||
$iStartDate = time() - 200;
|
||||
|
||||
$oStopwatch = $oUserRequest->Get('ttr');
|
||||
$oStopwatch->DefineThreshold(100, $iStartDate);
|
||||
$oUserRequest->Set('ttr', $oStopwatch);
|
||||
$value = $oUserRequest->Get('ttr_escalation_deadline');
|
||||
$sRet = $oAttDef->GetAsPlainText($value, $oUserRequest);
|
||||
self::assertEquals('Missed by 3 min', $sRet);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user