From 235e410726340fe157f864bb3e4e24fea1859226 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Tue, 10 Jul 2012 12:51:02 -0400 Subject: [PATCH 1/3] BUG 9370 "NewCaseImpersonate function not working when start..." SOLVED - PMFNewCaseImpersonate function not working when start task of process to instance is assigned to group and not to user - Solved problem with PMFNewCaseImpersonate function, in class wsBase (newCaseImpersonate) now working with groups --- workflow/engine/classes/class.wsBase.php | 38 ++++++++++++++---------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/workflow/engine/classes/class.wsBase.php b/workflow/engine/classes/class.wsBase.php index 96fbcbe2b..89dda438b 100755 --- a/workflow/engine/classes/class.wsBase.php +++ b/workflow/engine/classes/class.wsBase.php @@ -1473,7 +1473,7 @@ class wsBase $oCase = new Cases(); $oTask = new Tasks(); $startingTasks = $oCase->getStartCases($userId); - array_shift ($startingTasks); //remove the first row, the header row + array_shift($startingTasks); //remove the first row, the header row $founded = ''; $tasksInThisProcess = 0; $validTaskId = $taskId; @@ -1578,29 +1578,38 @@ class wsBase $oCase = new Cases(); - $tasks = $oProcesses->getStartingTaskForUser($processId, $userId); - $numTasks = count($tasks); + $arrayTask = $oProcesses->getStartingTaskForUser($processId, $userId); + $numTasks = count($arrayTask); if ($numTasks == 1) { - $oTask = new Tasks(); - $very = $oTask->verifyUsertoTask($userId, $tasks[0]['TAS_UID']); + $task = new Tasks(); + $group = new Groups(); - if (is_array($very)) { - if ($very['TU_RELATION'] == 2) { - $group = $groups->getUsersOfGroup($tasks[0]['TAS_UID']); + $arrayTaskUser = array(); - if (!is_array($group)) { - $result = new wsResponse(14, G::loadTranslation('ID_USER_NOT_ASSIGNED_TASK')); + $arrayAux = $task->getGroupsOfTask($arrayTask[0]['TAS_UID'], 1); - return $result; - } + foreach ($arrayAux as $arrayGroup) { + $arrayGroupUser = $group->getUsersOfGroup($arrayGroup['GRP_UID']); + + foreach ($arrayGroupUser as $arrayUser) { + $arrayTaskUser[] = $arrayUser['USR_UID']; } - } else { + } + + $arrayAux = $task->getUsersOfTask($arrayTask[0]['TAS_UID'], 1); + + foreach ($arrayAux as $arrayUser) { + $arrayTaskUser[] = $arrayUser['USR_UID']; + } + + if (!in_array($userId, $arrayTaskUser)) { $result = new wsResponse(14, G::loadTranslation('ID_USER_NOT_ASSIGNED_TASK')); + return $result; } - $case = $oCase->startCase($tasks[0]['TAS_UID'], $userId); + $case = $oCase->startCase($arrayTask[0]['TAS_UID'], $userId); $caseId = $case['APPLICATION']; $caseNumber = $case['CASE_NUMBER']; @@ -2535,4 +2544,3 @@ class wsBase } } } - From f68bd1ccb97a4aa554a952d9d41941b303aa15ce Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Tue, 10 Jul 2012 15:49:45 -0400 Subject: [PATCH 2/3] BUG 9370 "NewCaseImpersonate function not working when start..." SOLVED - Delete validation "user assigned to task" --- workflow/engine/classes/class.wsBase.php | 27 ------------------------ 1 file changed, 27 deletions(-) diff --git a/workflow/engine/classes/class.wsBase.php b/workflow/engine/classes/class.wsBase.php index 89dda438b..36ca6ee9a 100755 --- a/workflow/engine/classes/class.wsBase.php +++ b/workflow/engine/classes/class.wsBase.php @@ -1582,33 +1582,6 @@ class wsBase $numTasks = count($arrayTask); if ($numTasks == 1) { - $task = new Tasks(); - $group = new Groups(); - - $arrayTaskUser = array(); - - $arrayAux = $task->getGroupsOfTask($arrayTask[0]['TAS_UID'], 1); - - foreach ($arrayAux as $arrayGroup) { - $arrayGroupUser = $group->getUsersOfGroup($arrayGroup['GRP_UID']); - - foreach ($arrayGroupUser as $arrayUser) { - $arrayTaskUser[] = $arrayUser['USR_UID']; - } - } - - $arrayAux = $task->getUsersOfTask($arrayTask[0]['TAS_UID'], 1); - - foreach ($arrayAux as $arrayUser) { - $arrayTaskUser[] = $arrayUser['USR_UID']; - } - - if (!in_array($userId, $arrayTaskUser)) { - $result = new wsResponse(14, G::loadTranslation('ID_USER_NOT_ASSIGNED_TASK')); - - return $result; - } - $case = $oCase->startCase($arrayTask[0]['TAS_UID'], $userId); $caseId = $case['APPLICATION']; $caseNumber = $case['CASE_NUMBER']; From 76f5bb2973c905613e2118d0b66c185d1f112027 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Tue, 10 Jul 2012 17:48:42 -0400 Subject: [PATCH 3/3] BUG 9370 "NewCaseImpersonate function not working when start..." SOLVED - PMFNewCaseImpersonate function not working when start task of process to instance is assigned to group and not to user - Delete validation "user assigned to task" --- workflow/engine/classes/class.wsBase.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/workflow/engine/classes/class.wsBase.php b/workflow/engine/classes/class.wsBase.php index 36ca6ee9a..dadbb280a 100755 --- a/workflow/engine/classes/class.wsBase.php +++ b/workflow/engine/classes/class.wsBase.php @@ -1567,18 +1567,25 @@ class wsBase return $result; } - $oProcesses = new Processes(); - $pro = $oProcesses->processExists($processId); + $processes = new Processes(); - if (!$pro) { + if (!$processes->processExists($processId)) { $result = new wsResponse(11, G::loadTranslation('ID_INVALID_PROCESS') . " " . $processId . "!!"); return $result; } + $user = new Users(); + + if (!$user->userExists($userId)) { + $result = new wsResponse(11, G::loadTranslation('ID_USER_NOT_REGISTERED') . " " . $userId . "!!"); + + return $result; + } + $oCase = new Cases(); - $arrayTask = $oProcesses->getStartingTaskForUser($processId, $userId); + $arrayTask = $processes->getStartingTaskForUser($processId, null); $numTasks = count($arrayTask); if ($numTasks == 1) {