PMCORE-1884

This commit is contained in:
Paula Quispe
2020-10-02 12:53:58 -04:00
parent 20dfd32e6b
commit 9ebeadd086
8 changed files with 236 additions and 6 deletions

View File

@@ -11,6 +11,17 @@ class Task extends Model
protected $primaryKey = 'TAS_ID';
// We do not have create/update timestamps for this table
public $timestamps = false;
// The following types will execute without user and run automatically
public static $typesRunAutomatically = [
"WEBENTRYEVENT",
"END-MESSAGE-EVENT",
"START-MESSAGE-EVENT",
"INTERMEDIATE-THROW-MESSAGE-EVENT",
"INTERMEDIATE-CATCH-MESSAGE-EVENT",
"SCRIPT-TASK",
"START-TIMER-EVENT",
"INTERMEDIATE-CATCH-TIMER-EVENT"
];
public function process()
{
@@ -67,4 +78,45 @@ class Task extends Model
return $title;
}
/**
* Get task data
*
* @param string $tasUid
*
* @return array
*/
public function load($tasUid)
{
$query = Task::query();
$query->where('TAS_UID', $tasUid);
return $query->get()->toArray();
}
/**
* Get task thread information
*
* @param string $appUid
* @param string $tasUid
* @param string $delIndex
*
* @return array
*/
public function information(string $appUid, string $tasUid, string $delIndex)
{
// Load the the task information
$taskInfo = $this->load($tasUid);
$taskInfo = head($taskInfo);
$taskType = $taskInfo['TAS_TYPE'];
// Load the dates related to the thread
$dates = Delegation::getDatesFromThread($appUid, $delIndex, $tasUid, $taskType);
// Set the dates
$taskInfo['INIT_DATE'] = !empty($dates['DEL_INIT_DATE']) ? $dates['DEL_INIT_DATE'] : G::LoadTranslation('ID_CASE_NOT_YET_STARTED');
$taskInfo['DUE_DATE'] = !empty($dates['DEL_TASK_DUE_DATE']) ? $dates['DEL_TASK_DUE_DATE'] : G::LoadTranslation('ID_NOT_FINISHED');
$taskInfo['FINISH'] = !empty($dates['DEL_FINISH_DATE']) ? $dates['DEL_FINISH_DATE'] : G::LoadTranslation('ID_NOT_FINISHED');
$taskInfo['DURATION'] = !empty($dates['DEL_THREAD_DURATION']) ? $dates['DEL_THREAD_DURATION'] : G::LoadTranslation('ID_NOT_FINISHED');
return $taskInfo;
}
}