Merged in bugfix/PMCORE-2799 (pull request #7808)
PMCORE-2799 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -165,17 +165,33 @@ class Participated extends AbstractCases
|
|||||||
case 'IN_PROGRESS':
|
case 'IN_PROGRESS':
|
||||||
$result = [];
|
$result = [];
|
||||||
$i = 0;
|
$i = 0;
|
||||||
if ($item['APP_STATUS'] === 'TO_DO') {
|
switch ($item['APP_STATUS']) {
|
||||||
$taskPending = Delegation::getPendingThreads($item['APP_NUMBER']);
|
case 'TO_DO':
|
||||||
foreach ($taskPending as $thread) {
|
// 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_STATUS'] = $item['APP_STATUS'];
|
||||||
|
$thread['APP_FINISH_DATE'] = $item['APP_FINISH_DATE'];
|
||||||
|
// Get the thread information
|
||||||
$result[$i] = $this->threadInformation($thread);
|
$result[$i] = $this->threadInformation($thread);
|
||||||
$i++;
|
$item['PENDING'] = $result;
|
||||||
}
|
break;
|
||||||
$item['PENDING'] = $result;
|
default: // Other status
|
||||||
} else {
|
$result[$i] = $this->threadInformation($thread);
|
||||||
$result[$i] = $this->threadInformation($thread);
|
$item['PENDING'] = $result;
|
||||||
$item['PENDING'] = $result;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'COMPLETED':
|
case 'COMPLETED':
|
||||||
|
|||||||
@@ -1821,6 +1821,33 @@ class Delegation extends Model
|
|||||||
return $results;
|
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
|
* Get the thread title related to the delegation
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user