Ajustes clase Activity, se agregan validaciones, se modifica catch exception, variable a camelcase
This commit is contained in:
@@ -546,15 +546,18 @@ class Task
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a assignee list of an activity
|
* Return a assignee list of an activity
|
||||||
*
|
*
|
||||||
* @param string $sProcessUID
|
* @param string $sProcessUID
|
||||||
* @param string $sTaskUID
|
* @param string $sTaskUID
|
||||||
|
* @param string $filter
|
||||||
|
* @param int $start
|
||||||
|
* @param int $limit
|
||||||
*
|
*
|
||||||
* return array
|
* return array
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function getTaskAssignees($sProcessUID, $sTaskUID)
|
public function getTaskAssignees($sProcessUID, $sTaskUID, $filter, $start, $limit)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$aUsers = array();
|
$aUsers = array();
|
||||||
@@ -566,7 +569,6 @@ class Task
|
|||||||
$oCriteria->addSelectColumn(\TaskUserPeer::TU_TYPE);
|
$oCriteria->addSelectColumn(\TaskUserPeer::TU_TYPE);
|
||||||
$oCriteria->addSelectColumn(\TaskUserPeer::TU_RELATION);
|
$oCriteria->addSelectColumn(\TaskUserPeer::TU_RELATION);
|
||||||
$oCriteria->addAlias('C', 'CONTENT');
|
$oCriteria->addAlias('C', 'CONTENT');
|
||||||
|
|
||||||
$aConditions = array();
|
$aConditions = array();
|
||||||
$aConditions[] = array(\TaskUserPeer::USR_UID, 'C.CON_ID' );
|
$aConditions[] = array(\TaskUserPeer::USR_UID, 'C.CON_ID' );
|
||||||
$aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'GRP_TITLE' . $sDelimiter );
|
$aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'GRP_TITLE' . $sDelimiter );
|
||||||
@@ -596,8 +598,8 @@ class Task
|
|||||||
}
|
}
|
||||||
$aUsers[] = array('aas_uid' => $aRow['USR_UID'],
|
$aUsers[] = array('aas_uid' => $aRow['USR_UID'],
|
||||||
'aas_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $aRow['GRP_TITLE'] .
|
'aas_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $aRow['GRP_TITLE'] .
|
||||||
' (' . $aRow2['MEMBERS_NUMBER'] .
|
' (' . $aRow2['MEMBERS_NUMBER'] . ' ' .
|
||||||
' ' . ((int) $aRow2['MEMBERS_NUMBER'] == 1 ? \G::LoadTranslation('ID_USER') : \G::LoadTranslation('ID_USERS')) .
|
((int) $aRow2['MEMBERS_NUMBER'] == 1 ? \G::LoadTranslation('ID_USER') : \G::LoadTranslation('ID_USERS')) .
|
||||||
')' . '' : $aRow['GRP_TITLE'] . ' ' . $aRow2['GROUP_INACTIVE']),
|
')' . '' : $aRow['GRP_TITLE'] . ' ' . $aRow2['GROUP_INACTIVE']),
|
||||||
'aas_lastname' => "",
|
'aas_lastname' => "",
|
||||||
'aas_username' => "",
|
'aas_username' => "",
|
||||||
@@ -639,13 +641,15 @@ class Task
|
|||||||
*
|
*
|
||||||
* @param string $sProcessUID
|
* @param string $sProcessUID
|
||||||
* @param string $sTaskUID
|
* @param string $sTaskUID
|
||||||
|
* @param string $filter
|
||||||
|
* @param int $start
|
||||||
|
* @param int $limit
|
||||||
*
|
*
|
||||||
* return array
|
* return array
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
public function getTaskAvailableAssignee($sProcessUID, $sTaskUID, $filter, $start, $limit)
|
||||||
public function getTaskAvailableAssignee($sProcessUID, $sTaskUID)
|
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$iType = 1;
|
$iType = 1;
|
||||||
@@ -681,9 +685,9 @@ class Task
|
|||||||
$aRow2 = $oDataset2->getRow();
|
$aRow2 = $oDataset2->getRow();
|
||||||
$aUsers[] = array('aas_uid' => $results['GRP_UID'],
|
$aUsers[] = array('aas_uid' => $results['GRP_UID'],
|
||||||
'aas_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $results['GRP_TITLE'] .
|
'aas_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $results['GRP_TITLE'] .
|
||||||
' (' . $aRow2['MEMBERS_NUMBER'] .
|
' (' . $aRow2['MEMBERS_NUMBER'] . ' ' .
|
||||||
' ' . ((int) $aRow2['MEMBERS_NUMBER'] == 1 ? \G::LoadTranslation('ID_USER') : \G::LoadTranslation('ID_USERS')) .
|
((int) $aRow2['MEMBERS_NUMBER'] == 1 ? \G::LoadTranslation('ID_USER') : \G::LoadTranslation('ID_USERS')) .
|
||||||
')' . '' : $aRow['GRP_TITLE'] . ' ' . $aRow2['GROUP_INACTIVE']),
|
')' . '' : $aRow['GRP_TITLE'] . ' ' . $aRow2['GROUP_INACTIVE']),
|
||||||
'aas_lastname' => "",
|
'aas_lastname' => "",
|
||||||
'aas_username' => "",
|
'aas_username' => "",
|
||||||
'aas_type' => "group" );
|
'aas_type' => "group" );
|
||||||
@@ -717,7 +721,7 @@ class Task
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a single user or group assigned to an activity
|
* Return a single user or group assigned to an activity
|
||||||
*
|
*
|
||||||
* @param string $sProcessUID
|
* @param string $sProcessUID
|
||||||
* @param string $sTaskUID
|
* @param string $sTaskUID
|
||||||
* @param string $sAssigneeUID
|
* @param string $sAssigneeUID
|
||||||
@@ -739,7 +743,6 @@ class Task
|
|||||||
$oCriteria->addSelectColumn(\TaskUserPeer::TU_TYPE);
|
$oCriteria->addSelectColumn(\TaskUserPeer::TU_TYPE);
|
||||||
$oCriteria->addSelectColumn(\TaskUserPeer::TU_RELATION);
|
$oCriteria->addSelectColumn(\TaskUserPeer::TU_RELATION);
|
||||||
$oCriteria->addAlias('C', 'CONTENT');
|
$oCriteria->addAlias('C', 'CONTENT');
|
||||||
|
|
||||||
$aConditions = array();
|
$aConditions = array();
|
||||||
$aConditions[] = array(\TaskUserPeer::USR_UID, 'C.CON_ID' );
|
$aConditions[] = array(\TaskUserPeer::USR_UID, 'C.CON_ID' );
|
||||||
$aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'GRP_TITLE' . $sDelimiter );
|
$aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'GRP_TITLE' . $sDelimiter );
|
||||||
@@ -770,8 +773,8 @@ class Task
|
|||||||
}
|
}
|
||||||
$aUsers = array('aas_uid' => $aRow['USR_UID'],
|
$aUsers = array('aas_uid' => $aRow['USR_UID'],
|
||||||
'aas_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $aRow['GRP_TITLE'] .
|
'aas_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $aRow['GRP_TITLE'] .
|
||||||
' (' . $aRow2['MEMBERS_NUMBER'] .
|
' (' . $aRow2['MEMBERS_NUMBER'] . ' ' .
|
||||||
' ' . ((int) $aRow2['MEMBERS_NUMBER'] == 1 ? \G::LoadTranslation('ID_USER') : \G::LoadTranslation('ID_USERS')) .
|
((int) $aRow2['MEMBERS_NUMBER'] == 1 ? \G::LoadTranslation('ID_USER') : \G::LoadTranslation('ID_USERS')) .
|
||||||
')' . '' : $aRow['GRP_TITLE'] . ' ' . $aRow2['GROUP_INACTIVE']),
|
')' . '' : $aRow['GRP_TITLE'] . ' ' . $aRow2['GROUP_INACTIVE']),
|
||||||
'aas_lastname' => "",
|
'aas_lastname' => "",
|
||||||
'aas_username' => "",
|
'aas_username' => "",
|
||||||
@@ -811,35 +814,35 @@ class Task
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign a user or group to an activity
|
* Assign a user or group to an activity
|
||||||
*
|
*
|
||||||
* @param string $sProcessUID
|
* @param string $sProcessUID
|
||||||
* @param string $sTaskUID
|
* @param string $sTaskUID
|
||||||
* @param string $sAssigneeUID
|
* @param string $sAssigneeUID
|
||||||
* @param int $sRelation
|
* @param string $assType {@choice user,group}
|
||||||
*
|
*
|
||||||
* return array
|
* return array
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function postTaskAssignee($sProcessUID, $sTaskUID, $sAssigneeUID, $sRelation)
|
public function addTaskAssignee($sProcessUID, $sTaskUID, $sAssigneeUID, $assType)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$iType = 1;
|
$iType = 1;
|
||||||
$oTaskUser = new \TaskUser();
|
$oTaskUser = new \TaskUser();
|
||||||
if ($sRelation == 1) {
|
if ($assType == "user") {
|
||||||
$oTaskUser->create(array('TAS_UID' => $sTaskUID,
|
$oTaskUser->create(array('TAS_UID' => $sTaskUID,
|
||||||
'USR_UID' => $sAssigneeUID,
|
'USR_UID' => $sAssigneeUID,
|
||||||
'TU_TYPE' => $iType,
|
'TU_TYPE' => $iType,
|
||||||
'TU_RELATION' => $sRelation));
|
'TU_RELATION' => 1));
|
||||||
return array('aas_uid' => $sAssigneeUID,
|
return array('aas_uid' => $sAssigneeUID,
|
||||||
'aas_type' => "user");
|
'aas_type' => $assType);
|
||||||
} else {
|
} else {
|
||||||
$oTaskUser->create(array('TAS_UID' => $sTaskUID,
|
$oTaskUser->create(array('TAS_UID' => $sTaskUID,
|
||||||
'USR_UID' => $sAssigneeUID,
|
'USR_UID' => $sAssigneeUID,
|
||||||
'TU_TYPE' => $iType,
|
'TU_TYPE' => $iType,
|
||||||
'TU_RELATION' => $sRelation));
|
'TU_RELATION' => 2));
|
||||||
return array('aas_uid' => $sAssigneeUID,
|
return array('aas_uid' => $sAssigneeUID,
|
||||||
'aas_type' => "group");
|
'aas_type' => $assType);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
@@ -848,26 +851,34 @@ class Task
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a assignee of an activity
|
* Remove a assignee of an activity
|
||||||
*
|
*
|
||||||
* @param string $sProcessUID
|
* @param string $sProcessUID
|
||||||
* @param string $sTaskUID
|
* @param string $sTaskUID
|
||||||
* @param string $sAssigneeUID
|
* @param string $sAssigneeUID
|
||||||
* @param int $sRelation
|
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function deleteTaskAssignee($sProcessUID, $sTaskUID, $sAssigneeUID, $sRelation)
|
public function removeTaskAssignee($sProcessUID, $sTaskUID, $sAssigneeUID)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$iType = 1;
|
$iType = 1;
|
||||||
$oTaskUser = new \TaskUser();
|
$oCriteria = new \Criteria('workflow');
|
||||||
|
$oCriteria->addSelectColumn( \TaskUserPeer::TU_RELATION );
|
||||||
if ($sRelation == 1) {
|
$oCriteria->add(\TaskUserPeer::USR_UID, $sAssigneeUID);
|
||||||
$oTaskUser->remove($sTaskUID, $sAssigneeUID, $iType, $sRelation);
|
$oCriteria->add(\TaskUserPeer::TAS_UID, $sTaskUID);
|
||||||
} else {
|
$oCriteria->add(\TaskUserPeer::TU_TYPE, $iType);
|
||||||
$oTaskUser->remove($sTaskUID, $sAssigneeUID, $iType, $sRelation);
|
$oTaskUser = \TaskUserPeer::doSelectRS($oCriteria);
|
||||||
|
$oTaskUser->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
while ($oTaskUser->next()) {
|
||||||
|
$aRow = $oTaskUser->getRow();
|
||||||
|
$iRelation = $aRow['TU_RELATION'];
|
||||||
|
}
|
||||||
|
$oTaskUser = \TaskUserPeer::retrieveByPK($sTaskUID, $sAssigneeUID, $iType, $iRelation);
|
||||||
|
if (! is_null( $oTaskUser )) {
|
||||||
|
\TaskUserPeer::doDelete($oCriteria);
|
||||||
|
} else {
|
||||||
|
throw (new \Exception( 'This row does not exist!' ));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
@@ -875,7 +886,7 @@ class Task
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a adhoc assignee list of an activity
|
* Return a adhoc assignee list of an activity
|
||||||
*
|
*
|
||||||
* @param string $sProcessUID
|
* @param string $sProcessUID
|
||||||
* @param string $sTaskUID
|
* @param string $sTaskUID
|
||||||
*
|
*
|
||||||
@@ -895,7 +906,6 @@ class Task
|
|||||||
$oCriteria->addSelectColumn(\TaskUserPeer::TU_TYPE);
|
$oCriteria->addSelectColumn(\TaskUserPeer::TU_TYPE);
|
||||||
$oCriteria->addSelectColumn(\TaskUserPeer::TU_RELATION);
|
$oCriteria->addSelectColumn(\TaskUserPeer::TU_RELATION);
|
||||||
$oCriteria->addAlias('C', 'CONTENT');
|
$oCriteria->addAlias('C', 'CONTENT');
|
||||||
|
|
||||||
$aConditions = array();
|
$aConditions = array();
|
||||||
$aConditions[] = array(\TaskUserPeer::USR_UID, 'C.CON_ID' );
|
$aConditions[] = array(\TaskUserPeer::USR_UID, 'C.CON_ID' );
|
||||||
$aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'GRP_TITLE' . $sDelimiter );
|
$aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'GRP_TITLE' . $sDelimiter );
|
||||||
@@ -925,8 +935,8 @@ class Task
|
|||||||
}
|
}
|
||||||
$aUsers[] = array('aas_uid' => $aRow['USR_UID'],
|
$aUsers[] = array('aas_uid' => $aRow['USR_UID'],
|
||||||
'aas_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $aRow['GRP_TITLE'] .
|
'aas_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $aRow['GRP_TITLE'] .
|
||||||
' (' . $aRow2['MEMBERS_NUMBER'] .
|
' (' . $aRow2['MEMBERS_NUMBER'] . ' ' .
|
||||||
' ' . ((int) $aRow2['MEMBERS_NUMBER'] == 1 ? \G::LoadTranslation('ID_USER') : \G::LoadTranslation('ID_USERS')) .
|
((int) $aRow2['MEMBERS_NUMBER'] == 1 ? \G::LoadTranslation('ID_USER') : \G::LoadTranslation('ID_USERS')) .
|
||||||
')' . '' : $aRow['GRP_TITLE'] . ' ' . $aRow2['GROUP_INACTIVE']),
|
')' . '' : $aRow['GRP_TITLE'] . ' ' . $aRow2['GROUP_INACTIVE']),
|
||||||
'aas_lastname' => "",
|
'aas_lastname' => "",
|
||||||
'aas_username' => "",
|
'aas_username' => "",
|
||||||
@@ -973,7 +983,6 @@ class Task
|
|||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function getTaskAvailableAdhocAssignee($sProcessUID, $sTaskUID)
|
public function getTaskAvailableAdhocAssignee($sProcessUID, $sTaskUID)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@@ -1010,9 +1019,9 @@ class Task
|
|||||||
$aRow2 = $oDataset2->getRow();
|
$aRow2 = $oDataset2->getRow();
|
||||||
$aUsers[] = array('aas_uid' => $results['GRP_UID'],
|
$aUsers[] = array('aas_uid' => $results['GRP_UID'],
|
||||||
'aas_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $results['GRP_TITLE'] .
|
'aas_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $results['GRP_TITLE'] .
|
||||||
' (' . $aRow2['MEMBERS_NUMBER'] .
|
' (' . $aRow2['MEMBERS_NUMBER'] . ' ' .
|
||||||
' ' . ((int) $aRow2['MEMBERS_NUMBER'] == 1 ? \G::LoadTranslation('ID_USER') : \G::LoadTranslation('ID_USERS')) .
|
((int) $aRow2['MEMBERS_NUMBER'] == 1 ? \G::LoadTranslation('ID_USER') : \G::LoadTranslation('ID_USERS')) .
|
||||||
')' . '' : $aRow['GRP_TITLE'] . ' ' . $aRow2['GROUP_INACTIVE']),
|
')' . '' : $aRow['GRP_TITLE'] . ' ' . $aRow2['GROUP_INACTIVE']),
|
||||||
'aas_lastname' => "",
|
'aas_lastname' => "",
|
||||||
'aas_username' => "",
|
'aas_username' => "",
|
||||||
'aas_type' => "group" );
|
'aas_type' => "group" );
|
||||||
@@ -1068,7 +1077,6 @@ class Task
|
|||||||
$oCriteria->addSelectColumn(\TaskUserPeer::TU_TYPE);
|
$oCriteria->addSelectColumn(\TaskUserPeer::TU_TYPE);
|
||||||
$oCriteria->addSelectColumn(\TaskUserPeer::TU_RELATION);
|
$oCriteria->addSelectColumn(\TaskUserPeer::TU_RELATION);
|
||||||
$oCriteria->addAlias('C', 'CONTENT');
|
$oCriteria->addAlias('C', 'CONTENT');
|
||||||
|
|
||||||
$aConditions = array();
|
$aConditions = array();
|
||||||
$aConditions[] = array(\TaskUserPeer::USR_UID, 'C.CON_ID' );
|
$aConditions[] = array(\TaskUserPeer::USR_UID, 'C.CON_ID' );
|
||||||
$aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'GRP_TITLE' . $sDelimiter );
|
$aConditions[] = array('C.CON_CATEGORY', $sDelimiter . 'GRP_TITLE' . $sDelimiter );
|
||||||
@@ -1099,8 +1107,8 @@ class Task
|
|||||||
}
|
}
|
||||||
$aUsers = array('aas_uid' => $aRow['USR_UID'],
|
$aUsers = array('aas_uid' => $aRow['USR_UID'],
|
||||||
'aas_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $aRow['GRP_TITLE'] .
|
'aas_name' => (!isset($aRow2['GROUP_INACTIVE']) ? $aRow['GRP_TITLE'] .
|
||||||
' (' . $aRow2['MEMBERS_NUMBER'] .
|
' (' . $aRow2['MEMBERS_NUMBER'] . ' ' .
|
||||||
' ' . ((int) $aRow2['MEMBERS_NUMBER'] == 1 ? \G::LoadTranslation('ID_USER') : \G::LoadTranslation('ID_USERS')) .
|
((int) $aRow2['MEMBERS_NUMBER'] == 1 ? \G::LoadTranslation('ID_USER') : \G::LoadTranslation('ID_USERS')) .
|
||||||
')' . '' : $aRow['GRP_TITLE'] . ' ' . $aRow2['GROUP_INACTIVE']),
|
')' . '' : $aRow['GRP_TITLE'] . ' ' . $aRow2['GROUP_INACTIVE']),
|
||||||
'aas_lastname' => "",
|
'aas_lastname' => "",
|
||||||
'aas_username' => "",
|
'aas_username' => "",
|
||||||
@@ -1138,38 +1146,37 @@ class Task
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign a Adhoc user or group to an activity
|
* Assign a Adhoc user or group to an activity
|
||||||
*
|
*
|
||||||
* @param string $sProcessUID
|
* @param string $sProcessUID
|
||||||
* @param string $sTaskUID
|
* @param string $sTaskUID
|
||||||
* @param string $sAssigneeUID
|
* @param string $sAssigneeUID
|
||||||
* @param int $sRelation
|
* @param string $assType
|
||||||
*
|
*
|
||||||
* return array
|
* return array
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function postTaskAdhocAssignee($sProcessUID, $sTaskUID, $sAssigneeUID, $sRelation)
|
public function addTaskAdhocAssignee($sProcessUID, $sTaskUID, $sAssigneeUID, $assType)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$iType = 2;
|
$iType = 2;
|
||||||
$oTaskUser = new \TaskUser();
|
$oTaskUser = new \TaskUser();
|
||||||
if ($sRelation == 1) {
|
if ($assType == "user") {
|
||||||
$oTaskUser->create(array('TAS_UID' => $sTaskUID,
|
$oTaskUser->create(array('TAS_UID' => $sTaskUID,
|
||||||
'USR_UID' => $sAssigneeUID,
|
'USR_UID' => $sAssigneeUID,
|
||||||
'TU_TYPE' => $iType,
|
'TU_TYPE' => $iType,
|
||||||
'TU_RELATION' => $sRelation));
|
'TU_RELATION' => 1));
|
||||||
return array('aas_uid' => $sAssigneeUID,
|
return array('aas_uid' => $sAssigneeUID,
|
||||||
'aas_type' => "user");
|
'aas_type' => $assType);
|
||||||
} else {
|
} else {
|
||||||
$oTaskUser->create(array('TAS_UID' => $sTaskUID,
|
$oTaskUser->create(array('TAS_UID' => $sTaskUID,
|
||||||
'USR_UID' => $sAssigneeUID,
|
'USR_UID' => $sAssigneeUID,
|
||||||
'TU_TYPE' => $iType,
|
'TU_TYPE' => $iType,
|
||||||
'TU_RELATION' => $sRelation));
|
'TU_RELATION' => 2));
|
||||||
return array('aas_uid' => $sAssigneeUID,
|
return array('aas_uid' => $sAssigneeUID,
|
||||||
'aas_type' => "group");
|
'aas_type' => $assType);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
@@ -1178,30 +1185,36 @@ class Task
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a Adhoc assignee of an activity
|
* Remove a Adhoc assignee of an activity
|
||||||
*
|
*
|
||||||
* @param string $sProcessUID
|
* @param string $sProcessUID
|
||||||
* @param string $sTaskUID
|
* @param string $sTaskUID
|
||||||
* @param string $sAssigneeUID
|
* @param string $sAssigneeUID
|
||||||
* @param int $sRelation
|
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function deleteTaskAdhocAssignee($sProcessUID, $sTaskUID, $sAssigneeUID, $sRelation)
|
public function removeTaskAdhocAssignee($sProcessUID, $sTaskUID, $sAssigneeUID)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$iType = 2;
|
$iType = 2;
|
||||||
$oTaskUser = new \TaskUser();
|
$oCriteria = new \Criteria('workflow');
|
||||||
|
$oCriteria->addSelectColumn( \TaskUserPeer::TU_RELATION );
|
||||||
if ($sRelation == 1) {
|
$oCriteria->add(\TaskUserPeer::USR_UID, $sAssigneeUID);
|
||||||
$oTaskUser->remove($sTaskUID, $sAssigneeUID, $iType, $sRelation);
|
$oCriteria->add(\TaskUserPeer::TAS_UID, $sTaskUID);
|
||||||
} else {
|
$oCriteria->add(\TaskUserPeer::TU_TYPE, $iType);
|
||||||
$oTaskUser->remove($sTaskUID, $sAssigneeUID, $iType, $sRelation);
|
$oTaskUser = \TaskUserPeer::doSelectRS($oCriteria);
|
||||||
|
$oTaskUser->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
while ($oTaskUser->next()) {
|
||||||
|
$aRow = $oTaskUser->getRow();
|
||||||
|
$iRelation = $aRow['TU_RELATION'];
|
||||||
|
}
|
||||||
|
$oTaskUser = \TaskUserPeer::retrieveByPK($sTaskUID, $sAssigneeUID, $iType, $iRelation);
|
||||||
|
if (! is_null( $oTaskUser )) {
|
||||||
|
\TaskUserPeer::doDelete($oCriteria);
|
||||||
|
} else {
|
||||||
|
throw (new \Exception( 'This row does not exist!' ));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Services\Api\ProcessMaker\Project\Activity;
|
namespace Services\Api\ProcessMaker\Project\Activity;
|
||||||
|
|
||||||
//use \ProcessMaker\Api;
|
|
||||||
use \ProcessMaker\Services\Api;
|
use \ProcessMaker\Services\Api;
|
||||||
use \Luracast\Restler\RestException;
|
use \Luracast\Restler\RestException;
|
||||||
|
|
||||||
@@ -13,224 +12,238 @@ use \Luracast\Restler\RestException;
|
|||||||
class Assignee extends Api
|
class Assignee extends Api
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @url GET /:prj_uid/activity/:act_uid/assignee
|
* @url GET /:prjUid/activity/:actUid/assignee
|
||||||
|
*
|
||||||
|
* @param string $prjUid
|
||||||
|
* @param string $actUid
|
||||||
|
* @param string $filter
|
||||||
|
* @param int $start
|
||||||
|
* @param int $limit
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public function doGetActivityAssignees($prj_uid, $act_uid, $filter = '', $start = '', $limit = '')
|
public function doGetActivityAssignees($prjUid, $actUid, $filter = '', $start = '1', $limit = '50')
|
||||||
{
|
{
|
||||||
$response = array();
|
$response = array();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$task = new \BusinessModel\Task();
|
$task = new \BusinessModel\Task();
|
||||||
$arrayData = $task->getTaskAssignees($prj_uid, $act_uid, $filter, $start, $limit);
|
$arrayData = $task->getTaskAssignees($prjUid, $actUid, $filter, $start, $limit);
|
||||||
|
|
||||||
//Response
|
|
||||||
$response = $arrayData;
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
//Response
|
|
||||||
$response["success"] = false;
|
|
||||||
$response["message"] = $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @url GET /:prj_uid/activity/:act_uid/available-assignee
|
|
||||||
*/
|
|
||||||
public function doGetActivityAvailableAssignee($prj_uid, $act_uid, $filter = '', $start = '', $limit = '')
|
|
||||||
{
|
|
||||||
$response = array();
|
|
||||||
|
|
||||||
try {
|
|
||||||
$task = new \BusinessModel\Task();
|
|
||||||
$arrayData = $task->getTaskAvailableAssignee($prj_uid, $act_uid);
|
|
||||||
|
|
||||||
//Response
|
//Response
|
||||||
$response = $arrayData;
|
$response = $arrayData;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
//response
|
//response
|
||||||
$response["success"] = false;
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
$response["message"] = $e->getMessage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @url GET /:prj_uid/activity/:act_uid/assignee/:aas_uid
|
* @url GET /:prjUid/activity/:actUid/available-assignee
|
||||||
|
*
|
||||||
|
* @param string $prjUid
|
||||||
|
* @param string $actUid
|
||||||
|
* @param string $filter
|
||||||
|
* @param int $start
|
||||||
|
* @param int $limit
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public function doGetActivityAssignee($prj_uid, $act_uid, $aas_uid)
|
public function doGetActivityAvailableAssignee($prjUid, $actUid, $filter = '', $start = '1', $limit = '50')
|
||||||
{
|
{
|
||||||
$response = array();
|
$response = array();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$task = new \BusinessModel\Task();
|
$task = new \BusinessModel\Task();
|
||||||
$arrayData = $task->getTaskAssignee($prj_uid, $act_uid, $aas_uid);
|
$arrayData = $task->getTaskAvailableAssignee($prjUid, $actUid, $filter, $start, $limit);
|
||||||
|
|
||||||
//Response
|
//Response
|
||||||
$response = $arrayData;
|
$response = $arrayData;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
//response
|
//response
|
||||||
$response["success"] = false;
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
$response["message"] = $e->getMessage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @url POST /:prj_uid/activity/:act_uid/assignee
|
* @url GET /:prjUid/activity/:actUid/assignee/:aasUid
|
||||||
|
*
|
||||||
|
* @param string $prjUid
|
||||||
|
* @param string $actUid
|
||||||
|
* @param string $aasUid
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function doGetActivityAssignee($prjUid, $actUid, $aasUid)
|
||||||
|
{
|
||||||
|
$response = array();
|
||||||
|
try {
|
||||||
|
$task = new \BusinessModel\Task();
|
||||||
|
$arrayData = $task->getTaskAssignee($prjUid, $actUid, $aasUid);
|
||||||
|
//Response
|
||||||
|
$response = $arrayData;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
//response
|
||||||
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
|
}
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @url POST /:prjUid/activity/:actUid/assignee
|
||||||
|
*
|
||||||
|
* @param string $prjUid
|
||||||
|
* @param string $actUid
|
||||||
|
* @param string $assUid
|
||||||
|
* @param string $assType {@choice user,group}
|
||||||
|
*
|
||||||
* @status 201
|
* @status 201
|
||||||
*/
|
*/
|
||||||
public function doPostActivityAssignee($prj_uid, $act_uid, $assignee_uid, $tu_relation)
|
public function doPostActivityAssignee($prjUid, $actUid, $assUid, $assType)
|
||||||
{
|
{
|
||||||
$response = array();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$task = new \BusinessModel\Task();
|
$task = new \BusinessModel\Task();
|
||||||
$arrayData = $task->postTaskAssignee($prj_uid, $act_uid, $assignee_uid, $tu_relation);
|
$arrayData = $task->addTaskAssignee($prjUid, $actUid, $assUid, $assType);
|
||||||
|
|
||||||
//Response
|
|
||||||
$response ["success"] = true;
|
|
||||||
$response = $arrayData;
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
//response
|
|
||||||
$response["success"] = false;
|
|
||||||
$response["message"] = $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @url DELETE /:prj_uid/activity/:act_uid/assignee/:aas_uid/relation/:tu_relation
|
|
||||||
*/
|
|
||||||
public function doDeleteActivityAssignee($prj_uid, $act_uid, $aas_uid, $tu_relation)
|
|
||||||
{
|
|
||||||
$response = array();
|
|
||||||
|
|
||||||
try {
|
|
||||||
$task = new \BusinessModel\Task();
|
|
||||||
$arrayData = $task->deleteTaskAssignee($prj_uid, $act_uid, $aas_uid, $tu_relation);
|
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
|
||||||
//response
|
|
||||||
$response["success"] = false;
|
|
||||||
$response["message"] = $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $response;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @url GET /:prj_uid/activity/:act_uid/adhoc-assignee
|
|
||||||
*/
|
|
||||||
public function doGetActivityAdhocAssignees($prj_uid, $act_uid, $filter = '', $start = '', $limit = '')
|
|
||||||
{
|
|
||||||
$response = array();
|
|
||||||
|
|
||||||
try {
|
|
||||||
$task = new \BusinessModel\Task();
|
|
||||||
$arrayData = $task->getTaskAdhocAssignees($prj_uid, $act_uid, $filter, $start, $limit);
|
|
||||||
|
|
||||||
//Response
|
//Response
|
||||||
$response = $arrayData;
|
$response = $arrayData;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
//Response
|
//Response
|
||||||
$response["success"] = false;
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
$response["message"] = $e->getMessage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @url GET /:prj_uid/activity/:act_uid/available-adhoc-assignee
|
* @url DELETE /:prjUid/activity/:actUid/assignee/:assUid
|
||||||
|
*
|
||||||
|
* @param string $prjUid
|
||||||
|
* @param string $actUid
|
||||||
|
* @param string $assUid
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public function doGetActivityAvailableAdhocAssignee($prj_uid, $act_uid, $filter = '', $start = '', $limit = '')
|
public function doDeleteActivityAssignee($prjUid, $actUid, $assUid)
|
||||||
{
|
{
|
||||||
$response = array();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$task = new \BusinessModel\Task();
|
$task = new \BusinessModel\Task();
|
||||||
$arrayData = $task->getTaskAvailableAdhocAssignee($prj_uid, $act_uid);
|
$arrayData = $task->removeTaskAssignee($prjUid, $actUid, $assUid);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
//response
|
||||||
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
|
}
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @url GET /:prjUid/activity/:actUid/adhoc-assignee
|
||||||
|
*
|
||||||
|
* @param string $prjUid
|
||||||
|
* @param string $actUid
|
||||||
|
* @param string $filter
|
||||||
|
* @param int $start
|
||||||
|
* @param int $limit
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function doGetActivityAdhocAssignees($prjUid, $actUid, $filter = '', $start = '1', $limit = '50')
|
||||||
|
{
|
||||||
|
$response = array();
|
||||||
|
try {
|
||||||
|
$task = new \BusinessModel\Task();
|
||||||
|
$arrayData = $task->getTaskAdhocAssignees($prjUid, $actUid, $filter, $start, $limit);
|
||||||
//Response
|
//Response
|
||||||
$response = $arrayData;
|
$response = $arrayData;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
//response
|
//response
|
||||||
$response["success"] = false;
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
$response["message"] = $e->getMessage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @url GET /:prj_uid/activity/:act_uid/adhoc-assignee/:aas_uid
|
* @url GET /:prjUid/activity/:actUid/available-adhoc-assignee
|
||||||
|
*
|
||||||
|
* @param string $prjUid
|
||||||
|
* @param string $actUid
|
||||||
|
* @param string $filter
|
||||||
|
* @param int $start
|
||||||
|
* @param int $limit
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public function doGetActivityAdhocAssignee($prj_uid, $act_uid, $aas_uid)
|
public function doGetActivityAvailableAdhocAssignee($prjUid, $actUid, $filter = '', $start = '1', $limit = '50')
|
||||||
{
|
{
|
||||||
$response = array();
|
$response = array();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$task = new \BusinessModel\Task();
|
$task = new \BusinessModel\Task();
|
||||||
$arrayData = $task->getTaskAdhocAssignee($prj_uid, $act_uid, $aas_uid);
|
$arrayData = $task->getTaskAvailableAdhocAssignee($prjUid, $actUid, $filter, $start, $limit);
|
||||||
|
|
||||||
//Response
|
//Response
|
||||||
$response = $arrayData;
|
$response = $arrayData;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
//response
|
//response
|
||||||
$response["success"] = false;
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
$response["message"] = $e->getMessage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @url POST /:prj_uid/activity/:act_uid/adhoc-assignee
|
* @url GET /:prjUid/activity/:actUid/adhoc-assignee/:aasUid
|
||||||
|
*
|
||||||
|
* @param string $prjUid
|
||||||
|
* @param string $actUid
|
||||||
|
* @param string $assUid
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function doGetActivityAdhocAssignee($prjUid, $actUid, $aasUid)
|
||||||
|
{
|
||||||
|
$response = array();
|
||||||
|
try {
|
||||||
|
$task = new \BusinessModel\Task();
|
||||||
|
$arrayData = $task->getTaskAdhocAssignee($prjUid, $actUid, $aasUid);
|
||||||
|
//Response
|
||||||
|
$response = $arrayData;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
//response
|
||||||
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
|
}
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @url POST /:prjUid/activity/:actUid/adhoc-assignee
|
||||||
|
*
|
||||||
|
* @param string $prjUid
|
||||||
|
* @param string $actUid
|
||||||
|
* @param string $assUid
|
||||||
|
* @param string $assType {@choice user,group}
|
||||||
|
*
|
||||||
* @status 201
|
* @status 201
|
||||||
*/
|
*/
|
||||||
public function doPostActivityAdhocAssignee($prj_uid, $act_uid, $assignee_uid, $tu_relation)
|
public function doPostActivityAdhocAssignee($prjUid, $actUid, $assUid, $assType)
|
||||||
{
|
{
|
||||||
$response = array();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$task = new \BusinessModel\Task();
|
$task = new \BusinessModel\Task();
|
||||||
$arrayData = $task->postTaskAdhocAssignee($prj_uid, $act_uid, $assignee_uid, $tu_relation);
|
$arrayData = $task->addTaskAdhocAssignee($prjUid, $actUid, $assUid, $assType);
|
||||||
|
|
||||||
//Response
|
//Response
|
||||||
$response ["success"] = true;
|
|
||||||
$response = $arrayData;
|
$response = $arrayData;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
//response
|
//response
|
||||||
$response["success"] = false;
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
$response["message"] = $e->getMessage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @url DELETE /:prj_uid/activity/:act_uid/adhoc-assignee/:aas_uid/relation/:tu_relation
|
* @url DELETE /:prjUid/activity/:actUid/adhoc-assignee/:assUid
|
||||||
|
*
|
||||||
|
* @param string $prjUid
|
||||||
|
* @param string $actUid
|
||||||
|
* @param string $assUid
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public function doDeleteActivityAdhocAssignee($prj_uid, $act_uid, $aas_uid, $tu_relation)
|
public function doDeleteActivityAdhocAssignee($prjUid, $actUid, $assUid)
|
||||||
{
|
{
|
||||||
$response = array();
|
$response = array();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$task = new \BusinessModel\Task();
|
$task = new \BusinessModel\Task();
|
||||||
$arrayData = $task->deleteTaskAdhocAssignee($prj_uid, $act_uid, $aas_uid, $tu_relation);
|
$arrayData = $task->removeTaskAdhocAssignee($prjUid, $actUid, $assUid);
|
||||||
|
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
//response
|
//response
|
||||||
$response["success"] = false;
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
$response["message"] = $e->getMessage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user