From a493a7992eb0a9a9e2b5c1ebc64a4e3f95de844b Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Mon, 29 Aug 2016 11:03:03 -0400 Subject: [PATCH] HOR-1691 --- .../engine/methods/cases/casesList_Ajax.php | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/workflow/engine/methods/cases/casesList_Ajax.php b/workflow/engine/methods/cases/casesList_Ajax.php index 0cdbdc4dd..4dd4364a9 100755 --- a/workflow/engine/methods/cases/casesList_Ajax.php +++ b/workflow/engine/methods/cases/casesList_Ajax.php @@ -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);