-
Notifications
You must be signed in to change notification settings - Fork 279
N°8692 - Notification - placeholder attributesubitem #778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: support/3.2
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8985,12 +8985,15 @@ public function GetSubItemAsPlainText($sItemCode, $value) | |
| 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; | ||
| } | ||
|
Comment on lines
+8988
to
+8996
|
||
| } else { | ||
| $sRet = ''; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -347,4 +347,20 @@ public function GivenAttribute(string $sHostClass, string $sAttCode, string $sAt | |||||||||||||||||
| return $oAttribute; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| public function testDisplayStopwatch() | ||||||||||||||||||
| { | ||||||||||||||||||
| $aUserRequestCustomParams = [ | ||||||||||||||||||
|
Comment on lines
+350
to
+352
|
||||||||||||||||||
| '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); | ||||||||||||||||||
|
Comment on lines
+357
to
+360
|
||||||||||||||||||
| $iStartDate = time() - 200; | |
| $oStopwatch = $oUserRequest->Get('ttr'); | |
| $oStopwatch->DefineThreshold(100, $iStartDate); | |
| $iDeadlineTs = time() - 200; | |
| $oStopwatch = $oUserRequest->Get('ttr'); | |
| $oStopwatch->DefineThreshold(100, $iDeadlineTs); |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test doesn't currently exercise the new behavior in GetSubItemAsPlainText() (handling numeric timestamps provided as strings), because Get('ttr_escalation_deadline') returns an int from the in-memory ormStopWatch. To cover the regression, coerce $value to a string (or otherwise simulate the SQL/string code path) before calling GetAsPlainText() and keep the assertion on the formatted output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetSubItemAsPlainText()is now tolerant of numeric-string timestamps fordeadline, butGetSubItemAsHTML()still callsdate(..., $value)without casting/validation, which can still throw aTypeErroron PHP 8 when$valueis a string (common when the subitem value comes from SQL). Consider applying the same numeric-string handling in the HTML branch to keep behavior consistent and prevent runtime errors.