PMCORE-3943

This commit is contained in:
Paula Quispe
2022-08-24 14:07:12 -04:00
parent fbeffe8357
commit 6d2045b5b8

View File

@@ -39,14 +39,14 @@ if ($RBAC->userCanAccess('PM_CASES') != 1) {
$caseInstance = new Cases(); $caseInstance = new Cases();
//cleaning the case session data // Cleaning the case session data
Cases::clearCaseSessionData(); Cases::clearCaseSessionData();
try { try {
//Loading data for a Jump request // Loading data for a Jump request
if (!isset($_GET['APP_UID']) && isset($_GET['APP_NUMBER'])) { if (!isset($_GET['APP_UID']) && isset($_GET['APP_NUMBER'])) {
$_GET['APP_UID'] = $caseInstance->getApplicationUIDByNumber($_GET['APP_NUMBER']); $_GET['APP_UID'] = $caseInstance->getApplicationUIDByNumber($_GET['APP_NUMBER']);
//Get the index related to the userLogged but this thread can be OPEN or CLOSED // Get the index related to the userLogged but this thread can be OPEN or CLOSED
if (isset($_GET['actionFromList'])) { if (isset($_GET['actionFromList'])) {
if ($_GET['actionFromList'] == 'unassigned') { if ($_GET['actionFromList'] == 'unassigned') {
$_SESSION['APPLICATION'] = $_GET['APP_UID']; $_SESSION['APPLICATION'] = $_GET['APP_UID'];
@@ -58,14 +58,14 @@ try {
$_GET['DEL_INDEX'] = $caseInstance->getCurrentDelegation($_GET['APP_UID'], $_SESSION['USER_LOGGED']); $_GET['DEL_INDEX'] = $caseInstance->getCurrentDelegation($_GET['APP_UID'], $_SESSION['USER_LOGGED']);
} }
//if the application doesn't exist // If the application doesn't exist
if (is_null($_GET['APP_UID'])) { if (is_null($_GET['APP_UID'])) {
G::SendMessageText(G::LoadTranslation('ID_CASE_DOES_NOT_EXISTS'), 'info'); G::SendMessageText(G::LoadTranslation('ID_CASE_DOES_NOT_EXISTS'), 'info');
G::header('location: casesListExtJs'); G::header('location: casesListExtJs');
exit(); exit();
} }
//if the application exists but the // If the application exists but the
if (is_null($_GET['DEL_INDEX'])) { if (is_null($_GET['DEL_INDEX'])) {
G::SendMessageText(G::LoadTranslation('ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER'), 'info'); G::SendMessageText(G::LoadTranslation('ID_CASE_IS_CURRENTLY_WITH_ANOTHER_USER'), 'info');
G::header('location: casesListExtJs'); G::header('location: casesListExtJs');
@@ -77,7 +77,7 @@ try {
$delIndex = $_GET['DEL_INDEX']; $delIndex = $_GET['DEL_INDEX'];
$action = isset($_GET['action']) ? $_GET['action'] : ''; $action = isset($_GET['action']) ? $_GET['action'] : '';
//loading application data // Loading application data
$fieldCase = $caseInstance->loadCase($appUid, $delIndex); $fieldCase = $caseInstance->loadCase($appUid, $delIndex);
if (!Process::isActive($fieldCase['PRO_UID'], 'PRO_UID')) { if (!Process::isActive($fieldCase['PRO_UID'], 'PRO_UID')) {
@@ -105,15 +105,19 @@ try {
switch ($fieldCase['APP_STATUS']) { switch ($fieldCase['APP_STATUS']) {
case 'DRAFT': case 'DRAFT':
case 'TO_DO': case 'TO_DO':
//Check if the case is in pause, check a valid record in table APP_DELAY // Check if the case is in pause, check a valid record in table APP_DELAY
$isPaused = AppDelay::isPaused($appUid, $delIndex); $isPaused = AppDelay::isPaused($appUid, $delIndex);
//Check if the case is a waiting for a SYNCHRONOUS subprocess // Check if the case is a waiting for a SYNCHRONOUS subprocess
$subAppData = new SubApplication(); $subAppData = new SubApplication();
$caseSubprocessPending = $subAppData->isSubProcessWithCasePending($appUid, $delIndex); $caseSubprocessPending = $subAppData->isSubProcessWithCasePending($appUid, $delIndex);
if ($isPaused || $caseSubprocessPending) { if ($isPaused || $caseSubprocessPending) {
//the case is paused show only the resume // Set as read when the pause thread or subprocess was open
if (is_null($fieldCase['DEL_INIT_DATE'])) {
$caseInstance->setDelInitDate($appUid, $delIndex);
}
// The case is paused show only the resume
$_SESSION['APPLICATION'] = $appUid; $_SESSION['APPLICATION'] = $appUid;
$_SESSION['INDEX'] = $delIndex; $_SESSION['INDEX'] = $delIndex;
$_SESSION['PROCESS'] = $fieldCase['PRO_UID']; $_SESSION['PROCESS'] = $fieldCase['PRO_UID'];
@@ -129,11 +133,9 @@ try {
* these routine is to verify if the case was acceded from advanced search list * these routine is to verify if the case was acceded from advanced search list
*/ */
if ($action == 'search') { if ($action == 'search') {
//verify if the case is with the current user // Verify if the case is with the current user
$delegationUsers = AppDelegation::getCurrentUsers($appUid, $delIndex); $delegationUsers = AppDelegation::getCurrentUsers($appUid, $delIndex);
if ($delegationUsers['USR_UID'] !== $_SESSION['USER_LOGGED'] && !empty($delegationUsers['USR_UID'])) { if ($delegationUsers['USR_UID'] !== $_SESSION['USER_LOGGED'] && !empty($delegationUsers['USR_UID'])) {
//distinct "" for selfservice
//so we show just the resume
$_SESSION['alreadyDerivated'] = true; $_SESSION['alreadyDerivated'] = true;
$_SESSION['APPLICATION'] = $appUid; $_SESSION['APPLICATION'] = $appUid;
$_SESSION['INDEX'] = $delIndex; $_SESSION['INDEX'] = $delIndex;
@@ -146,11 +148,11 @@ try {
} }
} }
//Proceed and try to open the case // Proceed and try to open the case
$appDelegation = new AppDelegation(); $appDelegation = new AppDelegation();
$delegationInfo = $appDelegation->load($appUid, $delIndex); $delegationInfo = $appDelegation->load($appUid, $delIndex);
//If there are no user in the delegation row, this case is in selfservice // If there are no user in the delegation row, this case is in selfservice
if (empty($delegationInfo['USR_UID'])) { if (empty($delegationInfo['USR_UID'])) {
$_SESSION['APPLICATION'] = $appUid; $_SESSION['APPLICATION'] = $appUid;
$_SESSION['INDEX'] = $delIndex; $_SESSION['INDEX'] = $delIndex;
@@ -159,7 +161,7 @@ try {
$_SESSION['STEP_POSITION'] = 0; $_SESSION['STEP_POSITION'] = 0;
$_SESSION['CURRENT_TASK'] = $fieldCase['TAS_UID']; $_SESSION['CURRENT_TASK'] = $fieldCase['TAS_UID'];
//If the task is in the valid selfservice tasks for this user, then catch the case, else just view the resume // If the task is in the valid selfservice tasks for this user, then catch the case, else just view the resume
if ($caseInstance->isSelfService($_SESSION['USER_LOGGED'], $fieldCase['TAS_UID'], $appUid)) { if ($caseInstance->isSelfService($_SESSION['USER_LOGGED'], $fieldCase['TAS_UID'], $appUid)) {
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_CatchSelfService.php'); require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_CatchSelfService.php');
} else { } else {
@@ -169,7 +171,7 @@ try {
exit(); exit();
} }
//If the current users is in the AppDelegation row and the thread is open will be open the case // If the current users is in the AppDelegation row and the thread is open will be open the case
if (($delegationInfo['USR_UID'] == $_SESSION['USER_LOGGED'] && $delegationInfo['DEL_THREAD_STATUS'] === 'OPEN') if (($delegationInfo['USR_UID'] == $_SESSION['USER_LOGGED'] && $delegationInfo['DEL_THREAD_STATUS'] === 'OPEN')
&& $action != 'sent' && $action != 'sent'
) { ) {
@@ -207,13 +209,13 @@ try {
$_SESSION['bNoShowSteps'] = 1; $_SESSION['bNoShowSteps'] = 1;
$_SESSION['STEP_POSITION'] = 0; $_SESSION['STEP_POSITION'] = 0;
//When the case have another user or current user doesn't have rights to this self-service, // When the case have another user or current user doesn't have rights to this self-service,
//Just view the case Resume // Just view the case Resume
if ($action === 'search' || $action === 'to_reassign') { if ($action === 'search' || $action === 'to_reassign') {
//We need to use the index sent with the corresponding record // We need to use the index sent with the corresponding record
$_SESSION['INDEX'] = $delIndex; $_SESSION['INDEX'] = $delIndex;
} else { } else {
//Get DEL_INDEX // Get last DEL_INDEX
$criteria = new Criteria('workflow'); $criteria = new Criteria('workflow');
$criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX);
$criteria->add(AppDelegationPeer::APP_UID, $appUid); $criteria->add(AppDelegationPeer::APP_UID, $appUid);
@@ -231,7 +233,7 @@ try {
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php'); require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
} }
break; break;
default: //APP_STATUS IS COMPLETED OR CANCELLED default: // APP_STATUS in (COMPLETED, CANCELLED)
$_SESSION['APPLICATION'] = $appUid; $_SESSION['APPLICATION'] = $appUid;
$_SESSION['INDEX'] = $caseInstance->getCurrentDelegationCase($_GET['APP_UID']); $_SESSION['INDEX'] = $caseInstance->getCurrentDelegationCase($_GET['APP_UID']);
$_SESSION['PROCESS'] = $fieldCase['PRO_UID']; $_SESSION['PROCESS'] = $fieldCase['PRO_UID'];