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