This commit is contained in:
Julio Cesar Laura Avendaño
2017-06-12 16:41:09 -04:00
parent 5a64fc4dcf
commit ce3de33b0e
2 changed files with 5 additions and 3 deletions

View File

@@ -3347,7 +3347,7 @@ class Cases
* @return integer * @return integer
*/ */
public function getCurrentDelegation($sApplicationUID = '', $sUserUID = '') public function getCurrentDelegation($sApplicationUID = '', $sUserUID = '', $onlyOpenThreads = false)
{ {
$oCriteria = new Criteria(); $oCriteria = new Criteria();
$oCriteria->add(AppDelegationPeer::APP_UID, $sApplicationUID); $oCriteria->add(AppDelegationPeer::APP_UID, $sApplicationUID);
@@ -3362,7 +3362,9 @@ class Cases
//if the user is not in the task, we need to return a valid del index, so we are returning the latest delindex //if the user is not in the task, we need to return a valid del index, so we are returning the latest delindex
$oCriteria = new Criteria(); $oCriteria = new Criteria();
$oCriteria->add(AppDelegationPeer::APP_UID, $sApplicationUID); $oCriteria->add(AppDelegationPeer::APP_UID, $sApplicationUID);
$oCriteria->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN'); if ($onlyOpenThreads) {
$oCriteria->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN');
}
$oCriteria->addDescendingOrderByColumn(AppDelegationPeer::DEL_DELEGATE_DATE); $oCriteria->addDescendingOrderByColumn(AppDelegationPeer::DEL_DELEGATE_DATE);
$oApplication = AppDelegationPeer::doSelectOne($oCriteria); $oApplication = AppDelegationPeer::doSelectOne($oCriteria);
if (!is_null($oApplication)) { if (!is_null($oApplication)) {

View File

@@ -1013,7 +1013,7 @@ class Light
{ {
$response = array("status" => "fail"); $response = array("status" => "fail");
$oCase = new \Cases(); $oCase = new \Cases();
$iDelIndex = $oCase->getCurrentDelegation( $sAppUid, '' ); $iDelIndex = $oCase->getCurrentDelegation( $sAppUid, '', true );
$oAppDelegation = new \AppDelegation(); $oAppDelegation = new \AppDelegation();
$aDelegation = $oAppDelegation->load( $sAppUid, $iDelIndex ); $aDelegation = $oAppDelegation->load( $sAppUid, $iDelIndex );