HOR-771
This commit is contained in:
@@ -1750,12 +1750,13 @@ class Cases
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function newAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sPrevious, $iPriority, $sDelType, $iAppThreadIndex = 1, $nextDel = null, $flagControl = false)
|
||||
public function newAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sPrevious, $iPriority, $sDelType, $iAppThreadIndex = 1, $nextDel = null, $flagControl = false, $flagControlMulInstance = false, $delPrevious = 0)
|
||||
{
|
||||
try {
|
||||
$appDel = new AppDelegation();
|
||||
$result = $appDel->createAppDelegation(
|
||||
$sProUid, $sAppUid, $sTasUid, $sUsrUid, $iAppThreadIndex, $iPriority, false, $sPrevious, $nextDel, $flagControl
|
||||
$sProUid, $sAppUid, $sTasUid, $sUsrUid, $iAppThreadIndex, $iPriority, false, $sPrevious, $nextDel, $flagControl,
|
||||
$flagControlMulInstance, $delPrevious
|
||||
);
|
||||
//update searchindex
|
||||
if ($this->appSolr != null) {
|
||||
|
||||
@@ -49,6 +49,7 @@ class Derivation
|
||||
{
|
||||
var $case;
|
||||
protected $flagControl;
|
||||
protected $flagControlMulInstance;
|
||||
|
||||
/**
|
||||
* prepareInformationTask
|
||||
@@ -1136,7 +1137,11 @@ class Derivation
|
||||
}
|
||||
$canDerivate = empty($arrayOpenThread);
|
||||
if($canDerivate){
|
||||
$this->flagControl = true;
|
||||
if($flagTaskIsMultipleInstance && $flagTaskAssignTypeIsMultipleInstance){
|
||||
$this->flagControlMulInstance = true;
|
||||
}else{
|
||||
$this->flagControl = true;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -1385,8 +1390,19 @@ class Derivation
|
||||
$this->setTasLastAssigned( $nextDel['TAS_UID'], $nextDel['USR_UID'] );
|
||||
//No Break, need no execute the default ones....
|
||||
default:
|
||||
$delPrevious = 0;
|
||||
if($this->flagControlMulInstance){
|
||||
$criteriaMulti = new Criteria("workflow");
|
||||
$criteriaMulti->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS);
|
||||
$criteriaMulti->add(AppDelegationPeer::TAS_UID, $currentDelegation['TAS_UID'], Criteria::EQUAL);
|
||||
$criteriaMultiR = AppDelegationPeer::doSelectRS($criteriaMulti);
|
||||
$criteriaMultiR->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$criteriaMultiR->next();
|
||||
$row = $criteriaMultiR->getRow();
|
||||
$delPrevious = $row['DEL_PREVIOUS'];
|
||||
}
|
||||
// Create new delegation
|
||||
$iNewDelIndex = $this->case->newAppDelegation( $appFields['PRO_UID'], $currentDelegation['APP_UID'], $nextDel['TAS_UID'], (isset( $nextDel['USR_UID'] ) ? $nextDel['USR_UID'] : ''), $currentDelegation['DEL_INDEX'], $nextDel['DEL_PRIORITY'], $delType, $iAppThreadIndex, $nextDel, $this->flagControl );
|
||||
$iNewDelIndex = $this->case->newAppDelegation( $appFields['PRO_UID'], $currentDelegation['APP_UID'], $nextDel['TAS_UID'], (isset( $nextDel['USR_UID'] ) ? $nextDel['USR_UID'] : ''), $currentDelegation['DEL_INDEX'], $nextDel['DEL_PRIORITY'], $delType, $iAppThreadIndex, $nextDel, $this->flagControl, $this->flagControlMulInstance, $delPrevious);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ class AppDelegation extends BaseAppDelegation
|
||||
* @param $isSubprocess is a subprocess inside a process?
|
||||
* @return delegation index of the application delegation.
|
||||
*/
|
||||
public function createAppDelegation ($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sAppThread, $iPriority = 3, $isSubprocess = false, $sPrevious = -1, $sNextTasParam = null, $flagControl = false)
|
||||
public function createAppDelegation ($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sAppThread, $iPriority = 3, $isSubprocess = false, $sPrevious = -1, $sNextTasParam = null, $flagControl = false, $flagControlMulInstance = false, $delPrevious = 0)
|
||||
{
|
||||
if (! isset( $sProUid ) || strlen( $sProUid ) == 0) {
|
||||
throw (new Exception( 'Column "PRO_UID" cannot be null.' ));
|
||||
@@ -121,6 +121,14 @@ class AppDelegation extends BaseAppDelegation
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if($flagControlMulInstance){
|
||||
$nextTaskUid = $sTasUid;
|
||||
$index = $this->getAllTheardMultipleInstance($delPrevious, $sAppUid);
|
||||
if($this->createThread($index, $sAppUid)){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Update set
|
||||
$criteriaUpdate = new Criteria('workflow');
|
||||
@@ -794,5 +802,28 @@ class AppDelegation extends BaseAppDelegation
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all Threads for Multiple Instance
|
||||
*
|
||||
* @param string $sPrevious
|
||||
* @param string $sAppUid
|
||||
* @return array $index
|
||||
*/
|
||||
public static function getAllTheardMultipleInstance($sPrevious, $sAppUid){
|
||||
$criteriaR = new Criteria('workflow');
|
||||
$criteriaR->addSelectColumn(AppDelegationPeer::DEL_INDEX);
|
||||
$criteriaR->add(AppDelegationPeer::APP_UID, $sAppUid, Criteria::EQUAL);
|
||||
$criteriaR->add(AppDelegationPeer::DEL_PREVIOUS, $sPrevious, Criteria::EQUAL);
|
||||
$rsCriteriaR = AppDelegationPeer::doSelectRS($criteriaR);
|
||||
$rsCriteriaR->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$index = array();
|
||||
$c = 0;
|
||||
while($rsCriteriaR->next()){
|
||||
$row = $rsCriteriaR->getRow();
|
||||
$index[$c++] = $row['DEL_INDEX'];
|
||||
}
|
||||
return $index;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user