Merged in bugfix/PMCORE-2799 (pull request #7786)
PMCORE-2799 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -1065,12 +1065,13 @@ class AbstractCases implements CasesInterface
|
||||
*
|
||||
* @param string $dueDate
|
||||
* @param string $statusThread
|
||||
* @param string $dateToCompare
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTaskColor(string $dueDate, string $statusThread = '')
|
||||
public function getTaskColor(string $dueDate, string $statusThread = '', $dateToCompare = 'now')
|
||||
{
|
||||
$currentDate = new DateTime('now');
|
||||
$currentDate = new DateTime($dateToCompare);
|
||||
$dueDate = new DateTime($dueDate);
|
||||
if ($currentDate > $dueDate) {
|
||||
// Overdue: When the current date is mayor to the due date of the case
|
||||
@@ -1170,6 +1171,8 @@ class AbstractCases implements CasesInterface
|
||||
{
|
||||
$result = [];
|
||||
$status = '';
|
||||
$finishDate = 'now';
|
||||
$dateToCompare = date("Y-m-d H:i:s");
|
||||
// Define the task status
|
||||
if ($thread['TAS_ASSIGN_TYPE'] === 'SELF_SERVICE') {
|
||||
$status = 'UNASSIGNED';
|
||||
@@ -1177,12 +1180,16 @@ class AbstractCases implements CasesInterface
|
||||
if ($thread['APP_STATUS'] === 'DRAFT') {
|
||||
$status = 'DRAFT';
|
||||
}
|
||||
if ($thread['APP_STATUS'] === 'COMPLETED') {
|
||||
$finishDate = $thread['APP_FINISH_DATE'];
|
||||
$dateToCompare = $finishDate;
|
||||
}
|
||||
// Define the thread information
|
||||
$result['tas_title'] = $thread['TAS_TITLE'];
|
||||
$result['user_id'] = $thread['USR_ID'];
|
||||
$result['due_date'] = $thread['DEL_TASK_DUE_DATE'];
|
||||
$result['delay'] = getDiffBetweenDates($thread['DEL_TASK_DUE_DATE'], date("Y-m-d H:i:s"));
|
||||
$result['tas_color'] = (!empty($thread['DEL_TASK_DUE_DATE'])) ? $this->getTaskColor($thread['DEL_TASK_DUE_DATE'], $status) : '';
|
||||
$result['delay'] = getDiffBetweenDates($thread['DEL_TASK_DUE_DATE'], $dateToCompare);
|
||||
$result['tas_color'] = (!empty($thread['DEL_TASK_DUE_DATE'])) ? $this->getTaskColor($thread['DEL_TASK_DUE_DATE'], $status, $finishDate) : '';
|
||||
$result['tas_color_label'] = (!empty($result['tas_color'])) ? self::TASK_COLORS[$result['tas_color']] : '';
|
||||
$result['tas_status'] = self::TASK_STATUS[$result['tas_color']];
|
||||
$result['unassigned'] = ($status === 'UNASSIGNED' ? true : false);
|
||||
|
||||
@@ -156,6 +156,7 @@ class Participated extends AbstractCases
|
||||
$thread['TAS_TITLE'] = $item['TAS_TITLE'];
|
||||
$thread['USR_ID'] = $item['USR_ID'];
|
||||
$thread['DEL_TASK_DUE_DATE'] = $item['DEL_TASK_DUE_DATE'];
|
||||
$thread['APP_FINISH_DATE'] = $item['APP_FINISH_DATE'];
|
||||
$thread['TAS_ASSIGN_TYPE'] = $item['TAS_ASSIGN_TYPE'];
|
||||
$thread['APP_STATUS'] = $item['APP_STATUS'];
|
||||
// Define data according to the filters
|
||||
|
||||
Reference in New Issue
Block a user