BUG 8467 "Regla de derivación en paralelo no funciona correc..." SOLVED
- it was happening with forks with conditional in one at all threads - the solution was complete an unhandled condition on the original code - other problem was found when a thread has not completely started, producing a warning, was solved. - at the same time the code was improved modulating a section of the code in a function that is called twice
This commit is contained in:
@@ -1153,86 +1153,100 @@ class Cases {
|
|||||||
$aTaskReviewed = array();
|
$aTaskReviewed = array();
|
||||||
|
|
||||||
//check if this task ( $taskUid ) has open delegations
|
//check if this task ( $taskUid ) has open delegations
|
||||||
$oCriteria2 = new Criteria('workflow');
|
$delegations = $this->getReviewedTasks($taskUid, $sAppUid);
|
||||||
$oCriteria2->add(AppDelegationPeer::APP_UID, $sAppUid);
|
|
||||||
$oCriteria2->add(AppDelegationPeer::TAS_UID, $taskUid);
|
if ($delegations !== false) {
|
||||||
$oCriteria2->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
|
if ( count($aTaskReviewed['open']) > 0) {
|
||||||
$oDataset2 = AppDelegationPeer::doSelectRs($oCriteria2);
|
//there is an open delegation, so we need to return the delegation row
|
||||||
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
return $aTaskReviewed['open'];
|
||||||
$oDataset2->next();
|
}
|
||||||
$aRow2 = $oDataset2->getRow();
|
else {
|
||||||
if (is_array($aRow2)) {
|
return array(); //returning empty array
|
||||||
//there is an open delegation, so we need to return the delegation row
|
|
||||||
$aTaskReviewed[] = $aRow2;
|
|
||||||
return $aTaskReviewed;
|
|
||||||
} else {
|
|
||||||
$oCriteria3 = new Criteria('workflow');
|
|
||||||
$oCriteria3->add(AppDelegationPeer::APP_UID, $sAppUid);
|
|
||||||
$oCriteria3->add(AppDelegationPeer::TAS_UID, $taskUid);
|
|
||||||
$oDataset3 = AppDelegationPeer::doSelectRs($oCriteria3);
|
|
||||||
$oDataset3->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$oDataset3->next();
|
|
||||||
$aRow3 = $oDataset3->getRow();
|
|
||||||
if (is_array($aRow3)) {
|
|
||||||
return $aTaskReviewed; //returning empty array
|
|
||||||
} else { //if not we check previous tasks
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// if not we check previous tasks
|
||||||
|
// until here this task has not appdelegations records.
|
||||||
|
// get all previous task from $taskUid, and return open delegations rows, if there are
|
||||||
|
|
||||||
|
|
||||||
//get all previous task from $taskUid, and return open delegations rows, if there are
|
|
||||||
$oCriteria = new Criteria('workflow');
|
$oCriteria = new Criteria('workflow');
|
||||||
$oCriteria->add(RoutePeer::ROU_NEXT_TASK, $taskUid);
|
$oCriteria->add(RoutePeer::ROU_NEXT_TASK, $taskUid);
|
||||||
$oDataset = RoutePeer::doSelectRs($oCriteria);
|
$oDataset = RoutePeer::doSelectRs($oCriteria);
|
||||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
$aRow = $oDataset->getRow();
|
$aRow = $oDataset->getRow();
|
||||||
|
|
||||||
while (is_array($aRow)) {
|
while (is_array($aRow)) {
|
||||||
|
$delegations = $this->getReviewedTasks($aRow['TAS_UID'], $sAppUid);
|
||||||
|
|
||||||
$oCriteria2 = new Criteria('workflow');
|
if ($delegations !== false) {
|
||||||
$oCriteria2->add(AppDelegationPeer::APP_UID, $sAppUid);
|
if ( count($aTaskReviewed['open']) > 0) {
|
||||||
$oCriteria2->add(AppDelegationPeer::TAS_UID, $aRow['TAS_UID']);
|
//there is an open delegation, so we need to return the delegation row
|
||||||
$oCriteria2->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
|
$aTaskReviewed = array_merge($aTaskReviewed, $aTaskReviewed['open']);
|
||||||
$oDataset2 = AppDelegationPeer::doSelectRs($oCriteria2);
|
}
|
||||||
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
else {
|
||||||
$oDataset2->next();
|
$aTaskReviewed = array_merge($aTaskReviewed, $aTaskReviewed['closed']);
|
||||||
$aRow2 = $oDataset2->getRow();
|
}
|
||||||
if (is_array($aRow2)) {
|
}
|
||||||
//there is an open delegation, so we need to return the delegation row
|
else {
|
||||||
$aTaskReviewed[] = $aRow2;
|
if (!in_array($aRow['TAS_UID'], $aPreviousTasks)) {
|
||||||
} else {
|
// storing the current task uid of the task currently checked
|
||||||
$oCriteria3 = new Criteria('workflow');
|
$aPreviousTasks[] = $aRow['TAS_UID'];
|
||||||
$oCriteria3->add(AppDelegationPeer::APP_UID, $sAppUid);
|
// passing the array of previous tasks in oprder to avoid an infinite loop that prevents
|
||||||
$oCriteria3->add(AppDelegationPeer::TAS_UID, $aRow['TAS_UID']);
|
$openPreviousTask = $this->searchOpenPreviousTasks($aRow['TAS_UID'], $sAppUid, $aPreviousTasks);
|
||||||
$oDataset3 = AppDelegationPeer::doSelectRs($oCriteria3);
|
|
||||||
$oDataset3->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
|
||||||
$oDataset3->next();
|
|
||||||
$aRow3 = $oDataset3->getRow();
|
|
||||||
if (is_array($aRow3)) {
|
|
||||||
//TODO there are closed delegations, so we need to get back without returning delegation rows
|
|
||||||
}
|
|
||||||
else { //if not we start the recursion searching previous open tasks from this task.
|
|
||||||
if (!in_array($aRow['TAS_UID'],$aPreviousTasks)) {
|
|
||||||
// storing the current task uid of the task currently checked
|
|
||||||
$aPreviousTasks[] = $aRow['TAS_UID'];
|
|
||||||
// passing the array of previous tasks in oprder to avoid an infinite loop that prevents
|
|
||||||
|
|
||||||
$openPreviousTask = $this->searchOpenPreviousTasks($aRow['TAS_UID'], $sAppUid, $aPreviousTasks);
|
|
||||||
|
|
||||||
if (count($previousTasks) > 0) {
|
if (count($aPreviousTasks) > 0) {
|
||||||
array_push($aTaskReviewed, $openPreviousTask);
|
$aTaskReviewed = array_merge($aTaskReviewed, $openPreviousTask);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//$this->searchOpenPreviousTasks();
|
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
$aRow = $oDataset->getRow();
|
$aRow = $oDataset->getRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $aTaskReviewed;
|
return $aTaskReviewed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get reviewed tasks (delegations started)
|
||||||
|
* @param string $taskUid
|
||||||
|
* @param string $sAppUid
|
||||||
|
* @author erik amaru ortiz <erik@colosa.com>
|
||||||
|
* @return array within the open & closed tasks
|
||||||
|
* false -> when has not any delegation started for that task
|
||||||
|
*/
|
||||||
|
function getReviewedTasks($taskUid, $sAppUid)
|
||||||
|
{
|
||||||
|
$openTasks = $closedTasks = array();
|
||||||
|
|
||||||
|
// get all delegations fro this task
|
||||||
|
$oCriteria2 = new Criteria('workflow');
|
||||||
|
$oCriteria2->add(AppDelegationPeer::APP_UID, $sAppUid);
|
||||||
|
$oCriteria2->add(AppDelegationPeer::TAS_UID, $taskUid);
|
||||||
|
|
||||||
|
$oDataset2 = AppDelegationPeer::doSelectRs($oCriteria2);
|
||||||
|
$oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
// loop and separate open & closed delegations in theirs respective arrays
|
||||||
|
while ($oDataset2->next()) {
|
||||||
|
$row = $oDataset2->getRow();
|
||||||
|
|
||||||
|
if ($row['DEL_THREAD_STATUS'] == 'OPEN') {
|
||||||
|
$tasksReviewed[] = $row;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$closedTasks[] = $row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($openTasks) == 0 && count($closedTasks) == 0) {
|
||||||
|
return false; // return false because there is not any delegation for this task.
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return array('open' => $openTasks, 'closed' => $closedTasks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This function returns the total number of previous task
|
* This function returns the total number of previous task
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user