Merged in darojas/processmaker (pull request #350)
Se agrega funcion para upgrade de Files Manager. Se agrega endpoint en ASSIGNESS y ADHOC ASSIGNESS para obtener todos los usuarios. Se modifica BEHAT basico en ASSIGNESS y ADHOC ASSIGNESS. Se modifica respuesta en POST de OUTPUTDOCUMENTS
This commit is contained in:
@@ -123,7 +123,13 @@ Requirements:
|
||||
And the content type is "application/json"
|
||||
And the type is "array"
|
||||
And the response has 1 records
|
||||
|
||||
|
||||
|
||||
Scenario: List assignees of an activity
|
||||
Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/adhoc-assignee/all"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/json"
|
||||
And the type is "array"
|
||||
|
||||
|
||||
|
||||
@@ -129,3 +129,10 @@ Scenario Outline: List assignees of an activity using a filter
|
||||
And the type is "array"
|
||||
And the response has 4 records
|
||||
|
||||
|
||||
Scenario: List assignees of an activity including users that are within groups
|
||||
Given I request "project/4224292655297723eb98691001100052/activity/65496814252977243d57684076211485/assignee/all"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/json"
|
||||
And the type is "array"
|
||||
|
||||
@@ -39,7 +39,6 @@ EOT
|
||||
CLI::taskOpt("buildACV", "If the option is enabled, performs the Build Cache View.", "ACV", "buildACV");
|
||||
CLI::taskRun("run_upgrade");
|
||||
|
||||
|
||||
/**
|
||||
* A version of rm_dir which does not exits on error.
|
||||
*
|
||||
@@ -150,6 +149,7 @@ function run_upgrade($command, $args)
|
||||
|
||||
G::browserCacheFilesSetUid();
|
||||
|
||||
upgradeFilesManager($command);
|
||||
//Status
|
||||
if ($errors) {
|
||||
CLI::logging("Upgrade finished but there were errors upgrading workspaces.\n");
|
||||
@@ -162,3 +162,89 @@ function run_upgrade($command, $args)
|
||||
$flag = G::isPMUnderUpdating(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function upgradeFilesManager
|
||||
* access public
|
||||
*/
|
||||
|
||||
function upgradeFilesManager($command = "") {
|
||||
CLI::logging("> Updating Files Manager...\n\n");
|
||||
$workspaces = get_workspaces_from_args($command);
|
||||
foreach ($workspaces as $workspace) {
|
||||
$name = $workspace->name;
|
||||
require_once( PATH_DB . $name . '/db.php' );
|
||||
require_once( PATH_THIRDPARTY . 'propel/Propel.php');
|
||||
PROPEL::Init ( PATH_METHODS.'dbConnections/rootDbConnections.php' );
|
||||
$con = Propel::getConnection("root");
|
||||
$stmt = $con->createStatement();
|
||||
$sDirectory = PATH_DATA . "sites/" . $name . "/" . "mailTemplates/";
|
||||
$sDirectoryPublic = PATH_DATA . "sites/" . $name . "/" . "public/";
|
||||
if ($dh = opendir($sDirectory)) {
|
||||
$files = Array();
|
||||
while ($file = readdir($dh)) {
|
||||
if ($file != "." && $file != ".." && $file[0] != '.') {
|
||||
if (is_dir($sDirectory . "/" . $file)) {
|
||||
$inner_files = listFiles($sDirectory . $file);
|
||||
if (is_array($inner_files)) $files = array_merge($files, $inner_files);
|
||||
} else {
|
||||
array_push($files, $sDirectory . $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
if ($dh = opendir($sDirectoryPublic)) {
|
||||
while ($file = readdir($dh)) {
|
||||
if ($file != "." && $file != ".." && $file[0] != '.') {
|
||||
if (is_dir($sDirectoryPublic . "/" . $file)) {
|
||||
$inner_files = listFiles($sDirectoryPublic . $file);
|
||||
if (is_array($inner_files)) $files = array_merge($files, $inner_files);
|
||||
} else {
|
||||
array_push($files, $sDirectoryPublic . $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
foreach ($files as $aFile) {
|
||||
if (strpos($aFile, $sDirectory) !== false){
|
||||
$processUid = current(explode("/", str_replace($sDirectory,'',$aFile)));
|
||||
} else {
|
||||
$processUid = current(explode("/", str_replace($sDirectoryPublic,'',$aFile)));
|
||||
}
|
||||
$sql = "SELECT PROCESS_FILES.PRF_PATH FROM PROCESS_FILES WHERE PROCESS_FILES.PRF_PATH='" . $aFile ."'";
|
||||
$appRows = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
$fileUid = '';
|
||||
foreach ($appRows as $row) {
|
||||
$fileUid = $row["PRF_PATH"];
|
||||
}
|
||||
if ($fileUid !== $aFile) {
|
||||
$sPkProcessFiles = G::generateUniqueID();
|
||||
$sDate = date('Y-m-d H:i:s');
|
||||
$sql = "INSERT INTO PROCESS_FILES (PRF_UID, PRO_UID, USR_UID, PRF_UPDATE_USR_UID,
|
||||
PRF_PATH, PRF_TYPE, PRF_EDITABLE, PRF_CREATE_DATE, PRF_UPDATE_DATE)
|
||||
VALUES ('".$sPkProcessFiles."', '".$processUid."', '00000000000000000000000000000001', '',
|
||||
'".$aFile."', 'file', 'true', '".$sDate."', NULL)";
|
||||
$stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function listFiles($dir) {
|
||||
if($dh = opendir($dir)) {
|
||||
$files = Array();
|
||||
while ($file = readdir($dh)) {
|
||||
if ($file != "." && $file != ".." && $file[0] != '.') {
|
||||
if (is_dir($dir . "/" . $file)) {
|
||||
$inner_files = listFiles($dir . "/" . $file);
|
||||
if (is_array($inner_files)) $files = array_merge($files, $inner_files);
|
||||
} else {
|
||||
array_push($files, $dir . "/" . $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
return $files;
|
||||
}
|
||||
}
|
||||
@@ -265,7 +265,8 @@ class OutputDocument
|
||||
}
|
||||
}
|
||||
$g->sessionVarRestore();
|
||||
return $this->getCasesOutputDocument($applicationUid, $userUid, $sDocUID);
|
||||
$response = $this->getCasesOutputDocument($applicationUid, $userUid, $sDocUID);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
@@ -1937,5 +1937,254 @@ class Task
|
||||
unset($array[$variable]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of assignees of an activity
|
||||
*
|
||||
* @param string $sProcessUID {@min 32} {@max 32}
|
||||
* @param string $sTaskUID {@min 32} {@max 32}
|
||||
* @param string $filter
|
||||
* @param int $start
|
||||
* @param int $limit
|
||||
* @param string $type
|
||||
*
|
||||
* return array
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function getTaskAssigneesAll($sProcessUID, $sTaskUID, $filter, $start, $limit, $type)
|
||||
{
|
||||
try {
|
||||
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
|
||||
if (is_null($oProcess)) {
|
||||
throw (new \Exception( 'This id for `prj_uid`: '. $sProcessUID .' does not correspond to a registered process'));
|
||||
}
|
||||
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
|
||||
if (is_null($oActivity)) {
|
||||
throw (new \Exception( 'This id for `act_uid`: '. $sTaskUID .' does not correspond to a registered activity'));
|
||||
}
|
||||
$aUsers = array();
|
||||
$oTasks = new \Tasks();
|
||||
$aAux = $oTasks->getGroupsOfTask($sTaskUID, 1);
|
||||
$aGroupUids = array();
|
||||
foreach ($aAux as $aGroup) {
|
||||
$aGroupUids[] = $aGroup['GRP_UID'];
|
||||
}
|
||||
foreach ($aGroupUids as $results) {
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->addSelectColumn('USR_UID');
|
||||
$oCriteria->add(\GroupUserPeer::GRP_UID, $results);
|
||||
$oGroupDataset = \GroupUserPeer::doSelectRS($oCriteria);
|
||||
$oGroupDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
while ($oGroupDataset->next()) {
|
||||
$aGroupRow = $oGroupDataset->getRow();
|
||||
$oGroupCriteria = new \Criteria('workflow');
|
||||
$oGroupCriteria->addSelectColumn(\UsersPeer::USR_UID);
|
||||
$oGroupCriteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME);
|
||||
$oGroupCriteria->addSelectColumn(\UsersPeer::USR_LASTNAME);
|
||||
$oGroupCriteria->addSelectColumn(\UsersPeer::USR_USERNAME);
|
||||
if ($filter != '') {
|
||||
$oGroupCriteria->add($oGroupCriteria->getNewCriterion(\UsersPeer::USR_USERNAME, "%$filter%",
|
||||
\Criteria::LIKE)->addOr($oGroupCriteria->getNewCriterion(\UsersPeer::USR_FIRSTNAME,
|
||||
"%$filter%", \Criteria::LIKE))->addOr($oGroupCriteria->getNewCriterion(\UsersPeer::USR_LASTNAME,
|
||||
"%$filter%", \Criteria::LIKE)));
|
||||
}
|
||||
$oGroupCriteria->add(\UsersPeer::USR_UID, $aGroupRow["USR_UID"]);
|
||||
$oUserDataset = \UsersPeer::doSelectRS($oGroupCriteria);
|
||||
$oUserDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oUserDataset->next();
|
||||
while ($aUserRow = $oUserDataset->getRow()) {
|
||||
$aUsers[] = array('aas_uid' => $aUserRow['USR_UID'],
|
||||
'aas_name' => $aUserRow['USR_FIRSTNAME'],
|
||||
'aas_lastname' => $aUserRow['USR_LASTNAME'],
|
||||
'aas_username' => $aUserRow['USR_USERNAME'],
|
||||
'aas_type' => "user" );
|
||||
$oUserDataset->next();
|
||||
}
|
||||
}
|
||||
}
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_UID);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_LASTNAME);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_USERNAME);
|
||||
if ($filter != '') {
|
||||
$oCriteria->add($oCriteria->getNewCriterion(\UsersPeer::USR_USERNAME, "%$filter%", \Criteria::LIKE)
|
||||
->addOr($oCriteria->getNewCriterion(\UsersPeer::USR_FIRSTNAME, "%$filter%", \Criteria::LIKE))
|
||||
->addOr($oCriteria->getNewCriterion(\UsersPeer::USR_LASTNAME, "%$filter%", \Criteria::LIKE )));
|
||||
}
|
||||
$oCriteria->addJoin(\TaskUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(\TaskUserPeer::TAS_UID, $sTaskUID);
|
||||
$oCriteria->add(\TaskUserPeer::TU_TYPE, 1);
|
||||
$oCriteria->add(\TaskUserPeer::TU_RELATION, 1);
|
||||
$oDataset = \TaskUserPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
if ($type == '' || $type == 'user') {
|
||||
$aUsers[] = array('aas_uid' => $aRow['USR_UID'],
|
||||
'aas_name' => $aRow['USR_FIRSTNAME'],
|
||||
'aas_lastname' => $aRow['USR_LASTNAME'],
|
||||
'aas_username' => $aRow['USR_USERNAME'],
|
||||
'aas_type' => "user" );
|
||||
}
|
||||
$oDataset->next();
|
||||
}
|
||||
$aUsersGroups = array();
|
||||
$exclude = array("");
|
||||
for ($i = 0; $i<=count($aUsers)-1; $i++) {
|
||||
if (!in_array(trim($aUsers[$i]["aas_uid"]) ,$exclude)) {
|
||||
$aUsersGroups[] = $aUsers[$i];
|
||||
$exclude[] = trim($aUsers[$i]["aas_uid"]);
|
||||
}
|
||||
}
|
||||
if ($start) {
|
||||
if ($start < 0) {
|
||||
throw (new \Exception( 'Invalid value specified for `start`.'));
|
||||
}
|
||||
} else {
|
||||
$start = 0;
|
||||
}
|
||||
if (isset($limit)) {
|
||||
if ($limit < 0) {
|
||||
throw (new \Exception( 'Invalid value specified for `limit`.'));
|
||||
} else {
|
||||
if ($limit == 0) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$limit = 1000;
|
||||
}
|
||||
$aUsersGroups = $this->arrayPagination($aUsersGroups, $start, $limit);
|
||||
return $aUsersGroups;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of adhoc assignees of an activity
|
||||
*
|
||||
* @param string $sProcessUID {@min 32} {@max 32}
|
||||
* @param string $sTaskUID {@min 32} {@max 32}
|
||||
* @param string $filter
|
||||
* @param int $start
|
||||
* @param int $limit
|
||||
* @param string $type
|
||||
*
|
||||
* return array
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function getTaskAdhocAssigneesAll($sProcessUID, $sTaskUID, $filter, $start, $limit, $type)
|
||||
{
|
||||
try {
|
||||
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
|
||||
if (is_null($oProcess)) {
|
||||
throw (new \Exception( 'This id for `prj_uid`: '. $sProcessUID .' does not correspond to a registered process'));
|
||||
}
|
||||
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
|
||||
if (is_null($oActivity)) {
|
||||
throw (new \Exception( 'This id for `act_uid`: '. $sTaskUID .' does not correspond to a registered activity'));
|
||||
}
|
||||
$aUsers = array();
|
||||
$oTasks = new \Tasks();
|
||||
$aAux = $oTasks->getGroupsOfTask($sTaskUID, 2);
|
||||
$aGroupUids = array();
|
||||
foreach ($aAux as $aGroup) {
|
||||
$aGroupUids[] = $aGroup['GRP_UID'];
|
||||
}
|
||||
foreach ($aGroupUids as $results) {
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->addSelectColumn('USR_UID');
|
||||
$oCriteria->add(\GroupUserPeer::GRP_UID, $results);
|
||||
$oGroupDataset = \GroupUserPeer::doSelectRS($oCriteria);
|
||||
$oGroupDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
while ($oGroupDataset->next()) {
|
||||
$aGroupRow = $oGroupDataset->getRow();
|
||||
$oGroupCriteria = new \Criteria('workflow');
|
||||
$oGroupCriteria->addSelectColumn(\UsersPeer::USR_UID);
|
||||
$oGroupCriteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME);
|
||||
$oGroupCriteria->addSelectColumn(\UsersPeer::USR_LASTNAME);
|
||||
$oGroupCriteria->addSelectColumn(\UsersPeer::USR_USERNAME);
|
||||
if ($filter != '') {
|
||||
$oGroupCriteria->add($oGroupCriteria->getNewCriterion(\UsersPeer::USR_USERNAME, "%$filter%",
|
||||
\Criteria::LIKE)->addOr($oGroupCriteria->getNewCriterion(\UsersPeer::USR_FIRSTNAME,
|
||||
"%$filter%", \Criteria::LIKE))->addOr($oGroupCriteria->getNewCriterion(\UsersPeer::USR_LASTNAME,
|
||||
"%$filter%", \Criteria::LIKE)));
|
||||
}
|
||||
$oGroupCriteria->add(\UsersPeer::USR_UID, $aGroupRow["USR_UID"]);
|
||||
$oUserDataset = \UsersPeer::doSelectRS($oGroupCriteria);
|
||||
$oUserDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oUserDataset->next();
|
||||
while ($aUserRow = $oUserDataset->getRow()) {
|
||||
$aUsers[] = array('aas_uid' => $aUserRow['USR_UID'],
|
||||
'aas_name' => $aUserRow['USR_FIRSTNAME'],
|
||||
'aas_lastname' => $aUserRow['USR_LASTNAME'],
|
||||
'aas_username' => $aUserRow['USR_USERNAME'],
|
||||
'aas_type' => "user" );
|
||||
$oUserDataset->next();
|
||||
}
|
||||
}
|
||||
}
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_UID);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_LASTNAME);
|
||||
$oCriteria->addSelectColumn(\UsersPeer::USR_USERNAME);
|
||||
if ($filter != '') {
|
||||
$oCriteria->add($oCriteria->getNewCriterion(\UsersPeer::USR_USERNAME, "%$filter%", \Criteria::LIKE)
|
||||
->addOr($oCriteria->getNewCriterion(\UsersPeer::USR_FIRSTNAME, "%$filter%", \Criteria::LIKE))
|
||||
->addOr($oCriteria->getNewCriterion(\UsersPeer::USR_LASTNAME, "%$filter%", \Criteria::LIKE )));
|
||||
}
|
||||
$oCriteria->addJoin(\TaskUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN);
|
||||
$oCriteria->add(\TaskUserPeer::TAS_UID, $sTaskUID);
|
||||
$oCriteria->add(\TaskUserPeer::TU_TYPE, 2);
|
||||
$oCriteria->add(\TaskUserPeer::TU_RELATION, 1);
|
||||
$oDataset = \TaskUserPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
if ($type == '' || $type == 'user') {
|
||||
$aUsers[] = array('aas_uid' => $aRow['USR_UID'],
|
||||
'aas_name' => $aRow['USR_FIRSTNAME'],
|
||||
'aas_lastname' => $aRow['USR_LASTNAME'],
|
||||
'aas_username' => $aRow['USR_USERNAME'],
|
||||
'aas_type' => "user" );
|
||||
}
|
||||
$oDataset->next();
|
||||
}
|
||||
$aUsersGroups = array();
|
||||
$exclude = array("");
|
||||
for ($i = 0; $i<=count($aUsers)-1; $i++) {
|
||||
if (!in_array(trim($aUsers[$i]["aas_uid"]) ,$exclude)) {
|
||||
$aUsersGroups[] = $aUsers[$i];
|
||||
$exclude[] = trim($aUsers[$i]["aas_uid"]);
|
||||
}
|
||||
}
|
||||
if ($start) {
|
||||
if ($start < 0) {
|
||||
throw (new \Exception( 'Invalid value specified for `start`.'));
|
||||
}
|
||||
} else {
|
||||
$start = 0;
|
||||
}
|
||||
if (isset($limit)) {
|
||||
if ($limit < 0) {
|
||||
throw (new \Exception( 'Invalid value specified for `limit`.'));
|
||||
} else {
|
||||
if ($limit == 0) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$limit = 1000;
|
||||
}
|
||||
$aUsersGroups = $this->arrayPagination($aUsersGroups, $start, $limit);
|
||||
return $aUsersGroups;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,5 +240,57 @@ class Assignee extends Api
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prjUid/activity/:actUid/assignee/all
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $actUid {@min 32} {@max 32}
|
||||
* @param string $filter
|
||||
* @param int $start
|
||||
* @param int $limit
|
||||
* @param string $type
|
||||
*
|
||||
*/
|
||||
public function doGetActivityAssigneesAll($prjUid, $actUid, $filter = '', $start = null, $limit = null, $type = '')
|
||||
{
|
||||
$response = array();
|
||||
try {
|
||||
$task = new \BusinessModel\Task();
|
||||
$arrayData = $task->getTaskAssigneesAll($prjUid, $actUid, $filter, $start, $limit, $type);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:prjUid/activity/:actUid/adhoc-assignee/all
|
||||
*
|
||||
* @param string $prjUid {@min 32} {@max 32}
|
||||
* @param string $actUid {@min 32} {@max 32}
|
||||
* @param string $filter
|
||||
* @param int $start
|
||||
* @param int $limit
|
||||
* @param string $type
|
||||
*
|
||||
*/
|
||||
public function doGetActivityAdhocAssigneesAll($prjUid, $actUid, $filter = '', $start = null, $limit = null, $type = '')
|
||||
{
|
||||
$response = array();
|
||||
try {
|
||||
$task = new \BusinessModel\Task();
|
||||
$arrayData = $task->getTaskAdhocAssigneesAll($prjUid, $actUid, $filter, $start, $limit, $type);
|
||||
//Response
|
||||
$response = $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
//Response
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user