PMCORE-1175
This commit is contained in:
@@ -2105,199 +2105,201 @@ class Cases
|
||||
* This function start a case using the task for the user $sUsrUid
|
||||
* With this function we can Start a case
|
||||
*
|
||||
* @name startCase
|
||||
* @param string $sTasUid
|
||||
* @param string $sUsrUid
|
||||
* @return Fields
|
||||
* @param string $taskUid
|
||||
* @param string $userUid
|
||||
* @param bool $isSubProcess
|
||||
* @param array $dataPreviousApplication
|
||||
* @param bool $isSelfService
|
||||
* @param string $sequenceType
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function startCase($sTasUid, $sUsrUid, $isSubprocess = false, $dataPreviusApplication = array(), $isSelfService = false)
|
||||
public function startCase($taskUid, $userUid, $isSubProcess = false, $dataPreviousApplication = [], $isSelfService = false, $sequenceType = AppSequence::APP_TYPE_NORMAL)
|
||||
{
|
||||
if ($sTasUid != '') {
|
||||
if ($taskUid != '') {
|
||||
try {
|
||||
$task = TaskPeer::retrieveByPK($sTasUid);
|
||||
$user = UsersPeer::retrieveByPK($sUsrUid);
|
||||
$task = TaskPeer::retrieveByPK($taskUid);
|
||||
$user = UsersPeer::retrieveByPK($userUid);
|
||||
|
||||
if (is_null($task)) {
|
||||
throw new Exception(G::LoadTranslation("ID_TASK_NOT_EXIST", array("TAS_UID", $sTasUid)));
|
||||
throw new Exception(G::LoadTranslation("ID_TASK_NOT_EXIST", ["TAS_UID", $taskUid]));
|
||||
}
|
||||
|
||||
//To allow Self Service as the first task
|
||||
$arrayTaskTypeToExclude = array("START-TIMER-EVENT");
|
||||
// To allow Self Service as the first task
|
||||
$arrayTaskTypeToExclude = ["START-TIMER-EVENT"];
|
||||
|
||||
if (!is_null($task) && !in_array($task->getTasType(), $arrayTaskTypeToExclude) && $task->getTasAssignType() != "SELF_SERVICE" && $sUsrUid == "") {
|
||||
if (!is_null($task) && !in_array($task->getTasType(), $arrayTaskTypeToExclude) && $task->getTasAssignType() != "SELF_SERVICE" && $userUid == "") {
|
||||
throw (new Exception('You tried to start a new case without send the USER UID!'));
|
||||
}
|
||||
|
||||
//Process
|
||||
$sProUid = $task->getProUid();
|
||||
// Process
|
||||
$processUid = $task->getProUid();
|
||||
$this->Process = new Process;
|
||||
$proFields = $this->Process->Load($sProUid);
|
||||
$proFields = $this->Process->Load($processUid);
|
||||
|
||||
//application
|
||||
$Application = new Application;
|
||||
$sAppUid = $Application->create($sProUid, $sUsrUid);
|
||||
// Application
|
||||
$application = new Application;
|
||||
$appUid = $application->create($processUid, $userUid, $sequenceType);
|
||||
|
||||
//appDelegation
|
||||
$AppDelegation = new AppDelegation;
|
||||
$iAppThreadIndex = 1; // Start Thread
|
||||
$iAppDelPrio = 3; // Priority
|
||||
$iDelIndex = $AppDelegation->createAppDelegation(
|
||||
$sProUid,
|
||||
$sAppUid,
|
||||
$sTasUid,
|
||||
$sUsrUid,
|
||||
$iAppThreadIndex,
|
||||
$iAppDelPrio,
|
||||
$isSubprocess,
|
||||
// AppDelegation
|
||||
$appDelegation = new AppDelegation;
|
||||
$appThreadIndex = 1; // Start Thread
|
||||
$appDelPriority = 3; // Priority
|
||||
$delIndex = $appDelegation->createAppDelegation(
|
||||
$processUid,
|
||||
$appUid,
|
||||
$taskUid,
|
||||
$userUid,
|
||||
$appThreadIndex,
|
||||
$appDelPriority,
|
||||
$isSubProcess,
|
||||
-1,
|
||||
null,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
$Application->getAppNumber(),
|
||||
$application->getAppNumber(),
|
||||
$task->getTasId(),
|
||||
(empty($user)) ? 0 : $user->getUsrId(),
|
||||
$this->Process->getProId()
|
||||
|
||||
);
|
||||
|
||||
//appThread
|
||||
$AppThread = new AppThread;
|
||||
$iAppThreadIndex = $AppThread->createAppThread($sAppUid, $iDelIndex, 0);
|
||||
// AppThread
|
||||
$appThread = new AppThread;
|
||||
$appThreadIndex = $appThread->createAppThread($appUid, $delIndex, 0);
|
||||
|
||||
$oDerivation = new Derivation();
|
||||
$derivation = new Derivation();
|
||||
|
||||
//Multiple Instance
|
||||
$aUserFields = array();
|
||||
// Multiple Instance
|
||||
$usersFields = [];
|
||||
$taskAssignType = $task->getTasAssignType();
|
||||
$nextTaskAssignVariable = $task->getTasAssignVariable();
|
||||
if ($taskAssignType == "MULTIPLE_INSTANCE" || $taskAssignType == "MULTIPLE_INSTANCE_VALUE_BASED") {
|
||||
switch ($taskAssignType) {
|
||||
case 'MULTIPLE_INSTANCE':
|
||||
$userFields = $oDerivation->getUsersFullNameFromArray($oDerivation->getAllUsersFromAnyTask($sTasUid));
|
||||
$userFields = $derivation->getUsersFullNameFromArray($derivation->getAllUsersFromAnyTask($taskUid));
|
||||
break;
|
||||
default:
|
||||
throw (new Exception('Invalid Task Assignment method'));
|
||||
break;
|
||||
}
|
||||
$userFields = $oDerivation->getUsersFullNameFromArray($oDerivation->getAllUsersFromAnyTask($sTasUid));
|
||||
$userFields = $derivation->getUsersFullNameFromArray($derivation->getAllUsersFromAnyTask($taskUid));
|
||||
$count = 0;
|
||||
foreach ($userFields as $rowUser) {
|
||||
if ($rowUser["USR_UID"] != $sUsrUid) {
|
||||
//appDelegation
|
||||
$AppDelegation = new AppDelegation;
|
||||
$iAppThreadIndex ++; // Start Thread
|
||||
$iAppDelPrio = 3; // Priority
|
||||
if ($rowUser["USR_UID"] != $userUid) {
|
||||
// AppDelegation
|
||||
$appDelegation = new AppDelegation;
|
||||
$appThreadIndex ++; // Start Thread
|
||||
$appDelPriority = 3; // Priority
|
||||
$user = UsersPeer::retrieveByPK($rowUser["USR_UID"]);
|
||||
$iDelIndex1 = $AppDelegation->createAppDelegation(
|
||||
$sProUid,
|
||||
$sAppUid,
|
||||
$sTasUid,
|
||||
$delIndex1 = $appDelegation->createAppDelegation(
|
||||
$processUid,
|
||||
$appUid,
|
||||
$taskUid,
|
||||
$rowUser["USR_UID"],
|
||||
$iAppThreadIndex,
|
||||
$iAppDelPrio,
|
||||
$isSubprocess,
|
||||
$appThreadIndex,
|
||||
$appDelPriority,
|
||||
$isSubProcess,
|
||||
-1,
|
||||
null,
|
||||
false,
|
||||
false,
|
||||
0,
|
||||
$Application->getAppNumber(),
|
||||
$application->getAppNumber(),
|
||||
$task->getTasId(),
|
||||
(empty($user)) ? 0 : $user->getUsrId(),
|
||||
$this->Process->getProId()
|
||||
);
|
||||
//appThread
|
||||
$AppThread = new AppThread;
|
||||
$iAppThreadIndex = $AppThread->createAppThread($sAppUid, $iDelIndex1, 0);
|
||||
//Save Information
|
||||
$aUserFields[$count] = $rowUser;
|
||||
$aUserFields[$count]["DEL_INDEX"] = $iDelIndex1;
|
||||
// AppThread
|
||||
$appThread = new AppThread;
|
||||
$appThreadIndex = $appThread->createAppThread($appUid, $delIndex1, 0);
|
||||
// Save Information
|
||||
$usersFields[$count] = $rowUser;
|
||||
$usersFields[$count]["DEL_INDEX"] = $delIndex1;
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//DONE: Al ya existir un delegation, se puede "calcular" el caseTitle.
|
||||
$Fields = $Application->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$aApplicationFields = $Fields['APP_DATA'];
|
||||
$Fields['DEL_INDEX'] = $iDelIndex;
|
||||
$newValues = $this->newRefreshCaseTitleAndDescription($sAppUid, $Fields, $aApplicationFields);
|
||||
$fields = $application->toArray(BasePeer::TYPE_FIELDNAME);
|
||||
$applicationFields = $fields['APP_DATA'];
|
||||
$fields['DEL_INDEX'] = $delIndex;
|
||||
$newValues = $this->newRefreshCaseTitleAndDescription($appUid, $fields, $applicationFields);
|
||||
if (!isset($newValues['APP_TITLE'])) {
|
||||
$newValues['APP_TITLE'] = '';
|
||||
}
|
||||
|
||||
$caseNumber = $Fields['APP_NUMBER'];
|
||||
$Application->update($Fields);
|
||||
$caseNumber = $fields['APP_NUMBER'];
|
||||
$application->update($fields);
|
||||
|
||||
//Update the task last assigned (for web entry and web services)
|
||||
$oDerivation->setTasLastAssigned($sTasUid, $sUsrUid);
|
||||
// Update the task last assigned (for web entry and web services)
|
||||
$derivation->setTasLastAssigned($taskUid, $userUid);
|
||||
|
||||
// Execute Events
|
||||
require_once 'classes/model/Event.php';
|
||||
$event = new Event();
|
||||
$event->createAppEvents($sProUid, $sAppUid, $iDelIndex, $sTasUid);
|
||||
$event->createAppEvents($processUid, $appUid, $delIndex, $taskUid);
|
||||
|
||||
//update searchindex
|
||||
// Update search index
|
||||
if ($this->appSolr != null) {
|
||||
$this->appSolr->updateApplicationSearchIndex($sAppUid);
|
||||
$this->appSolr->updateApplicationSearchIndex($appUid);
|
||||
}
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$Fields['TAS_UID'] = $sTasUid;
|
||||
$Fields['USR_UID'] = $sUsrUid;
|
||||
$Fields['DEL_INDEX'] = $iDelIndex;
|
||||
$Fields['APP_STATUS'] = 'TO_DO';
|
||||
$Fields['DEL_DELEGATE_DATE'] = $Fields['APP_INIT_DATE'];
|
||||
if (!$isSubprocess) {
|
||||
$Fields['APP_STATUS'] = 'DRAFT';
|
||||
$fields['TAS_UID'] = $taskUid;
|
||||
$fields['USR_UID'] = $userUid;
|
||||
$fields['DEL_INDEX'] = $delIndex;
|
||||
$fields['APP_STATUS'] = 'TO_DO';
|
||||
$fields['DEL_DELEGATE_DATE'] = $fields['APP_INIT_DATE'];
|
||||
if (!$isSubProcess) {
|
||||
$fields['APP_STATUS'] = 'DRAFT';
|
||||
} else {
|
||||
$Fields['APP_INIT_DATE'] = null;
|
||||
$fields['APP_INIT_DATE'] = null;
|
||||
}
|
||||
$inbox = new ListInbox();
|
||||
$inbox->newRow($Fields, $sUsrUid, $isSelfService);
|
||||
$inbox->newRow($fields, $userUid, $isSelfService);
|
||||
|
||||
//Multiple Instance
|
||||
foreach ($aUserFields as $rowUser) {
|
||||
$Fields["USR_UID"] = $rowUser["USR_UID"];
|
||||
$Fields["DEL_INDEX"] = $rowUser["DEL_INDEX"];
|
||||
// Multiple Instance
|
||||
foreach ($usersFields as $rowUser) {
|
||||
$fields["USR_UID"] = $rowUser["USR_UID"];
|
||||
$fields["DEL_INDEX"] = $rowUser["DEL_INDEX"];
|
||||
$inbox = new ListInbox();
|
||||
$inbox->newRow($Fields, $sUsrUid, $isSelfService);
|
||||
$inbox->newRow($fields, $userUid, $isSelfService);
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
} catch (exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
} else {
|
||||
throw (new Exception('You tried to start a new case without send the USER UID or TASK UID!'));
|
||||
}
|
||||
|
||||
//Log
|
||||
// Log
|
||||
$message = 'Create case';
|
||||
$context = $data = [
|
||||
"appUid" => $sAppUid,
|
||||
"usrUid" => $sUsrUid,
|
||||
"tasUid" => $sTasUid,
|
||||
"isSubprocess" => $isSubprocess,
|
||||
"appUid" => $appUid,
|
||||
"usrUid" => $userUid,
|
||||
"tasUid" => $taskUid,
|
||||
"isSubProcess" => $isSubProcess,
|
||||
"appNumber" => $caseNumber,
|
||||
"delIndex" => $iDelIndex,
|
||||
"appInitDate" => $Fields['APP_INIT_DATE']
|
||||
"delIndex" => $delIndex,
|
||||
"appInitDate" => $fields['APP_INIT_DATE']
|
||||
];
|
||||
Log::channel(':CreateCase')->info($message, Bootstrap::context($context));
|
||||
//call plugin
|
||||
// Call plugin
|
||||
if (class_exists('folderData')) {
|
||||
$folderData = new folderData($sProUid, $proFields['PRO_TITLE'], $sAppUid, $newValues['APP_TITLE'], $sUsrUid);
|
||||
$oPluginRegistry = PluginRegistry::loadSingleton();
|
||||
$oPluginRegistry->executeTriggers(PM_CREATE_CASE, $folderData);
|
||||
$folderData = new folderData($processUid, $proFields['PRO_TITLE'], $appUid, $newValues['APP_TITLE'], $userUid);
|
||||
$pluginRegistry = PluginRegistry::loadSingleton();
|
||||
$pluginRegistry->executeTriggers(PM_CREATE_CASE, $folderData);
|
||||
}
|
||||
$this->getExecuteTriggerProcess($sAppUid, 'CREATE');
|
||||
//end plugin
|
||||
return array(
|
||||
'APPLICATION' => $sAppUid,
|
||||
'INDEX' => $iDelIndex,
|
||||
'PROCESS' => $sProUid,
|
||||
$this->getExecuteTriggerProcess($appUid, 'CREATE');
|
||||
// End plugin
|
||||
return [
|
||||
'APPLICATION' => $appUid,
|
||||
'INDEX' => $delIndex,
|
||||
'PROCESS' => $processUid,
|
||||
'CASE_NUMBER' => $caseNumber
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,27 +16,34 @@ require_once 'classes/model/om/BaseAppSequence.php';
|
||||
*/
|
||||
class AppSequence extends BaseAppSequence {
|
||||
|
||||
const APP_TYPE_NORMAL = 'NORMAL';
|
||||
const APP_TYPE_WEB_ENTRY = 'WEB_ENTRY';
|
||||
|
||||
/**
|
||||
* Get an Set new sequence number
|
||||
*
|
||||
* @param string $sequenceType
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function sequenceNumber()
|
||||
public function sequenceNumber($sequenceType)
|
||||
{
|
||||
try {
|
||||
$con = Propel::getConnection('workflow');
|
||||
$stmt = $con->createStatement();
|
||||
//UPDATE SEQUENCES SET SEQ_VALUE = LAST_INSERT_ID(SEQ_VALUE + 1);
|
||||
$sql = "UPDATE APP_SEQUENCE SET ID=LAST_INSERT_ID(ID+1)";
|
||||
$sql = "UPDATE APP_SEQUENCE SET ID=LAST_INSERT_ID(ID+1) WHERE APP_TYPE = '{$sequenceType}'";
|
||||
$stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
//SELECT LAST_INSERT_ID()
|
||||
$sql = "SELECT LAST_INSERT_ID()";
|
||||
$rs = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
$rs->next();
|
||||
$row = $rs->getRow();
|
||||
$result = $row['LAST_INSERT_ID()'];
|
||||
} catch (\Exception $e) {
|
||||
|
||||
// If the type is WEB_ENTRY, we need to change to negative
|
||||
if ($sequenceType === 'WEB_ENTRY') {
|
||||
$result *= -1;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw ($e);
|
||||
}
|
||||
return $result;
|
||||
|
||||
@@ -207,30 +207,31 @@ class Application extends BaseApplication
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the Application
|
||||
* Creates an Application
|
||||
*
|
||||
* @param
|
||||
* $sProUid the process id
|
||||
* $sUsrUid the userid
|
||||
* @return void
|
||||
* @param string $processUid
|
||||
* @param string $userUid
|
||||
* @param string $sequenceType
|
||||
* @throws PropelException
|
||||
* @throws Exception
|
||||
* @return string
|
||||
*/
|
||||
public function create($sProUid, $sUsrUid)
|
||||
public function create($processUid, $userUid, $sequenceType)
|
||||
{
|
||||
require_once ("classes/model/AppSequence.php");
|
||||
$con = Propel::getConnection('workflow');
|
||||
|
||||
try {
|
||||
//fill the default values for new application row
|
||||
// Fill the default values for new application row
|
||||
$this->setAppUid(G::generateUniqueID());
|
||||
$this->setAppParent('');
|
||||
$this->setAppStatus('DRAFT');
|
||||
$this->setAppStatusId(1);
|
||||
$this->setProUid($sProUid);
|
||||
$this->setProUid($processUid);
|
||||
$this->setAppProcStatus('');
|
||||
$this->setAppProcCode('');
|
||||
$this->setAppParallel('N');
|
||||
$this->setAppInitUser($sUsrUid);
|
||||
$this->setAppCurUser($sUsrUid);
|
||||
$this->setAppInitUser($userUid);
|
||||
$this->setAppCurUser($userUid);
|
||||
$this->setAppCreateDate('now');
|
||||
$this->setAppInitDate('now');
|
||||
$this->setAppUpdateDate('now');
|
||||
@@ -241,8 +242,8 @@ class Application extends BaseApplication
|
||||
$c = new Criteria();
|
||||
$c->clearSelectColumns();
|
||||
|
||||
$oAppSequence = new AppSequence();
|
||||
$maxNumber = $oAppSequence->sequenceNumber();
|
||||
$appSequence = new AppSequence();
|
||||
$maxNumber = $appSequence->sequenceNumber($sequenceType);
|
||||
|
||||
$this->setAppNumber($maxNumber);
|
||||
$this->setAppData(serialize(['APP_NUMBER' => $maxNumber, 'PIN' => $pin]));
|
||||
@@ -253,9 +254,7 @@ class Application extends BaseApplication
|
||||
$con->begin();
|
||||
$this->setAppTitleContent('#' . $maxNumber);
|
||||
$this->setAppDescriptionContent('');
|
||||
//to do: ID_CASE in translation $this->setAppTitle(G::LoadTranslation('ID_CASE') . $maxNumber);
|
||||
//Content::insertContent('APP_PROC_CODE', '', $this->getAppUid(), $lang, '');
|
||||
$res = $this->save();
|
||||
$this->save();
|
||||
$con->commit();
|
||||
|
||||
return $this->getAppUid();
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
</unique>
|
||||
</table>
|
||||
<table name="APP_SEQUENCE" idMethod="native">
|
||||
<column name="ID" type="INTEGER" required="true" primaryKey="true"/>
|
||||
<column name="ID" type="INTEGER" required="true"/>
|
||||
<column name="APP_TYPE" type="VARCHAR" size="20" required="true" default="NORMAL"/>
|
||||
</table>
|
||||
<table name="APP_DELEGATION" idMethod="native">
|
||||
|
||||
@@ -61791,6 +61791,7 @@ INSERT INTO ADDONS_MANAGER (ADDON_DESCRIPTION,ADDON_ID,ADDON_NAME,ADDON_NICK,ADD
|
||||
('User-based Time Zone Management.','userBasedTimeZone','userBasedTimeZone','userBasedTimeZone','Colosa','localRegistry','ready','','00000000000000000000000000010014','features','','','0'),
|
||||
('SSO with an LDAP provider.','windowsSSO','windowsSSO','windowsSSO','Colosa','localRegistry','ready','','00000000000000000000000000010011','features','','','0');
|
||||
|
||||
INSERT INTO APP_SEQUENCE (ID) VALUES
|
||||
('0');
|
||||
INSERT INTO APP_SEQUENCE (ID, APP_TYPE) VALUES
|
||||
(0, 'NORMAL'),
|
||||
(0, 'WEB_ENTRY');
|
||||
|
||||
|
||||
@@ -54,8 +54,7 @@ DROP TABLE IF EXISTS `APP_SEQUENCE`;
|
||||
CREATE TABLE `APP_SEQUENCE`
|
||||
(
|
||||
`ID` INTEGER NOT NULL,
|
||||
`APP_TYPE` VARCHAR(20) default 'NORMAL' NOT NULL,
|
||||
PRIMARY KEY (`ID`)
|
||||
`APP_TYPE` VARCHAR(20) default 'NORMAL' NOT NULL
|
||||
)ENGINE=InnoDB ;
|
||||
#-----------------------------------------------------------------------------
|
||||
#-- APP_DELEGATION
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* This page define some functions used in the start new case
|
||||
*
|
||||
* @link https://wiki.processmaker.com/3.1/Cases#New_Case
|
||||
* @link https://wiki.processmaker.com/3.2/Web_Entry
|
||||
*/
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
@@ -179,61 +180,68 @@ function lookinginforContentProcess ($sproUid)
|
||||
|
||||
}
|
||||
|
||||
function startCase ()
|
||||
/**
|
||||
* Start a case and get the next step
|
||||
*/
|
||||
function startCase()
|
||||
{
|
||||
$filter = new InputFilter();
|
||||
$_POST = $filter->xssFilterHard($_POST);
|
||||
$_REQUEST = $filter->xssFilterHard($_REQUEST);
|
||||
|
||||
/* GET , POST & $_SESSION Vars */
|
||||
/* unset any variable, because we are starting a new case */
|
||||
if (isset( $_SESSION['APPLICATION'] )) {
|
||||
unset( $_SESSION['APPLICATION'] );
|
||||
// Unset any variable, because we are starting a new case
|
||||
if (isset($_SESSION['APPLICATION'])) {
|
||||
unset($_SESSION['APPLICATION']);
|
||||
}
|
||||
if (isset( $_SESSION['PROCESS'] )) {
|
||||
unset( $_SESSION['PROCESS'] );
|
||||
if (isset($_SESSION['PROCESS'])) {
|
||||
unset($_SESSION['PROCESS']);
|
||||
}
|
||||
if (isset( $_SESSION['TASK'] )) {
|
||||
unset( $_SESSION['TASK'] );
|
||||
if (isset($_SESSION['TASK'])) {
|
||||
unset($_SESSION['TASK']);
|
||||
}
|
||||
if (isset( $_SESSION['INDEX'] )) {
|
||||
unset( $_SESSION['INDEX'] );
|
||||
if (isset($_SESSION['INDEX'])) {
|
||||
unset($_SESSION['INDEX']);
|
||||
}
|
||||
if (isset( $_SESSION['STEP_POSITION'] )) {
|
||||
unset( $_SESSION['STEP_POSITION'] );
|
||||
if (isset($_SESSION['STEP_POSITION'])) {
|
||||
unset($_SESSION['STEP_POSITION']);
|
||||
}
|
||||
|
||||
/* Process */
|
||||
try {
|
||||
$oCase = new Cases();
|
||||
// Initializing variables
|
||||
$sequenceType = (!empty($_REQUEST['actionFrom']) && $_REQUEST['actionFrom'] === 'webEntry') ? AppSequence::APP_TYPE_WEB_ENTRY : AppSequence::APP_TYPE_NORMAL;
|
||||
|
||||
lookinginforContentProcess( $_POST['processId'] );
|
||||
// Update CONTENT table
|
||||
lookinginforContentProcess($_POST['processId']);
|
||||
|
||||
$aData = $oCase->startCase( $_REQUEST['taskId'], $_SESSION['USER_LOGGED'] );
|
||||
$aData = $filter->xssFilterHard($aData);
|
||||
// Create the new case
|
||||
$casesInstance = new Cases();
|
||||
$newCase = $casesInstance->startCase($_REQUEST['taskId'], $_SESSION['USER_LOGGED'], false, [], false, $sequenceType);
|
||||
|
||||
$_SESSION['APPLICATION'] = $aData['APPLICATION'];
|
||||
$_SESSION['INDEX'] = $aData['INDEX'];
|
||||
$_SESSION['PROCESS'] = $aData['PROCESS'];
|
||||
// Set session variables
|
||||
$_SESSION['APPLICATION'] = $newCase['APPLICATION'];
|
||||
$_SESSION['INDEX'] = $newCase['INDEX'];
|
||||
$_SESSION['PROCESS'] = $newCase['PROCESS'];
|
||||
$_SESSION['TASK'] = $_REQUEST['taskId'];
|
||||
$_SESSION['STEP_POSITION'] = 0;
|
||||
|
||||
$_SESSION['CASES_REFRESH'] = true;
|
||||
|
||||
$oCase = new Cases();
|
||||
$aNextStep = $oCase->getNextStep( $_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION'] );
|
||||
// Get the first step for the new case
|
||||
$casesInstance = new Cases();
|
||||
$nextStep = $casesInstance->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'],
|
||||
$_SESSION['STEP_POSITION']);
|
||||
$nextStep['PAGE'] = 'open?APP_UID=' . $newCase['APPLICATION'] . '&DEL_INDEX=' . $newCase['INDEX'] . '&action=draft';
|
||||
$_SESSION['BREAKSTEP']['NEXT_STEP'] = $nextStep;
|
||||
|
||||
$aNextStep['PAGE'] = 'open?APP_UID=' . $aData['APPLICATION'] . '&DEL_INDEX=' . $aData['INDEX'] . '&action=draft';
|
||||
// Complete required information
|
||||
$newCase['openCase'] = $nextStep;
|
||||
$newCase['status'] = 'success';
|
||||
|
||||
$_SESSION['BREAKSTEP']['NEXT_STEP'] = $aNextStep;
|
||||
$aData['openCase'] = $aNextStep;
|
||||
|
||||
$aData['status'] = 'success';
|
||||
print (G::json_encode( $aData )) ;
|
||||
// Print JSON response
|
||||
print (G::json_encode($newCase));
|
||||
} catch (Exception $e) {
|
||||
$aData['status'] = 'failure';
|
||||
$aData['message'] = $e->getMessage();
|
||||
print_r( G::json_encode( $aData ) );
|
||||
$newCase['status'] = 'failure';
|
||||
$newCase['message'] = $e->getMessage();
|
||||
print_r(G::json_encode($newCase));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -355,7 +355,8 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
||||
data: {
|
||||
action: 'startCase',
|
||||
processId: processUid,
|
||||
taskId: tasUid
|
||||
taskId: tasUid,
|
||||
actionFrom: 'webEntry'
|
||||
},
|
||||
success: function (data) {
|
||||
data.TAS_UID = tasUid;
|
||||
|
||||
Reference in New Issue
Block a user