This commit is contained in:
Henry Jordan
2021-01-28 19:15:14 +00:00
4 changed files with 21 additions and 17 deletions

View File

@@ -577,7 +577,7 @@ class Ajax
$noteContent = addslashes($_POST['NOTE_REASON']);
// Define the Case for register a case note
$cases = new BmCases();
$response = $cases->addNote($appUid, $usrUid, $noteContent);
$response = $cases->addNote($appUid, $usrUid, $noteContent, $_POST['NOTIFY_CANCEL']);
}
} else {
$result->status = false;

View File

@@ -1098,10 +1098,12 @@ class AbstractCases implements CasesInterface
*
* @param string $pendingJson
* @param bool $onlyTask
* @param string $statusThread
* @param string $dateToCompare
*
* @return int
*/
public function prepareTaskPending($pendingJson, $onlyTask = true)
public function prepareTaskPending($pendingJson, $onlyTask = true, $statusThread = '', $dateToCompare = '')
{
$taskPending = json_decode($pendingJson, true);
$result = [];
@@ -1118,9 +1120,11 @@ class AbstractCases implements CasesInterface
}
if ($key === 'due_date') {
$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
$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_status'] = self::TASK_STATUS[$threadTasks[$i]['tas_color']];
}

View File

@@ -181,12 +181,13 @@ class Search extends AbstractCases
// Calculate duration
$startDate = (string)$item['APP_CREATE_DATE'];
$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);
// Get total case notes
$item['CASE_NOTES_COUNT'] = AppNotes::total($item['APP_NUMBER']);
// Get the detail related to the open thread
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_USERS'] = !empty($result['THREAD_USERS']) ? $result['THREAD_USERS'] : [];
$item['THREAD_TITLES'] = !empty($result['THREAD_TITLES']) ? $result['THREAD_TITLES'] : [];