fix issue when app_delegation does not have due date
This commit is contained in:
@@ -1170,8 +1170,11 @@ class AbstractCases implements CasesInterface
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTaskColor(string $dueDate, string $statusThread = '', $dateToCompare = 'now')
|
||||
public function getTaskColor(?string $dueDate, string $statusThread = '', $dateToCompare = 'now')
|
||||
{
|
||||
if (empty($dueDate)) {
|
||||
return self::COLOR_DRAFT;
|
||||
}
|
||||
$currentDate = new DateTime($dateToCompare);
|
||||
$dueDate = new DateTime($dueDate);
|
||||
if ($currentDate > $dueDate) {
|
||||
@@ -1305,7 +1308,7 @@ class AbstractCases implements CasesInterface
|
||||
$threadTask['delay'] = getDiffBetweenDates($thread['DEL_TASK_DUE_DATE'], $dateToCompare);
|
||||
$threadTask['tas_color'] = (!empty($thread['DEL_TASK_DUE_DATE'])) ? $this->getTaskColor($thread['DEL_TASK_DUE_DATE'], $status, $finishDate) : '';
|
||||
$threadTask['tas_color_label'] = (!empty($threadTask['tas_color'])) ? self::TASK_COLORS[$threadTask['tas_color']] : '';
|
||||
$threadTask['tas_status'] = self::TASK_STATUS[$threadTask['tas_color']];
|
||||
$threadTask['tas_status'] = (!empty($threadTask['tas_color'])) ? self::TASK_STATUS[$threadTask['tas_color']] : '';
|
||||
$threadTask['unassigned'] = ($status === 'UNASSIGNED' ? true : false);
|
||||
$userInfo = User::getInformation($thread['USR_ID']);
|
||||
$threadTask['user_tooltip'] = $userInfo;
|
||||
|
||||
@@ -642,18 +642,24 @@ function applyMaskDateEnvironment($date, $mask = '', $caseListSetting = true)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getDiffBetweenDates(string $startDate, string $endDate)
|
||||
function getDiffBetweenDates(?string $startDate, ?string $endDate)
|
||||
{
|
||||
$result = '';
|
||||
if (!empty($startDate) && !empty($endDate)) {
|
||||
$initDate = new DateTime($startDate);
|
||||
$finishDate = new DateTime($endDate);
|
||||
$diff = $initDate->diff($finishDate);
|
||||
$format = ' %a ' . G::LoadTranslation('ID_DAY_DAYS');
|
||||
$format .= ' %H ' . G::LoadTranslation('ID_HOUR_ABBREVIATE');
|
||||
$format .= ' %I ' . G::LoadTranslation('ID_MINUTE_ABBREVIATE');
|
||||
$format .= ' %S ' . G::LoadTranslation('ID_SECOND_ABBREVIATE');
|
||||
$result = $diff->format($format);
|
||||
try {
|
||||
// Check if startDate and endDate are not empty
|
||||
if (!empty($startDate) && !empty($endDate)) {
|
||||
$initDate = new DateTime($startDate);
|
||||
$finishDate = new DateTime($endDate);
|
||||
$diff = $initDate->diff($finishDate);
|
||||
$format = ' %a ' . G::LoadTranslation('ID_DAY_DAYS');
|
||||
$format .= ' %H ' . G::LoadTranslation('ID_HOUR_ABBREVIATE');
|
||||
$format .= ' %I ' . G::LoadTranslation('ID_MINUTE_ABBREVIATE');
|
||||
$format .= ' %S ' . G::LoadTranslation('ID_SECOND_ABBREVIATE');
|
||||
$result = $diff->format($format);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// Handle exception if the date format is invalid
|
||||
$result = $e->getMessage();
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
Reference in New Issue
Block a user