Merged in bugfix/PMCORE-2847 (pull request #7843)

PMCORE-2847

Approved-by: Julio Cesar Laura Avendaño
Approved-by: Rodrigo Quelca
This commit is contained in:
Paula Quispe
2021-04-01 14:02:06 +00:00
committed by Julio Cesar Laura Avendaño
10 changed files with 392 additions and 196 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

@@ -158,6 +158,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
*