PMCORE-2721

This commit is contained in:
Paula Quispe
2021-01-27 09:55:52 -04:00
parent b2bd50cf30
commit 466445ba85
2 changed files with 9 additions and 4 deletions

View File

@@ -1098,10 +1098,12 @@ class AbstractCases implements CasesInterface
* *
* @param string $pendingJson * @param string $pendingJson
* @param bool $onlyTask * @param bool $onlyTask
* @param string $statusThread
* @param string $dateToCompare
* *
* @return int * @return int
*/ */
public function prepareTaskPending($pendingJson, $onlyTask = true) public function prepareTaskPending($pendingJson, $onlyTask = true, $statusThread = '', $dateToCompare = '')
{ {
$taskPending = json_decode($pendingJson, true); $taskPending = json_decode($pendingJson, true);
$result = []; $result = [];
@@ -1118,9 +1120,11 @@ class AbstractCases implements CasesInterface
} }
if ($key === 'due_date') { if ($key === 'due_date') {
$threadTasks[$i][$key] = $row; $threadTasks[$i][$key] = $row;
$threadTasks[$i]['delay'] = getDiffBetweenDates($row, date("Y-m-d H:i:s")); // Get the end date for calculate the delay
$endDate = ($dateToCompare !== 'now') ? $endDate = $dateToCompare : date("Y-m-d H:i:s");
$threadTasks[$i]['delay'] = getDiffBetweenDates($row, $endDate);
// Get task color label // Get task color label
$threadTasks[$i]['tas_color'] = (!empty($row)) ? $this->getTaskColor($row) : ''; $threadTasks[$i]['tas_color'] = (!empty($row)) ? $this->getTaskColor($row, $statusThread, $dateToCompare) : '';
$threadTasks[$i]['tas_color_label'] = (!empty($row)) ? self::TASK_COLORS[$threadTasks[$i]['tas_color']] : ''; $threadTasks[$i]['tas_color_label'] = (!empty($row)) ? self::TASK_COLORS[$threadTasks[$i]['tas_color']] : '';
$threadTasks[$i]['tas_status'] = self::TASK_STATUS[$threadTasks[$i]['tas_color']]; $threadTasks[$i]['tas_status'] = self::TASK_STATUS[$threadTasks[$i]['tas_color']];
} }

View File

@@ -181,12 +181,13 @@ class Search extends AbstractCases
// Calculate duration // Calculate duration
$startDate = (string)$item['APP_CREATE_DATE']; $startDate = (string)$item['APP_CREATE_DATE'];
$endDate = !empty($item['APP_FINISH_DATE']) ? $item['APP_FINISH_DATE'] : date("Y-m-d H:i:s"); $endDate = !empty($item['APP_FINISH_DATE']) ? $item['APP_FINISH_DATE'] : date("Y-m-d H:i:s");
$dateToCompare = !empty($item['APP_FINISH_DATE']) ? $item['APP_FINISH_DATE'] : 'now';
$item['DURATION'] = getDiffBetweenDates($startDate, $endDate); $item['DURATION'] = getDiffBetweenDates($startDate, $endDate);
// Get total case notes // Get total case notes
$item['CASE_NOTES_COUNT'] = AppNotes::total($item['APP_NUMBER']); $item['CASE_NOTES_COUNT'] = AppNotes::total($item['APP_NUMBER']);
// Get the detail related to the open thread // Get the detail related to the open thread
if (!empty($item['THREADS'])) { if (!empty($item['THREADS'])) {
$result = $this->prepareTaskPending($item['THREADS'], false); $result = $this->prepareTaskPending($item['THREADS'], false, $item['APP_STATUS'], $dateToCompare);
$item['THREAD_TASKS'] = !empty($result['THREAD_TASKS']) ? $result['THREAD_TASKS'] : []; $item['THREAD_TASKS'] = !empty($result['THREAD_TASKS']) ? $result['THREAD_TASKS'] : [];
$item['THREAD_USERS'] = !empty($result['THREAD_USERS']) ? $result['THREAD_USERS'] : []; $item['THREAD_USERS'] = !empty($result['THREAD_USERS']) ? $result['THREAD_USERS'] : [];
$item['THREAD_TITLES'] = !empty($result['THREAD_TITLES']) ? $result['THREAD_TITLES'] : []; $item['THREAD_TITLES'] = !empty($result['THREAD_TITLES']) ? $result['THREAD_TITLES'] : [];