PMCORE-2799
This commit is contained in:
@@ -165,17 +165,33 @@ class Participated extends AbstractCases
|
||||
case 'IN_PROGRESS':
|
||||
$result = [];
|
||||
$i = 0;
|
||||
if ($item['APP_STATUS'] === 'TO_DO') {
|
||||
$taskPending = Delegation::getPendingThreads($item['APP_NUMBER']);
|
||||
foreach ($taskPending as $thread) {
|
||||
switch ($item['APP_STATUS']) {
|
||||
case 'TO_DO':
|
||||
// Get the pending task
|
||||
$taskPending = Delegation::getPendingThreads($item['APP_NUMBER']);
|
||||
foreach ($taskPending as $thread) {
|
||||
$thread['APP_STATUS'] = $item['APP_STATUS'];
|
||||
// Get the thread information
|
||||
$result[$i] = $this->threadInformation($thread);
|
||||
$i++;
|
||||
}
|
||||
$item['PENDING'] = $result;
|
||||
break;
|
||||
case 'COMPLETED':
|
||||
// Get the last thread
|
||||
$taskPending = Delegation::getLastThread($item['APP_NUMBER']);
|
||||
// Get the head of array
|
||||
$thread = head($taskPending);
|
||||
// Define some values required for define the color status
|
||||
$thread['APP_STATUS'] = $item['APP_STATUS'];
|
||||
$thread['APP_FINISH_DATE'] = $item['APP_FINISH_DATE'];
|
||||
// Get the thread information
|
||||
$result[$i] = $this->threadInformation($thread);
|
||||
$i++;
|
||||
}
|
||||
$item['PENDING'] = $result;
|
||||
} else {
|
||||
$result[$i] = $this->threadInformation($thread);
|
||||
$item['PENDING'] = $result;
|
||||
$item['PENDING'] = $result;
|
||||
break;
|
||||
default: // Other status
|
||||
$result[$i] = $this->threadInformation($thread);
|
||||
$item['PENDING'] = $result;
|
||||
}
|
||||
break;
|
||||
case 'COMPLETED':
|
||||
|
||||
@@ -1821,6 +1821,33 @@ class Delegation extends Model
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the last thread created
|
||||
*
|
||||
* @param int $appNumber
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getLastThread(int $appNumber)
|
||||
{
|
||||
$query = Delegation::query()->select([
|
||||
'TASK.TAS_TITLE',
|
||||
'TASK.TAS_ASSIGN_TYPE',
|
||||
'APP_DELEGATION.USR_ID',
|
||||
'APP_DELEGATION.DEL_TASK_DUE_DATE'
|
||||
]);
|
||||
// Join with task
|
||||
$query->joinTask();
|
||||
// Get the last thread created
|
||||
$query->lastThread();
|
||||
// Related to the specific case number
|
||||
$query->case($appNumber);
|
||||
// Get the results
|
||||
$results = $query->get()->values()->toArray();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the thread title related to the delegation
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user