Merged in bugfix/HOR-2810 (pull request #5487)

HOR-2810

Approved-by: Julio Cesar Laura Avendaño
Approved-by: Paula Quispe
This commit is contained in:
Paula Quispe
2017-03-06 20:32:55 +00:00
committed by Julio Cesar Laura Avendaño
3 changed files with 37 additions and 1 deletions

View File

@@ -3338,4 +3338,37 @@ class Cases
$row = $dataSet->getRow();
return isset($row['DEL_INDEX']) ? $row['DEL_INDEX'] : 0;
}
/**
* Get last index, we can considering the pause thread
*
* This function return the last index thread and will be considered the paused cases
* Is created by Jump to and redirect the correct thread
* by default is not considered the paused thread
* in parallel cases return the first thread to find
* @param string $appUid
* @param boolean $checkCaseIsPaused
* @return integer delIndex
*/
public function getOneLastThread($appUid, $checkCaseIsPaused = false)
{
$criteria = new \Criteria('workflow');
$criteria->addSelectColumn(\AppDelegationPeer::DEL_INDEX);
$criteria->addSelectColumn(\AppDelegationPeer::DEL_THREAD_STATUS);
$criteria->add(\AppDelegationPeer::APP_UID, $appUid, \Criteria::EQUAL);
$dataSet = \AppDelegationPeer::doSelectRS($criteria);
$dataSet->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$dataSet->next();
$row = $dataSet->getRow();
$delIndex = 0;
while (is_array($row)) {
$delIndex = $row['DEL_INDEX'];
if ($checkCaseIsPaused && \AppDelay::isPaused($appUid, $delIndex)) {
return $delIndex;
}
$dataSet->next();
$row = $dataSet->getRow();
}
return $delIndex;
}
}