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