PMCORE-2847

PMCORE-2907
This commit is contained in:
Paula Quispe
2021-03-19 15:15:16 -04:00
parent 290e2a17f5
commit 1977c923fe
10 changed files with 378 additions and 181 deletions

View File

@@ -1807,6 +1807,9 @@ class Delegation extends Model
'TASK.TAS_TITLE',
'TASK.TAS_ASSIGN_TYPE',
'APP_DELEGATION.USR_ID',
'APP_DELEGATION.DEL_DELEGATE_DATE',
'APP_DELEGATION.DEL_FINISH_DATE',
'APP_DELEGATION.DEL_INIT_DATE',
'APP_DELEGATION.DEL_TASK_DUE_DATE'
]);
// Join with task
@@ -1867,9 +1870,12 @@ class Delegation extends Model
$caseData = $r;
}
}
// Get task title defined
//
$task = new Task();
// Get case title defined
$taskTitle = $task->taskCaseTitle($tasUid);
// Get case description defined
$taskDescription = $task->taskCaseDescription($tasUid);
// If exist we will to replace the variables data
if (!empty($taskTitle)) {
$threadTitle = G::replaceDataField($taskTitle, $caseData, 'mysql', false);
@@ -1886,8 +1892,16 @@ class Delegation extends Model
$threadTitle = '# '. $appNumber;
}
}
// If exist we will to replace the variables data
$threadDescription = '';
if (!empty($taskDescription)) {
$threadDescription = G::replaceDataField($taskDescription, $caseData, 'mysql', false);
}
return $threadTitle;
return [
'title' => $threadTitle,
'description' => $threadDescription,
];
}
/**

View File

@@ -142,6 +142,27 @@ class Task extends Model
return $title;
}
/**
* Get the description of the task
*
* @param string $tasUid
*
* @return string
*/
public function taskCaseDescription(string $tasUid)
{
$query = Task::query()->select(['TAS_DEF_DESCRIPTION']);
$query->where('TAS_UID', $tasUid);
$query->limit(1);
$results = $query->get();
$title = '';
$results->each(function ($item) use (&$title) {
$title = $item->TAS_DEF_DESCRIPTION;
});
return $title;
}
/**
* Get task data
*