Merged in bugfix/HOR-3155 (pull request #5646)

HOR-3155

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Paula Quispe
2017-05-11 18:27:10 +00:00
committed by Julio Cesar Laura Avendaño
3 changed files with 36 additions and 11 deletions

View File

@@ -90,5 +90,26 @@ class SubApplication extends BaseSubApplication
throw($oError);
}
}
/**
* This function is relate to subprocess, verify is parent case had create a case
* This is relevant for SYNCHRONOUS subprocess
* @param string $appUid
* @param integer $delIndex
* @return boolean
*/
public function isSubProcessWithCasePending($appUid, $delIndex){
$oCriteria = new Criteria('workflow');
$oCriteria->add(SubApplicationPeer::APP_PARENT, $appUid);
$oCriteria->add(SubApplicationPeer::DEL_INDEX_PARENT, $delIndex);
$oCriteria->add(SubApplicationPeer::SA_STATUS, 'ACTIVE');
$oDataset = SubApplicationPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
if ($oDataset->next()) {
return true;
}
return false;
}
}

View File

@@ -90,7 +90,13 @@ try {
case 'DRAFT':
case 'TO_DO':
//Check if the case is in pause, check a valid record in table APP_DELAY
if (AppDelay::isPaused( $sAppUid, $iDelIndex )) {
$isPaused = AppDelay::isPaused($sAppUid, $iDelIndex);
//Check if the case is a waiting for a SYNCHRONOUS subprocess
$subAppData = new \SubApplication();
$caseSubprocessPending = $subAppData->isSubProcessWithCasePending($sAppUid, $iDelIndex);
if ($isPaused || $caseSubprocessPending) {
//the case is paused show only the resume
$_SESSION['APPLICATION'] = $sAppUid;
$_SESSION['INDEX'] = $iDelIndex;
@@ -109,19 +115,11 @@ try {
if ($_action == 'search') {
//verify if the case is with the current user
$c = new Criteria( 'workflow' );
$c->add( AppDelegationPeer::APP_UID, $sAppUid );
$c->add( AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN' );
$c->add( AppDelegationPeer::DEL_INDEX, $iDelIndex );
$oDataset = AppDelegationPeer::doSelectRs( $c );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$aData = $oDataset->getRow();
if ($aData['USR_UID'] !== $_SESSION['USER_LOGGED'] && $aData['USR_UID'] !== '') {
$aData = AppDelegation::getCurrentUsers($sAppUid, $iDelIndex);
if ($aData['USR_UID'] !== $_SESSION['USER_LOGGED'] && !empty($aData['USR_UID'])) {
//distinct "" for selfservice
//so we show just the resume
$_SESSION['alreadyDerivated'] = true;
//the case is paused show only the resume
$_SESSION['APPLICATION'] = $sAppUid;
$_SESSION['INDEX'] = $iDelIndex;
$_SESSION['PROCESS'] = $aFields['PRO_UID'];

View File

@@ -1095,6 +1095,12 @@ class Cases
try {
if (!$delIndex) {
$delIndex = \AppDelegation::getCurrentIndex($applicationUid);
//Check if the next task is a subprocess SYNCHRONOUS with a thread Open
$subAppData = new \SubApplication();
$caseSubprocessPending = $subAppData->isSubProcessWithCasePending($applicationUid, $delIndex);
if ($caseSubprocessPending) {
throw (new \Exception(\G::LoadTranslation("ID_CASE_ALREADY_DERIVATED")));
}
}
\G::LoadClass('wsBase');
$ws = new \wsBase();