HOR-2779
This commit is contained in:
@@ -3302,4 +3302,31 @@ class Cases
|
||||
|
||||
return $arrayAccess;
|
||||
}
|
||||
/**
|
||||
* Get index last participation from a user
|
||||
*
|
||||
* This function return the last participation
|
||||
* by default is not considered the status OPEN or CLOSED
|
||||
* in parallel cases return the first to find
|
||||
* @param string $appUid
|
||||
* @param string $userUid
|
||||
* @param string $threadStatus
|
||||
* @return integer delIndex
|
||||
*/
|
||||
public function getLastParticipatedByUser($appUid, $userUid, $threadStatus = '')
|
||||
{
|
||||
$criteria = new \Criteria('workflow');
|
||||
$criteria->addSelectColumn(\ListParticipatedLastPeer::DEL_INDEX);
|
||||
$criteria->addSelectColumn(\ListParticipatedLastPeer::DEL_THREAD_STATUS);
|
||||
$criteria->add(\ListParticipatedLastPeer::APP_UID, $appUid, \Criteria::EQUAL);
|
||||
$criteria->add(\ListParticipatedLastPeer::USR_UID, $userUid, \Criteria::EQUAL);
|
||||
if (!empty($threadStatus)) {
|
||||
$criteria->add(\ListParticipatedLastPeer::DEL_THREAD_STATUS, $threadStatus, \Criteria::EQUAL);
|
||||
}
|
||||
$dataSet = \ListParticipatedLastPeer::doSelectRS($criteria);
|
||||
$dataSet->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$dataSet->next();
|
||||
$row = $dataSet->getRow();
|
||||
return isset($row['DEL_INDEX']) ? $row['DEL_INDEX'] : 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -825,7 +825,17 @@ class Light
|
||||
case 'participated':
|
||||
$oCase = new \Cases();
|
||||
$iDelIndex = $oCase->getCurrentDelegationCase( $app_uid );
|
||||
$aFields = $oCase->loadCase( $app_uid, $iDelIndex );
|
||||
$aFields = $oCase->loadCase($app_uid, $iDelIndex);
|
||||
$response = $this->getInfoResume($userUid, $aFields, $type);
|
||||
break;
|
||||
case 'lastopenindex':
|
||||
//Get the last participate from a user
|
||||
$oNewCase = new \ProcessMaker\BusinessModel\Cases();
|
||||
$iDelIndex = $oNewCase->getLastParticipatedByUser($app_uid, $userUid, 'OPEN');
|
||||
$oCase = new \Cases();
|
||||
$aFields = $oCase->loadCase($app_uid, $iDelIndex);
|
||||
$aFields['DEL_INDEX'] = $iDelIndex === 0 ? '' : $iDelIndex;
|
||||
$aFields['USR_UID'] = $userUid;
|
||||
$response = $this->getInfoResume($userUid, $aFields, $type);
|
||||
break;
|
||||
}
|
||||
@@ -842,23 +852,8 @@ class Light
|
||||
*/
|
||||
public function getInfoResume($userUid, $Fields, $type)
|
||||
{
|
||||
//print_r($Fields);die;
|
||||
/* Includes */
|
||||
G::LoadClass( 'case' );
|
||||
/* Prepare page before to show */
|
||||
//$oCase = new \Cases();
|
||||
|
||||
// $participated = $oCase->userParticipatedInCase( $Fields['APP_UID'], $userUid );
|
||||
// if ($RBAC->userCanAccess( 'PM_ALLCASES' ) < 0 && $participated == 0) {
|
||||
// /*if (strtoupper($Fields['APP_STATUS']) != 'COMPLETED') {
|
||||
// $oCase->thisIsTheCurrentUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'SHOW_MESSAGE');
|
||||
// }*/
|
||||
// $aMessage['MESSAGE'] = G::LoadTranslation( 'ID_NO_PERMISSION_NO_PARTICIPATED' );
|
||||
// $G_PUBLISH = new Publisher();
|
||||
// $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
|
||||
// G::RenderPage( 'publishBlank', 'blank' );
|
||||
// die();
|
||||
// }
|
||||
G::LoadClass( 'case' );
|
||||
|
||||
$objProc = new \Process();
|
||||
$aProc = $objProc->load( $Fields['PRO_UID'] );
|
||||
@@ -876,15 +871,11 @@ class Light
|
||||
}
|
||||
|
||||
$Fields['TAS_TITLE'] = implode(" - ", array_values($Fields['TAS_TITLE']));
|
||||
} else {
|
||||
$aTask = $objTask->load( $Fields['TAS_UID'] );
|
||||
} elseif (isset($Fields['TAS_UID']) && !empty($Fields['TAS_UID'])) {
|
||||
$aTask = $objTask->load($Fields['TAS_UID']);
|
||||
$Fields['TAS_TITLE'] = $aTask['TAS_TITLE'];
|
||||
}
|
||||
|
||||
// require_once(PATH_GULLIVER .'../thirdparty/smarty/libs/Smarty.class.php');
|
||||
// $G_PUBLISH = new \Publisher();
|
||||
// $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Resume.xml', '', $Fields, '' );
|
||||
// $G_PUBLISH->RenderContent();
|
||||
return $Fields;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user