Merge pull request #1825 from victorsl/BUG-12173
BUG 12173 "Trigger Execution" SOLVED
This commit is contained in:
@@ -770,7 +770,7 @@ class wsBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
$oSpool = new spoolRun();
|
$oSpool = new spoolRun();
|
||||||
$oSpool->setConfig(
|
$oSpool->setConfig(
|
||||||
array (
|
array (
|
||||||
'MESS_ENGINE' => $aSetup['MESS_ENGINE'],
|
'MESS_ENGINE' => $aSetup['MESS_ENGINE'],
|
||||||
'MESS_SERVER' => $aSetup['MESS_SERVER'],
|
'MESS_SERVER' => $aSetup['MESS_SERVER'],
|
||||||
@@ -1706,10 +1706,13 @@ class wsBase
|
|||||||
* @param string $userId
|
* @param string $userId
|
||||||
* @param string $taskId
|
* @param string $taskId
|
||||||
* @param string $variables
|
* @param string $variables
|
||||||
|
* @param int $executeTriggers : Optional parameter. The execution all triggers of the task, according to your steps, 1 yes 0 no.
|
||||||
* @return $result will return an object
|
* @return $result will return an object
|
||||||
*/
|
*/
|
||||||
public function newCase ($processId, $userId, $taskId, $variables)
|
public function newCase($processId, $userId, $taskId, $variables, $executeTriggers = 0)
|
||||||
{
|
{
|
||||||
|
//$executeTriggers, this parameter is not important, it may be the last parameter in the method
|
||||||
|
|
||||||
$g = new G();
|
$g = new G();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -1737,7 +1740,6 @@ class wsBase
|
|||||||
}
|
}
|
||||||
|
|
||||||
$oCase = new Cases();
|
$oCase = new Cases();
|
||||||
$oTask = new Tasks();
|
|
||||||
$startingTasks = $oCase->getStartCases( $userId );
|
$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 = '';
|
$founded = '';
|
||||||
@@ -1778,6 +1780,7 @@ class wsBase
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Start case
|
||||||
$case = $oCase->startCase( $taskId, $userId );
|
$case = $oCase->startCase( $taskId, $userId );
|
||||||
|
|
||||||
$_SESSION['APPLICATION'] = $case['APPLICATION'];
|
$_SESSION['APPLICATION'] = $case['APPLICATION'];
|
||||||
@@ -1799,6 +1802,22 @@ class wsBase
|
|||||||
$oldFields['TAS_UID'] = $taskId;
|
$oldFields['TAS_UID'] = $taskId;
|
||||||
$up_case = $oCase->updateCase( $caseId, $oldFields );
|
$up_case = $oCase->updateCase( $caseId, $oldFields );
|
||||||
|
|
||||||
|
//Execute all triggers of the task, according to your steps
|
||||||
|
if ($executeTriggers == 1) {
|
||||||
|
$task = new Tasks();
|
||||||
|
$arrayStep = $task->getStepsOfTask($taskId);
|
||||||
|
|
||||||
|
foreach ($arrayStep as $step) {
|
||||||
|
$arrayField = $oCase->loadCase($caseId);
|
||||||
|
|
||||||
|
$arrayField["APP_DATA"] = $oCase->executeTriggers($taskId, $step["STEP_TYPE_OBJ"], $step["STEP_UID_OBJ"], "BEFORE", $arrayField["APP_DATA"]);
|
||||||
|
$arrayField["APP_DATA"] = $oCase->executeTriggers($taskId, $step["STEP_TYPE_OBJ"], $step["STEP_UID_OBJ"], "AFTER", $arrayField["APP_DATA"]);
|
||||||
|
|
||||||
|
$arrayField = $oCase->updateCase($caseId, $arrayField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Response
|
||||||
$result = new wsResponse( 0, G::loadTranslation( 'ID_STARTED_SUCCESSFULLY' ) );
|
$result = new wsResponse( 0, G::loadTranslation( 'ID_STARTED_SUCCESSFULLY' ) );
|
||||||
$result->caseId = $caseId;
|
$result->caseId = $caseId;
|
||||||
$result->caseNumber = $caseNr;
|
$result->caseNumber = $caseNr;
|
||||||
|
|||||||
@@ -396,7 +396,12 @@ class CaseScheduler extends BaseCaseScheduler
|
|||||||
$paramsRouteLogResult = $paramsLogResultFromPlugin['paramsRouteLogResult'];
|
$paramsRouteLogResult = $paramsLogResultFromPlugin['paramsRouteLogResult'];
|
||||||
} else {
|
} else {
|
||||||
eprint( " - Creating the new case............." );
|
eprint( " - Creating the new case............." );
|
||||||
$result = $client->__SoapCall( 'NewCase', array ($params) );
|
|
||||||
|
$paramsAux = $params;
|
||||||
|
$paramsAux["executeTriggers"] = 1;
|
||||||
|
|
||||||
|
$result = $client->__SoapCall("NewCase", array($paramsAux));
|
||||||
|
|
||||||
if ($result->status_code == 0) {
|
if ($result->status_code == 0) {
|
||||||
eprintln( "OK+ CASE #{$result->caseNumber} was created!", 'green' );
|
eprintln( "OK+ CASE #{$result->caseNumber} was created!", 'green' );
|
||||||
|
|
||||||
@@ -499,7 +504,10 @@ class CaseScheduler extends BaseCaseScheduler
|
|||||||
$paramsLog = array ('PRO_UID' => $processId,'TAS_UID' => $taskId,'SCH_UID' => $sSchedulerUid,'USR_NAME' => $user,'RESULT' => '','EXEC_DATE' => date( 'Y-m-d' ),'EXEC_HOUR' => date( 'H:i:s' ),'WS_CREATE_CASE_STATUS' => '','WS_ROUTE_CASE_STATUS' => ''
|
$paramsLog = array ('PRO_UID' => $processId,'TAS_UID' => $taskId,'SCH_UID' => $sSchedulerUid,'USR_NAME' => $user,'RESULT' => '','EXEC_DATE' => date( 'Y-m-d' ),'EXEC_HOUR' => date( 'H:i:s' ),'WS_CREATE_CASE_STATUS' => '','WS_ROUTE_CASE_STATUS' => ''
|
||||||
);
|
);
|
||||||
|
|
||||||
$result = $client->__SoapCall( 'NewCase', array ($params) );
|
$paramsAux = $params;
|
||||||
|
$paramsAux["executeTriggers"] = 1;
|
||||||
|
|
||||||
|
$result = $client->__SoapCall("NewCase", array($paramsAux));
|
||||||
|
|
||||||
eprint( " - Creating the new case............." );
|
eprint( " - Creating the new case............." );
|
||||||
if ($result->status_code == 0) {
|
if ($result->status_code == 0) {
|
||||||
|
|||||||
@@ -410,6 +410,7 @@
|
|||||||
<xs:element name="processId" type="xs:string"/>
|
<xs:element name="processId" type="xs:string"/>
|
||||||
<xs:element name="taskId" type="xs:string"/>
|
<xs:element name="taskId" type="xs:string"/>
|
||||||
<xs:element name="variables" maxOccurs="unbounded" type="xs0:variableListStruct"/>
|
<xs:element name="variables" maxOccurs="unbounded" type="xs0:variableListStruct"/>
|
||||||
|
<xs:element name="executeTriggers" minOccurs="0" maxOccurs="unbounded" type="xs:integer"/>
|
||||||
</xs:sequence>
|
</xs:sequence>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
|||||||
@@ -589,7 +589,7 @@ function DerivateCase ($params)
|
|||||||
$oStd->wsSessionId = $params->sessionId;
|
$oStd->wsSessionId = $params->sessionId;
|
||||||
|
|
||||||
$ws = new wsBase( $oStd );
|
$ws = new wsBase( $oStd );
|
||||||
$res = $ws->derivateCase( $user['USR_UID'], $params->caseId, $params->delIndex );
|
$res = $ws->derivateCase($user["USR_UID"], $params->caseId, $params->delIndex, true);
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
@@ -616,7 +616,7 @@ function RouteCase ($params)
|
|||||||
$oStd->wsSessionId = $params->sessionId;
|
$oStd->wsSessionId = $params->sessionId;
|
||||||
|
|
||||||
$ws = new wsBase( $oStd );
|
$ws = new wsBase( $oStd );
|
||||||
$res = $ws->derivateCase( $user['USR_UID'], $params->caseId, $params->delIndex );
|
$res = $ws->derivateCase($user["USR_UID"], $params->caseId, $params->delIndex, true);
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
|
|
||||||
@@ -765,7 +765,8 @@ function NewCase ($params)
|
|||||||
$params->variables = $field;
|
$params->variables = $field;
|
||||||
|
|
||||||
$ws = new wsBase();
|
$ws = new wsBase();
|
||||||
$res = $ws->newCase( $params->processId, $userId, $params->taskId, $params->variables );
|
|
||||||
|
$res = $ws->newCase($params->processId, $userId, $params->taskId, $params->variables, (isset($params->executeTriggers))? (int)($params->executeTriggers) : 0);
|
||||||
|
|
||||||
// we need to register the case id for a stored session variable. like a normal Session.
|
// we need to register the case id for a stored session variable. like a normal Session.
|
||||||
$oSession->registerGlobal( "APPLICATION", $res->caseId );
|
$oSession->registerGlobal( "APPLICATION", $res->caseId );
|
||||||
|
|||||||
Reference in New Issue
Block a user