N°8692 - Notification - placeholder attributesubitem

This commit is contained in:
Anne-Cath
2025-11-10 16:14:43 +01:00
parent 80d4e65a81
commit 14fdc00d92
2 changed files with 23 additions and 4 deletions

View File

@@ -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 = '';
}

View File

@@ -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);
}
}