Merged in gproly/processmaker/HOR-1691 (pull request #4830)

HOR-1691
This commit is contained in:
Julio Cesar Laura Avendaño
2016-08-29 16:41:48 -04:00

View File

@@ -195,11 +195,30 @@ if ($actionAjax == 'reassignCase') {
$cases = new Cases();
$user = new Users();
$app = new Application();
$oAppDel = new AppDelegation();
$TO_USR_UID = $_POST['USR_UID'];
try {
$cases->reassignCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], $TO_USR_UID);
//Current users of OPEN DEL_INDEX thread
$aCurUser = $oAppDel->getCurrentUsers($APP_UID, $DEL_INDEX);
$flagReassign = true;
if(!empty($aCurUser)){
foreach ($aCurUser as $key => $value) {
if($value === $TO_USR_UID){
$flagReassign = false;
}
}
} else {
//DEL_INDEX is CLOSED
throw new Exception(G::LoadTranslation('ID_REASSIGNMENT_ERROR'));
}
//If the currentUser is diferent to nextUser, create the thread
if($flagReassign){
$cases->reassignCase($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], $TO_USR_UID);
}
$caseData = $app->load($_SESSION['APPLICATION']);
$userData = $user->load($TO_USR_UID);
//print_r($caseData);