HOR-4779
This commit is contained in:
@@ -1974,12 +1974,6 @@ class Cases
|
|||||||
$listParticipatedLast = new ListParticipatedLast();
|
$listParticipatedLast = new ListParticipatedLast();
|
||||||
$listParticipatedLast->refresh($data);
|
$listParticipatedLast->refresh($data);
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
/** This case is subProcess? */
|
|
||||||
if (SubApplication::isCaseSubProcess($appUid)) {
|
|
||||||
$route = new Derivation();
|
|
||||||
$route->verifyIsCaseChild($appUid, $delIndex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Update search index */
|
/** Update search index */
|
||||||
@@ -1993,6 +1987,7 @@ class Cases
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* With this we can change the status to CLOSED in APP_DELEGATION
|
* With this we can change the status to CLOSED in APP_DELEGATION
|
||||||
|
* We close a thread in the action: paused reassign cancel
|
||||||
*
|
*
|
||||||
* @param string $appUid
|
* @param string $appUid
|
||||||
* @param string $delIndex
|
* @param string $delIndex
|
||||||
@@ -2035,12 +2030,6 @@ class Cases
|
|||||||
$listParticipatedLast->refresh($data);
|
$listParticipatedLast->refresh($data);
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
/** This case is subProcess? */
|
|
||||||
if (SubApplication::isCaseSubProcess($appUid)) {
|
|
||||||
$route = new Derivation();
|
|
||||||
$route->verifyIsCaseChild($appUid, $delIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Update searchindex */
|
/** Update searchindex */
|
||||||
if ($this->appSolr != null) {
|
if ($this->appSolr != null) {
|
||||||
$this->appSolr->updateApplicationSearchIndex($appUid);
|
$this->appSolr->updateApplicationSearchIndex($appUid);
|
||||||
@@ -4260,7 +4249,7 @@ class Cases
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function will be close the one or all threads
|
* This function will be close the one or all threads for cancel the case
|
||||||
*
|
*
|
||||||
* @param string $appUid
|
* @param string $appUid
|
||||||
* @param integer $delIndex, if is null we will to close all threads
|
* @param integer $delIndex, if is null we will to close all threads
|
||||||
@@ -4288,6 +4277,14 @@ class Cases
|
|||||||
$result[] = $resultDelegation;
|
$result[] = $resultDelegation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** This case is subProcess? */
|
||||||
|
if (SubApplication::isCaseSubProcess($appUid)) {
|
||||||
|
foreach ($result as $value){
|
||||||
|
$route = new Derivation();
|
||||||
|
$route->verifyIsCaseChild($appUid, $value['DEL_INDEX']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1136,7 +1136,9 @@ class Derivation
|
|||||||
//Close case
|
//Close case
|
||||||
$appFields["APP_STATUS"] = "COMPLETED";
|
$appFields["APP_STATUS"] = "COMPLETED";
|
||||||
$appFields["APP_FINISH_DATE"] = "now";
|
$appFields["APP_FINISH_DATE"] = "now";
|
||||||
$this->verifyIsCaseChild($currentDelegation["APP_UID"], $currentDelegation["DEL_INDEX"]);
|
if (SubApplication::isCaseSubProcess($currentDelegation["APP_UID"])) {
|
||||||
|
$this->verifyIsCaseChild($currentDelegation["APP_UID"], $currentDelegation["DEL_INDEX"]);
|
||||||
|
}
|
||||||
$flagUpdateCase = true;
|
$flagUpdateCase = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1490,51 +1492,18 @@ class Derivation
|
|||||||
function verifyIsCaseChild($applicationUid, $delIndex = 0)
|
function verifyIsCaseChild($applicationUid, $delIndex = 0)
|
||||||
{
|
{
|
||||||
//Obtain the related row in the table SUB_APPLICATION
|
//Obtain the related row in the table SUB_APPLICATION
|
||||||
$criteria = new Criteria('workflow');
|
$subApplication = SubApplication::getSubProcessInfo($applicationUid);
|
||||||
$criteria->add(SubApplicationPeer::APP_UID, $applicationUid);
|
if (!empty($subApplication)) {
|
||||||
$dataSet = SubApplicationPeer::doSelectRS($criteria);
|
|
||||||
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
|
|
||||||
if ($dataSet->next()) {
|
|
||||||
$subApplication = $dataSet->getRow();
|
|
||||||
//Obtain the related row in the table SUB_PROCESS
|
//Obtain the related row in the table SUB_PROCESS
|
||||||
$case = new Cases();
|
$case = new Cases();
|
||||||
$parentCase = $case->loadCase($subApplication['APP_PARENT'], $subApplication['DEL_INDEX_PARENT']);
|
$parentCase = $case->loadCase($subApplication['APP_PARENT'], $subApplication['DEL_INDEX_PARENT']);
|
||||||
$criteria = new Criteria('workflow');
|
|
||||||
$criteria->add(SubProcessPeer::PRO_PARENT, $parentCase['PRO_UID']);
|
$subProcessParent = SubProcess::getSubProcessConfiguration($parentCase['PRO_UID'], $parentCase['TAS_UID']);
|
||||||
$criteria->add(SubProcessPeer::TAS_PARENT, $parentCase['TAS_UID']);
|
if ($subProcessParent['SP_SYNCHRONOUS'] == 1 || $subApplication['SA_STATUS'] == 'ACTIVE') {
|
||||||
$dataSet = SubProcessPeer::doSelectRS($criteria);
|
|
||||||
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$dataSet->next();
|
|
||||||
$subApplicationParent = $dataSet->getRow();
|
|
||||||
if ($subApplicationParent['SP_SYNCHRONOUS'] == 1 || $subApplication['SA_STATUS'] == 'ACTIVE') {
|
|
||||||
$appFields = $case->loadCase($applicationUid, $delIndex);
|
$appFields = $case->loadCase($applicationUid, $delIndex);
|
||||||
//Copy case variables to parent case
|
//Copy case variables to parent case
|
||||||
$fields = unserialize($subApplicationParent['SP_VARIABLES_IN']);
|
$fields = unserialize($subProcessParent['SP_VARIABLES_IN']);
|
||||||
$newFields = [];
|
$newFields = $this->getSubProcessVariables($fields, $appFields['APP_DATA'], $parentCase['APP_DATA']);
|
||||||
foreach ($fields as $originField => $targetField) {
|
|
||||||
$originField = str_replace('@', '', $originField);
|
|
||||||
$originField = str_replace('#', '', $originField);
|
|
||||||
$originField = str_replace('%', '', $originField);
|
|
||||||
$originField = str_replace('?', '', $originField);
|
|
||||||
$originField = str_replace('$', '', $originField);
|
|
||||||
$originField = str_replace('=', '', $originField);
|
|
||||||
$targetField = str_replace('@', '', $targetField);
|
|
||||||
$targetField = str_replace('#', '', $targetField);
|
|
||||||
$targetField = str_replace('%', '', $targetField);
|
|
||||||
$targetField = str_replace('?', '', $targetField);
|
|
||||||
$targetField = str_replace('$', '', $targetField);
|
|
||||||
$targetField = str_replace('=', '', $targetField);
|
|
||||||
$newFields[$targetField] = isset($appFields['APP_DATA'][$originField]) ? $appFields['APP_DATA'][$originField] : '';
|
|
||||||
|
|
||||||
if (array_key_exists($originField . '_label', $appFields['APP_DATA'])) {
|
|
||||||
$newFields[$targetField . '_label'] = $appFields['APP_DATA'][$originField . '_label'];
|
|
||||||
} else {
|
|
||||||
if (array_key_exists($targetField . '_label', $parentCase['APP_DATA'])) {
|
|
||||||
$newFields[$targetField . '_label'] = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$parentCase['APP_DATA'] = array_merge($parentCase['APP_DATA'], $newFields);
|
$parentCase['APP_DATA'] = array_merge($parentCase['APP_DATA'], $newFields);
|
||||||
$case->updateCase($subApplication['APP_PARENT'], $parentCase);
|
$case->updateCase($subApplication['APP_PARENT'], $parentCase);
|
||||||
|
|
||||||
@@ -1651,7 +1620,45 @@ class Derivation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* getDerivatedCases
|
/**
|
||||||
|
* Will be get sub process variables
|
||||||
|
* Get variables-in and variables-out
|
||||||
|
*
|
||||||
|
* @param array $fields
|
||||||
|
* @param array $childCaseData
|
||||||
|
* @param array $parentCaseData
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getSubProcessVariables($fields, $childCaseData, $parentCaseData)
|
||||||
|
{
|
||||||
|
$newFields = [];
|
||||||
|
foreach ($fields as $originField => $targetField) {
|
||||||
|
$originField = str_replace('@', '', $originField);
|
||||||
|
$originField = str_replace('#', '', $originField);
|
||||||
|
$originField = str_replace('%', '', $originField);
|
||||||
|
$originField = str_replace('?', '', $originField);
|
||||||
|
$originField = str_replace('$', '', $originField);
|
||||||
|
$originField = str_replace('=', '', $originField);
|
||||||
|
$targetField = str_replace('@', '', $targetField);
|
||||||
|
$targetField = str_replace('#', '', $targetField);
|
||||||
|
$targetField = str_replace('%', '', $targetField);
|
||||||
|
$targetField = str_replace('?', '', $targetField);
|
||||||
|
$targetField = str_replace('$', '', $targetField);
|
||||||
|
$targetField = str_replace('=', '', $targetField);
|
||||||
|
$newFields[$targetField] = isset($childCaseData[$originField]) ? $childCaseData[$originField] : '';
|
||||||
|
|
||||||
|
if (array_key_exists($originField . '_label', $childCaseData)) {
|
||||||
|
$newFields[$targetField . '_label'] = $childCaseData[$originField . '_label'];
|
||||||
|
} elseif (array_key_exists($targetField . '_label', $parentCaseData)) {
|
||||||
|
$newFields[$targetField . '_label'] = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $newFields;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** getDerivatedCases
|
||||||
* get all derivated cases and subcases from any task,
|
* get all derivated cases and subcases from any task,
|
||||||
* this function is useful to know who users have been assigned and what task they do.
|
* this function is useful to know who users have been assigned and what task they do.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -128,5 +128,29 @@ class SubApplication extends BaseSubApplication
|
|||||||
|
|
||||||
return !is_null($dataset);
|
return !is_null($dataset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get information about the subProcess
|
||||||
|
*
|
||||||
|
* @param string $appUid
|
||||||
|
* @param string $status
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
public static function getSubProcessInfo($appUid, $status = 'ACTIVE')
|
||||||
|
{
|
||||||
|
$criteria = new Criteria('workflow');
|
||||||
|
$criteria->add(SubApplicationPeer::APP_UID, $appUid);
|
||||||
|
$criteria->add(SubApplicationPeer::SA_STATUS, $status);
|
||||||
|
$criteria->setLimit(1);
|
||||||
|
$dataSet = SubApplicationPeer::doSelectRS($criteria);
|
||||||
|
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
$result = [];
|
||||||
|
if ($dataSet->next()) {
|
||||||
|
$result = $dataSet->getRow();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -157,5 +157,29 @@ class SubProcess extends BaseSubProcess
|
|||||||
|
|
||||||
return SubProcessPeer::doSelectOne($criteria);
|
return SubProcessPeer::doSelectOne($criteria);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function will be return the configuration in the subProcess
|
||||||
|
*
|
||||||
|
* @param string $proUid
|
||||||
|
* @param string $tasUid
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function getSubProcessConfiguration($proUid, $tasUid)
|
||||||
|
{
|
||||||
|
$criteria = new Criteria('workflow');
|
||||||
|
$criteria->add(SubProcessPeer::PRO_PARENT, $proUid);
|
||||||
|
$criteria->add(SubProcessPeer::TAS_PARENT, $tasUid);
|
||||||
|
$criteria->setLimit(1);
|
||||||
|
$dataSet = SubProcessPeer::doSelectRS($criteria);
|
||||||
|
$dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
$result = [];
|
||||||
|
if ($dataSet->next()) {
|
||||||
|
$result = $dataSet->getRow();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user