Merged in bugfix/PMCORE-1254 (pull request #7307)

PMCORE-1254

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Paula Quispe
2020-04-08 18:14:08 +00:00
committed by Julio Cesar Laura Avendaño

View File

@@ -186,14 +186,14 @@ class Ajax
$c->add(AppThreadPeer::APP_THREAD_STATUS, 'OPEN');
$cant = AppThreadPeer::doCount($c);
$oCase = new Cases();
$aFields = $oCase->loadCase($appUid, $index);
$case = new Cases();
$fields = $case->loadCase($appUid, $index);
global $RBAC;
$options = [];
switch ($aFields['APP_STATUS']) {
switch ($fields['APP_STATUS']) {
case 'DRAFT':
if (!AppDelay::isPaused($appUid, $index)) {
$options[] = ['text' => G::LoadTranslation('ID_PAUSED_CASE'), 'fn' => 'setUnpauseCaseDate'];
@@ -203,6 +203,11 @@ class Ajax
// Check if the user has the permission for the action Delete Case
if ($RBAC->userCanAccess('PM_DELETECASE') == 1) {
$options[] = ['text' => G::LoadTranslation('ID_DELETE'), 'fn' => 'deleteCase'];
} else {
// Check if the user is the owner
if ($fields['APP_INIT_USER'] === $RBAC->aUserInfo['USER_INFO']['USR_UID']) {
$options[] = ['text' => G::LoadTranslation('ID_DELETE'), 'fn' => 'deleteCase'];
}
}
// Check if the user has the permission for the action Reassign Case
if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1 || $RBAC->userCanAccess('PM_REASSIGNCASE_SUPERVISOR') == 1) {
@@ -250,7 +255,7 @@ class Ajax
}
if ($_SESSION["TASK"] != "" && $_SESSION["TASK"] != "-1") {
$oTask = new Task();
$task = new Task();
$tasksInParallel = explode('|', $_SESSION['TASK']);
$tasksInParallel = array_filter($tasksInParallel, function ($value) {
return !empty($value);
@@ -258,12 +263,12 @@ class Ajax
$nTasksInParallel = count($tasksInParallel);
if ($nTasksInParallel > 1) {
$aTask = $oTask->load($tasksInParallel[$nTasksInParallel - 1]);
$taskProperties = $task->load($tasksInParallel[$nTasksInParallel - 1]);
} else {
$aTask = $oTask->load($_SESSION['TASK']);
$taskProperties = $task->load($_SESSION['TASK']);
}
if ($aTask['TAS_TYPE'] == 'ADHOC') {
if ($taskProperties['TAS_TYPE'] == 'ADHOC') {
$options[] = ['text' => G::LoadTranslation('ID_ADHOC_ASSIGNMENT'), 'fn' => 'adhocAssignmentUsers'];
}
}