HOR-2777
This commit is contained in:
@@ -1418,8 +1418,9 @@ class Derivation
|
||||
$application = new Application();
|
||||
$result = $application->update(['APP_UID' => $currentDelegation['APP_UID'], 'APP_ROUTING_DATA' => serialize($arrayRoutingData)]);
|
||||
|
||||
//APP_THREAD
|
||||
//We updated the information relate to APP_THREAD
|
||||
$iAppThreadIndex = $appFields['DEL_THREAD'];
|
||||
<<<<<<< HEAD
|
||||
|
||||
switch ($currentDelegation['ROU_TYPE']) {
|
||||
case 'PARALLEL':
|
||||
@@ -1432,6 +1433,20 @@ class Derivation
|
||||
$this->case->updateAppThread( $currentDelegation['APP_UID'], $iAppThreadIndex, $iNewDelIndex );
|
||||
break;
|
||||
} //en switch
|
||||
=======
|
||||
if (isset($currentDelegation['ROUTE_TYPES']) && sizeof($currentDelegation['ROUTE_TYPES']) > 1) {
|
||||
//If the next is more than one thread: Parallel or other
|
||||
foreach ($currentDelegation['ROUTE_TYPES'] as $key => $value) {
|
||||
if ($value['ROU_NEXT_TASK'] === $nextDel['TAS_UID']) {
|
||||
$routeType = ($value['ROU_TYPE'] === 'EVALUATE') ? 'PARALLEL-AND-EXCLUSIVE' : $value['ROU_TYPE'];
|
||||
$this->updateAppThread($routeType, $currentDelegation['APP_UID'], $iAppThreadIndex, $iNewDelIndex);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//If the next is a sequential derivation
|
||||
$this->updateAppThread($currentDelegation['ROU_TYPE'], $currentDelegation['APP_UID'], $iAppThreadIndex, $iNewDelIndex);
|
||||
}
|
||||
>>>>>>> HOR-2777
|
||||
|
||||
//if there are subprocess to create
|
||||
if (isset( $aSP )) {
|
||||
@@ -1550,6 +1565,28 @@ class Derivation
|
||||
return $iNewDelIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function create, update and closed a new record related to appThread
|
||||
*
|
||||
* Related to route type we can change the records in the APP_THREAD table
|
||||
* @param string $routeType this variable recibe information about the derivation
|
||||
* @return void
|
||||
*/
|
||||
function updateAppThread($routeType, $appUid, $iAppThreadIndex, $iNewDelIndex) {
|
||||
switch ($routeType) {
|
||||
case 'PARALLEL':
|
||||
case 'PARALLEL-BY-EVALUATION':
|
||||
case 'PARALLEL-AND-EXCLUSIVE':
|
||||
$this->case->closeAppThread($appUid, $iAppThreadIndex);
|
||||
$iNewThreadIndex = $this->case->newAppThread($appUid, $iNewDelIndex, $iAppThreadIndex);
|
||||
$this->case->updateAppDelegation($appUid, $iNewDelIndex, $iNewThreadIndex);
|
||||
break;
|
||||
default:
|
||||
$this->case->updateAppThread($appUid, $iAppThreadIndex, $iNewDelIndex);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* verifyIsCaseChild
|
||||
*
|
||||
* @param string $sApplicationUID
|
||||
|
||||
@@ -126,14 +126,34 @@ try {
|
||||
|
||||
$oCase->updateCase($_SESSION["APPLICATION"], $appFields); //Save data
|
||||
|
||||
//derivate case
|
||||
//Prepare information for the derivation
|
||||
$oDerivation = new Derivation();
|
||||
$aCurrentDerivation = array ('APP_UID' => $_SESSION['APPLICATION'],'DEL_INDEX' => $_SESSION['INDEX'],'APP_STATUS' => $sStatus,'TAS_UID' => $_SESSION['TASK'],'ROU_TYPE' => $_POST['form']['ROU_TYPE']
|
||||
$aCurrentDerivation = array (
|
||||
'APP_UID' => $_SESSION['APPLICATION'],
|
||||
'DEL_INDEX' => $_SESSION['INDEX'],
|
||||
'APP_STATUS' => $sStatus,
|
||||
'TAS_UID' => $_SESSION['TASK'],
|
||||
'ROU_TYPE' => $_POST['form']['ROU_TYPE']
|
||||
);
|
||||
$aPInformation = $oDerivation->prepareInformation( array ('USER_UID' => $_SESSION['USER_LOGGED'],'APP_UID' => $_SESSION['APPLICATION'],'DEL_INDEX' => $_SESSION['INDEX'])
|
||||
$aPInformation = $oDerivation->prepareInformation(
|
||||
array (
|
||||
'USER_UID' => $_SESSION['USER_LOGGED'],
|
||||
'APP_UID' => $_SESSION['APPLICATION'],
|
||||
'DEL_INDEX' => $_SESSION['INDEX']
|
||||
)
|
||||
);
|
||||
$oRoute = new \ProcessMaker\Core\RoutingScreen();
|
||||
$nextTasks = $oRoute->mergeDataDerivation($_POST['form']['TASKS'], $aPInformation, $_POST['form']['ROU_TYPE']);
|
||||
|
||||
//Get all route types
|
||||
$aRouteTypes = array();
|
||||
foreach ($aPInformation as $key => $value) {
|
||||
$aRouteTypes[$key]['ROU_NEXT_TASK'] = $value['ROU_NEXT_TASK'];
|
||||
$aRouteTypes[$key]['ROU_TYPE'] = $value['ROU_TYPE'];
|
||||
}
|
||||
$aCurrentDerivation['ROUTE_TYPES'] = $aRouteTypes;
|
||||
|
||||
//Derivate the case
|
||||
$arrayDerivationResult = $oDerivation->derivate($aCurrentDerivation, $nextTasks);
|
||||
|
||||
if (!empty($arrayDerivationResult)) {
|
||||
|
||||
Reference in New Issue
Block a user