I added the validation for wsbase
.
This commit is contained in:
@@ -832,6 +832,38 @@ class Derivation
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
|
||||
/**
|
||||
* This function prepare the information before call the derivate function
|
||||
*
|
||||
* We can route a case from differents ways from cases_Derivate and derivateCase used in PMFDerivateCase
|
||||
* before this we need to process the information
|
||||
*
|
||||
* @param array $aDataForPrepareInfo
|
||||
* @param array $tasks
|
||||
* @param string $rouType
|
||||
* @param array $aCurrentDerivation
|
||||
* @return array $arrayDerivationResult
|
||||
*/
|
||||
function beforeDerivate($aDataForPrepareInfo, $tasks, $rouType, $aCurrentDerivation)
|
||||
{
|
||||
$aPInformation = $this->prepareInformation($aDataForPrepareInfo);
|
||||
$oRoute = new \ProcessMaker\Core\RoutingScreen();
|
||||
$nextTasks = $oRoute->mergeDataDerivation($tasks, $aPInformation, $rouType);
|
||||
|
||||
//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 = $this->derivate($aCurrentDerivation, $nextTasks);
|
||||
|
||||
return $arrayDerivationResult;
|
||||
}
|
||||
|
||||
/** Derivate
|
||||
*
|
||||
* @param array $currentDelegation
|
||||
|
||||
@@ -2268,10 +2268,6 @@ class wsBase
|
||||
$oPMScript = new PMScript();
|
||||
|
||||
foreach ($aTriggers as $aTrigger) {
|
||||
//$appFields = $oCase->loadCase( $caseId );
|
||||
//$appFields['APP_DATA']['APPLICATION'] = $caseId;
|
||||
|
||||
|
||||
//Set variables
|
||||
$params = new stdClass();
|
||||
$params->appData = $appFields["APP_DATA"];
|
||||
@@ -2320,10 +2316,6 @@ class wsBase
|
||||
$oPMScript = new PMScript();
|
||||
|
||||
foreach ($aTriggers as $aTrigger) {
|
||||
//$appFields = $oCase->loadCase( $caseId );
|
||||
//$appFields['APP_DATA']['APPLICATION'] = $caseId;
|
||||
|
||||
|
||||
//Set variables
|
||||
$params = new stdClass();
|
||||
$params->appData = $appFields["APP_DATA"];
|
||||
@@ -2416,12 +2408,6 @@ class wsBase
|
||||
$appFields['TAS_UID'] = $derive['TAS_UID'];
|
||||
}
|
||||
|
||||
//Save data - Start
|
||||
//$appFields = $oCase->loadCase( $caseId );
|
||||
//$oCase->updateCase ( $caseId, $appFields );
|
||||
//Save data - End
|
||||
|
||||
|
||||
$row = array ();
|
||||
$oCriteria = new Criteria( 'workflow' );
|
||||
$del = DBAdapter::getStringDelimiter();
|
||||
@@ -2433,25 +2419,33 @@ class wsBase
|
||||
$oDataset->next();
|
||||
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
$row[] = array ('ROU_TYPE' => $aRow['ROU_TYPE'],'ROU_NEXT_TASK' => $aRow['ROU_NEXT_TASK']
|
||||
);
|
||||
$row[] = array('ROU_TYPE' => $aRow['ROU_TYPE'], 'ROU_NEXT_TASK' => $aRow['ROU_NEXT_TASK']);
|
||||
$oDataset->next();
|
||||
}
|
||||
|
||||
//derivate case
|
||||
$aCurrentDerivation = array ('APP_UID' => $caseId,'DEL_INDEX' => $delIndex,'APP_STATUS' => $sStatus,'TAS_UID' => $appdel['TAS_UID'],'ROU_TYPE' => $row[0]['ROU_TYPE']
|
||||
$aCurrentDerivation = array (
|
||||
'APP_UID' => $caseId,
|
||||
'DEL_INDEX' => $delIndex,
|
||||
'APP_STATUS' => $sStatus,
|
||||
'TAS_UID' => $appdel['TAS_UID'],
|
||||
'ROU_TYPE' => $row[0]['ROU_TYPE']
|
||||
);
|
||||
$oRoute = new \ProcessMaker\Core\RoutingScreen();
|
||||
$nextTasks = $oRoute->mergeDataDerivation($nextDelegations, $oDerivation->prepareInformation($aData), $row[0]['ROU_TYPE']);
|
||||
$oDerivation->derivate( $aCurrentDerivation, $nextTasks );
|
||||
|
||||
//We define some parameters in the before the derivation
|
||||
//Then this function will be route the case
|
||||
$oDerivation->beforeDerivate(
|
||||
$aData,
|
||||
$nextDelegations,
|
||||
$row[0]['ROU_TYPE'],
|
||||
$aCurrentDerivation
|
||||
);
|
||||
|
||||
$appFields = $oCase->loadCase( $caseId );
|
||||
|
||||
//Execute triggers after derivation
|
||||
$aTriggers = $oCase->loadTriggers( $appdel['TAS_UID'], 'ASSIGN_TASK', - 2, 'AFTER' );
|
||||
|
||||
if (count( $aTriggers ) > 0) {
|
||||
//$appFields['APP_DATA']['APPLICATION'] = $caseId;
|
||||
|
||||
|
||||
//Set variables
|
||||
$params = new stdClass();
|
||||
|
||||
@@ -135,26 +135,20 @@ try {
|
||||
'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']
|
||||
)
|
||||
$aDataForPrepareInfo = 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);
|
||||
//We define some parameters in the before the derivation
|
||||
//Then this function will be route the case
|
||||
$arrayDerivationResult = $oDerivation->beforeDerivate(
|
||||
$aDataForPrepareInfo,
|
||||
$_POST['form']['TASKS'],
|
||||
$_POST['form']['ROU_TYPE'],
|
||||
$aCurrentDerivation
|
||||
);
|
||||
|
||||
if (!empty($arrayDerivationResult)) {
|
||||
foreach ($_POST['form']['TASKS'] as $key => $value) {
|
||||
|
||||
@@ -826,7 +826,7 @@ try {
|
||||
throw (new Exception( G::LoadTranslation( 'ID_NO_DERIVATION_RULE' ) ));
|
||||
}
|
||||
|
||||
//take the first derivation rule as the task derivation rule type.
|
||||
//Take the first derivation rule as the task derivation rule type.
|
||||
$aFields['PROCESS']['ROU_TYPE'] = $aFields['TASK'][1]['ROU_TYPE'];
|
||||
$aFields['PROCESS']['ROU_FINISH_FLAG'] = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user