Correcion de conflictos

This commit is contained in:
Brayan Osmar Pereyra Suxo
2014-01-23 15:11:26 -04:00
13 changed files with 759 additions and 49 deletions

View File

@@ -2341,9 +2341,10 @@ class Bootstrap
$restUri .= '/' . $urlPart;
}
$args = array();
$env = self::getSystemConfiguration();
$args['SYS_LANG'] = 'en'; // TODO, this can be set from http header
$args['SYS_SKIN'] = '';
$args['SYS_SKIN'] = $env['default_skin'];
$args['SYS_COLLECTION'] = '';
$args['SYS_TARGET'] = $restUri;
$args['API_VERSION'] = $apiVersion;

View File

@@ -187,20 +187,44 @@ class CaseScheduler
*
* @param string $userName Name
* @param string $userPass Password
* @param string $sProcessUID Process
*
* return bool Return true if the user exists, false otherwise
*/
public function getUser($userName, $userPass)
public function getUser($userName, $userPass, $sProcessUID)
{
try {
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\UsersPeer::USR_UID);
$criteria->add(\UsersPeer::USR_USERNAME, $userName, \Criteria::EQUAL);
$criteria->add(\UsersPeer::USR_PASSWORD, $userPass, \Criteria::EQUAL);
$rsCriteria = \UsersPeer::doSelectRS($criteria);
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$rsCriteria->next();
return $rsCriteria->getRow();
if (\G::is_https()) {
$http = 'https://';
} else {
$http = 'http://';
}
$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2';
@$client = new \SoapClient( $endpoint );
$user = $userName;
$pass = $userPass;
$params = array ('userid' => $user,'password' => $pass);
$result = $client->__SoapCall( 'login', array ($params) );
if ($result->status_code == 0) {
if (! class_exists( 'Users' )) {
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes". PATH_SEP . "model" . PATH_SEP . "UsersPeer.php");
}
$oCriteria = new \Criteria( 'workflow' );
$oCriteria->addSelectColumn( 'USR_UID' );
$oCriteria->add( \UsersPeer::USR_USERNAME, $sWS_USER );
$resultSet = \UsersPeer::doSelectRS( $oCriteria );
$resultSet->next();
$user_id = $resultSet->getRow();
$result->message = $user_id[0];
\G::LoadClass( 'case' );
$caseInstance = new \Cases();
if (! $caseInstance->canStartCase( $result->message, $sProcessUID )) {
$result->status_code = - 1000;
$result->message = \G::LoadTranslation( 'ID_USER_CASES_NOT_START' );
}
}
$message = $result->message;
return $message;
} catch (\Exception $e) {
throw $e;
}
@@ -233,11 +257,11 @@ class CaseScheduler
if ($this->existsName($sProcessUID, $aData['SCH_NAME'])) {
throw (new \Exception( 'duplicate Case Scheduler name'));
}
$aData['SCH_DEL_USER_PASS'] = md5( $aData['SCH_DEL_USER_PASS']);
$arrayUser = $this->getUser($aData['SCH_DEL_USER_NAME'], $aData['SCH_DEL_USER_PASS']);
if (empty($arrayUser)) {
throw (new \Exception( 'invalid user or password'));
$mUser = $this->getUser($aData['SCH_DEL_USER_NAME'], $aData['SCH_DEL_USER_PASS'], $sProcessUID);
if (!empty($mUser)) {
throw (new \Exception($mUser));
}
$aData['SCH_DEL_USER_PASS'] = md5( $aData['SCH_DEL_USER_PASS']);
if ($sOption != '5') {
$pattern="/^([0-1][0-9]|[2][0-3])[\:]([0-5][0-9])$/";
if(!preg_match($pattern, $aData['SCH_START_TIME'])) {
@@ -479,11 +503,11 @@ class CaseScheduler
if ($this->existsNameUpdate($sSchUID, $aData['SCH_NAME'])) {
throw (new \Exception( 'duplicate Case Scheduler name'));
}
$aData['SCH_DEL_USER_PASS'] = md5( $aData['SCH_DEL_USER_PASS']);
$arrayUser = $this->getUser($aData['SCH_DEL_USER_NAME'], $aData['SCH_DEL_USER_PASS']);
if (empty($arrayUser)) {
throw (new \Exception( 'invalid user or password'));
$mUser = $this->getUser($aData['SCH_DEL_USER_NAME'], $aData['SCH_DEL_USER_PASS'], $sProcessUID);
if (!empty($mUser)) {
throw (new \Exception($mUser));
}
$aData['SCH_DEL_USER_PASS'] = md5( $aData['SCH_DEL_USER_PASS']);
if ($sOption != '5') {
$pattern="/^([0-1][0-9]|[2][0-3])[\:]([0-5][0-9])$/";
if(!preg_match($pattern, $aData['SCH_START_TIME'])) {

View File

@@ -73,11 +73,11 @@ class InputDocument
}
if (!isset($arrayData["INP_DOC_TITLE"])) {
throw (new \Exception(str_replace(array("{0}"), array("INP_DOC_TITLE"), "The \"{0}\" attribute is not defined")));
throw (new \Exception(str_replace(array("{0}"), array(strtolower("INP_DOC_TITLE")), "The \"{0}\" attribute is not defined")));
}
if (isset($arrayData["INP_DOC_TITLE"]) && trim($arrayData["INP_DOC_TITLE"]) == "") {
throw (new \Exception(str_replace(array("{0}"), array("INP_DOC_TITLE"), "The \"{0}\" attribute is empty")));
throw (new \Exception(str_replace(array("{0}"), array(strtolower("INP_DOC_TITLE")), "The \"{0}\" attribute is empty")));
}
if (isset($arrayData["INP_DOC_TITLE"]) && $this->titleExists($processUid, $arrayData["INP_DOC_TITLE"])) {
@@ -145,7 +145,7 @@ class InputDocument
}
if (isset($arrayData["INP_DOC_TITLE"]) && trim($arrayData["INP_DOC_TITLE"]) == "") {
throw (new \Exception(str_replace(array("{0}"), array("INP_DOC_TITLE"), "The \"{0}\" attribute is empty")));
throw (new \Exception(str_replace(array("{0}"), array(strtolower("INP_DOC_TITLE")), "The \"{0}\" attribute is empty")));
}
if (isset($arrayData["INP_DOC_TITLE"]) && $this->titleExists($processUid, $arrayData["INP_DOC_TITLE"], $inputDocumentUid)) {

View File

@@ -246,6 +246,9 @@ class OutputDocument
if (!$process->exists($sProcessUID)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($sProcessUID, "PROCESS"), "The UID \"{0}\" doesn't exist in table {1}")));
}
if ($aData["OUT_DOC_TITLE"]=="") {
throw (new \Exception( 'invalid value specified for `out_doc_title`, can`t be null'));
}
if (isset($aData["OUT_DOC_TITLE"]) && $this->existsTitle($sProcessUID, $aData["OUT_DOC_TITLE"])) {
throw (new \Exception(\G::LoadTranslation("ID_OUTPUT_NOT_SAVE")));
}

View File

@@ -593,5 +593,42 @@ class Process
throw $e;
}
}
/**
* Get all Web Entries of a Process
*
* @param string $processUid Unique id of Process
*
* return array Return an array with all Web Entries of a Process
*/
public function getWebEntries($processUid)
{
try {
$arrayWebEntry = array();
//Verify data
$process = new \Process();
if (!$process->exists($processUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" doesn't exist in table {1}")));
}
//Get data
$webEntry = new \BusinessModel\WebEntry();
$arrayWebEntryData = $webEntry->getData($processUid);
foreach ($arrayWebEntryData as $index => $value) {
$row = $value;
$arrayWebEntry[] = $webEntry->getWebEntryDataFromRecord($row);
}
//Return
return $arrayWebEntry;
} catch (\Exception $e) {
throw $e;
}
}
}

View File

@@ -0,0 +1,160 @@
<?php
namespace BusinessModel;
use \G;
class ProjectUser
{
/**
* Return the users to assigned to a process
*
* @param string $sProcessUID {@min 32} {@max 32}
*
* return array
*
* @access public
*/
public function getProjectUsers($sProcessUID)
{
try {
$aUsers = array();
$sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow');
$oCriteria->setDistinct();
$oCriteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME);
$oCriteria->addSelectColumn(\UsersPeer::USR_LASTNAME);
$oCriteria->addSelectColumn(\UsersPeer::USR_USERNAME);
$oCriteria->addSelectColumn(\UsersPeer::USR_EMAIL);
$oCriteria->addSelectColumn(\TaskUserPeer::TAS_UID);
$oCriteria->addSelectColumn(\TaskUserPeer::USR_UID);
$oCriteria->addSelectColumn(\TaskUserPeer::TU_TYPE);
$oCriteria->addSelectColumn(\TaskUserPeer::TU_RELATION);
$oCriteria->addJoin(\TaskUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN);
$oCriteria->addJoin(\TaskUserPeer::TAS_UID, \TaskPeer::TAS_UID, \Criteria::LEFT_JOIN);
$oCriteria->add(\TaskPeer::PRO_UID, $sProcessUID);
$oCriteria->add(\TaskUserPeer::TU_TYPE, 1);
$oCriteria->add(\TaskUserPeer::TU_RELATION, 1);
$oCriteria->addGroupByColumn(USR_UID);
$oDataset = \TaskUserPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
$aUsers[] = array('usr_uid' => $aRow['USR_UID'],
'usr_username' => $aRow['USR_USERNAME'],
'usr_firstname' => $aRow['USR_FIRSTNAME'],
'usr_lastname' => $aRow['USR_LASTNAME']);
$oDataset->next();
}
return $aUsers;
} catch (Exception $e) {
throw $e;
}
}
/**
* Return the users and users groups to assigned to a process
*
* @param string $sProcessUID {@min 32} {@max 32}
*
* return array
*
* @access public
*/
public function getProjectStartingTasks($sProcessUID)
{
try {
$aUsers = array();
$sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow');
$oCriteria->setDistinct();
$oCriteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME);
$oCriteria->addSelectColumn(\UsersPeer::USR_LASTNAME);
$oCriteria->addSelectColumn(\UsersPeer::USR_USERNAME);
$oCriteria->addSelectColumn(\UsersPeer::USR_EMAIL);
$oCriteria->addSelectColumn(\TaskUserPeer::TAS_UID);
$oCriteria->addSelectColumn(\TaskUserPeer::USR_UID);
$oCriteria->addSelectColumn(\TaskUserPeer::TU_TYPE);
$oCriteria->addSelectColumn(\TaskUserPeer::TU_RELATION);
$oCriteria->addJoin(\TaskUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN);
$oCriteria->addJoin(\TaskUserPeer::TAS_UID, \TaskPeer::TAS_UID, \Criteria::LEFT_JOIN);
$oCriteria->add(\TaskPeer::PRO_UID, $sProcessUID);
$oCriteria->add(\TaskUserPeer::TU_TYPE, 1);
$oCriteria->add(\TaskUserPeer::TU_RELATION, 1);
$oCriteria->addGroupByColumn(USR_UID);
$oDataset = \TaskUserPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
\G::LoadClass( 'case' );
$oCase = new \Cases();
$startTasks = $oCase->getStartCases( $aRow['USR_UID'] );
foreach ($startTasks as $task) {
if ((isset( $task['pro_uid'] )) && ($task['pro_uid'] == $sProcessUID)) {
$taskValue = explode( '(', $task['value'] );
$tasksLastIndex = count( $taskValue ) - 1;
$taskValue = explode( ')', $taskValue[$tasksLastIndex] );
//echo "<option value=\"" . $task['uid'] . "\">" . $taskValue[0] . "</option>";
echo $task['uid'] ." ------ ".$aUsers." fin ";
//var_dump($aUsers);
if (in_array($task['uid'], $aUsers)) {
echo "Es mac";
}
$aUsers[] = array(/*'usr_uid' => $aRow['USR_UID'],
'usr_username' => $aRow['USR_USERNAME'],
'usr_firstname' => $aRow['USR_FIRSTNAME'],
'usr_lastname' => $aRow['USR_LASTNAME'],*/
'tas_name' => $taskValue[0],
'tas_uid' => $task['uid']);
if (in_array($task['uid'], $aUsers['tas_uid'] )) {
echo "Es mac";
}
echo $task['uid'] . " ";
$oDataset->next();
}
//$oDataset->next();
}
//die();
$oDataset->next();
}
return $aUsers;
} catch (Exception $e) {
throw $e;
}
}
/**
* Return the users and users groups to assigned to a process
*
* @param string $sProcessUID {@min 32} {@max 32}
* @param string $sUserUID {@min 32} {@max 32}
*
* return array
*
* @access public
*/
public function getProjectStartingTaskUsers($sProcessUID, $sUserUID)
{
try {
$aUsers = array();
\G::LoadClass( 'case' );
$oCase = new \Cases();
$startTasks = $oCase->getStartCases($sUserUID);
foreach ($startTasks as $task) {
if ((isset( $task['pro_uid'] )) && ($task['pro_uid'] == $sProcessUID)) {
$taskValue = explode( '(', $task['value'] );
$tasksLastIndex = count( $taskValue ) - 1;
$taskValue = explode( ')', $taskValue[$tasksLastIndex] );
$aUsers[] = array('tas_uid' => $task['uid'],
'tas_name' => $taskValue[0]);
}
}
return $aUsers;
} catch (Exception $e) {
throw $e;
}
}
}

View File

@@ -589,6 +589,14 @@ class Task
public function getTaskAssignees($sProcessUID, $sTaskUID, $filter, $start, $limit)
{
try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
if (is_null($oProcess)) {
throw (new \Exception( 'This id for `prj_uid`: '. $sProcessUID .' do not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for `act_uid`: '. $sTaskUID .' do not correspond to a registered activity'));
}
$aUsers = array();
$sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow');
@@ -693,6 +701,14 @@ class Task
public function getTaskAvailableAssignee($sProcessUID, $sTaskUID, $filter, $start, $limit)
{
try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
if (is_null($oProcess)) {
throw (new \Exception( 'This id for `prj_uid`: '. $sProcessUID .' do not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for `act_uid`: '. $sTaskUID .' do not correspond to a registered activity'));
}
$iType = 1;
$aUsers = array();
$oTasks = new \Tasks();
@@ -788,6 +804,14 @@ class Task
public function getTaskAssignee($sProcessUID, $sTaskUID, $sAssigneeUID)
{
try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
if (is_null($oProcess)) {
throw (new \Exception( 'This id for `prj_uid`: '. $sProcessUID .' do not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for `act_uid`: '. $sTaskUID .' do not correspond to a registered activity'));
}
$iType = 1;
$aUsers = array();
$sDelimiter = \DBAdapter::getStringDelimiter();
@@ -889,6 +913,14 @@ class Task
public function addTaskAssignee($sProcessUID, $sTaskUID, $sAssigneeUID, $assType)
{
try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
if (is_null($oProcess)) {
throw (new \Exception( 'This id for `prj_uid`: '. $sProcessUID .' do not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for `act_uid`: '. $sTaskUID .' do not correspond to a registered activity'));
}
$iType = 1;
$oCriteria = new \Criteria('workflow');
$oCriteria->addSelectColumn( \TaskUserPeer::TU_RELATION );
@@ -952,6 +984,14 @@ class Task
public function removeTaskAssignee($sProcessUID, $sTaskUID, $sAssigneeUID)
{
try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
if (is_null($oProcess)) {
throw (new \Exception( 'This id for `prj_uid`: '. $sProcessUID .' do not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for `act_uid`: '. $sTaskUID .' do not correspond to a registered activity'));
}
$iType = 1;
$oCriteria = new \Criteria('workflow');
$oCriteria->addSelectColumn( \TaskUserPeer::TU_RELATION );
@@ -988,6 +1028,14 @@ class Task
public function getTaskAdhocAssignees($sProcessUID, $sTaskUID, $filter, $start, $limit)
{
try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
if (is_null($oProcess)) {
throw (new \Exception( 'This id for `prj_uid`: '. $sProcessUID .' do not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for `act_uid`: '. $sTaskUID .' do not correspond to a registered activity'));
}
$aUsers = array();
$sDelimiter = \DBAdapter::getStringDelimiter();
$oCriteria = new \Criteria('workflow');
@@ -1089,6 +1137,14 @@ class Task
public function getTaskAvailableAdhocAssignee($sProcessUID, $sTaskUID, $filter, $start, $limit)
{
try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
if (is_null($oProcess)) {
throw (new \Exception( 'This id for `prj_uid`: '. $sProcessUID .' do not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for `act_uid`: '. $sTaskUID .' do not correspond to a registered activity'));
}
$iType = 2;
$aUsers = array();
$oTasks = new \Tasks();
@@ -1184,6 +1240,14 @@ class Task
public function getTaskAdhocAssignee($sProcessUID, $sTaskUID, $sAssigneeUID)
{
try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
if (is_null($oProcess)) {
throw (new \Exception( 'This id for `prj_uid`: '. $sProcessUID .' do not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for `act_uid`: '. $sTaskUID .' do not correspond to a registered activity'));
}
$iType = 2;
$aUsers = array();
$sDelimiter = \DBAdapter::getStringDelimiter();
@@ -1285,6 +1349,14 @@ class Task
public function addTaskAdhocAssignee($sProcessUID, $sTaskUID, $sAssigneeUID, $assType)
{
try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
if (is_null($oProcess)) {
throw (new \Exception( 'This id for `prj_uid`: '. $sProcessUID .' do not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for `act_uid`: '. $sTaskUID .' do not correspond to a registered activity'));
}
$iType = 2;
$oCriteria = new \Criteria('workflow');
$oCriteria->addSelectColumn( \TaskUserPeer::TU_RELATION );
@@ -1348,6 +1420,14 @@ class Task
public function removeTaskAdhocAssignee($sProcessUID, $sTaskUID, $sAssigneeUID)
{
try {
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
if (is_null($oProcess)) {
throw (new \Exception( 'This id for `prj_uid`: '. $sProcessUID .' do not correspond to a registered process'));
}
$oActivity = \TaskPeer::retrieveByPK( $sTaskUID );
if (is_null($oActivity)) {
throw (new \Exception( 'This id for `act_uid`: '. $sTaskUID .' do not correspond to a registered activity'));
}
$iType = 2;
$oCriteria = new \Criteria('workflow');
$oCriteria->addSelectColumn( \TaskUserPeer::TU_RELATION );

View File

@@ -0,0 +1,226 @@
<?php
namespace BusinessModel;
class WebEntry
{
/**
* Get all Web Entries data of a Process
*
* @param string $processUid Unique id of Process
* @param string $option Option (ALL, UID, DYN_UID)
* @param string $taskUid Unique id of Task
* @param string $dynaFormUid Unique id of DynaForm
*
* return array Return an array with all Web Entries data of a Process
*/
public function getData($processUid, $option = "ALL", $taskUid = "", $dynaFormUid = "")
{
try {
$arrayData = array();
$webEntryPath = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $processUid;
if (is_dir($webEntryPath)) {
$task = new \Task();
$dynaForm = new \Dynaform();
$step = new \BusinessModel\Step();
$arrayDirFile = scandir($webEntryPath); //Ascending Order
$nrt = array("\n", "\r", "\t");
$nrthtml = array("(n /)", "(r /)", "(t /)");
$http = (\G::is_https())? "https://" : "http://";
$url = $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $processUid;
$flagNext = 1;
for ($i = 0; $i <= count($arrayDirFile) - 1 && $flagNext == 1; $i++) {
$file = $arrayDirFile[$i];
if ($file != "" && $file != "." && $file != ".." && is_file($webEntryPath . PATH_SEP . $file)) {
$one = 0;
$two = 0;
$one = count(explode("wsClient.php", $file));
$two = count(explode("Post.php", $file));
if ($one == 1 && $two == 1) {
$arrayInfo = pathinfo($file);
$weTaskUid = "";
$weDynaFormUid = "";
$weFileName = $arrayInfo["filename"];
$strContent = str_replace($nrt, $nrthtml, file_get_contents($webEntryPath . PATH_SEP . $weFileName . ".php"));
if (preg_match("/^.*CURRENT_DYN_UID.*=.*[\"\'](\w{32})[\"\'].*$/", $strContent, $arrayMatch)) {
$weDynaFormUid = $arrayMatch[1];
}
if (file_exists($webEntryPath . PATH_SEP . $weFileName . "Post.php")) {
$strContent = str_replace($nrt, $nrthtml, file_get_contents($webEntryPath . PATH_SEP . $weFileName . "Post.php"));
if (preg_match("/^.*ws_newCase\s*\(\s*[\"\']" . $processUid . "[\"\']\s*\,\s*[\"\'](\w{32})[\"\'].*\)\s*\;.*$/", $strContent, $arrayMatch)) {
$weTaskUid = $arrayMatch[1];
}
}
if ($weTaskUid != "" && $weDynaFormUid != "") {
$flagPush = 0;
switch ($option) {
case "ALL":
if ($step->existsRecord($weTaskUid, "DYNAFORM", $weDynaFormUid)) {
$flagPush = 1;
}
break;
case "UID":
if ($taskUid != "" && $dynaFormUid != "" && $weTaskUid == $taskUid && $weDynaFormUid == $dynaFormUid && $step->existsRecord($weTaskUid, "DYNAFORM", $weDynaFormUid)) {
$flagPush = 1;
$flagNext = 0;
}
break;
case "DYN_UID":
if ($dynaFormUid != "" && $weDynaFormUid == $dynaFormUid && $step->existsRecord($weTaskUid, "DYNAFORM", $weDynaFormUid)) {
$flagPush = 1;
$flagNext = 0;
}
break;
}
if ($flagPush == 1) {
$arrayTaskData = $task->load($weTaskUid);
$arrayDynaFormData = $dynaForm->Load($weDynaFormUid);
$arrayData[$weTaskUid . "/" . $weDynaFormUid] = array(
"processUid" => $processUid,
"taskUid" => $weTaskUid,
"taskTitle" => $arrayTaskData["TAS_TITLE"],
"dynaFormUid" => $weDynaFormUid,
"dynaFormTitle" => $arrayDynaFormData["DYN_TITLE"],
"fileName" => $weFileName,
"url" => $url . "/" . $weFileName . ".php"
);
}
}
}
}
}
}
return $arrayData;
} catch (\Exception $e) {
throw $e;
}
}
/**
* Create Web Entry for a Process
*
* @param string $processUid Unique id of Process
* @param array $arrayData Data
*
* return array Return data of the new Web Entry created
*/
public function create($processUid, $arrayData)
{
try {
//
} catch (\Exception $e) {
throw $e;
}
}
/**
* Delete Web Entry
*
* @param string $processUid Unique id of Process
* @param string $taskUid Unique id of Task
* @param string $dynaFormUid Unique id of DynaForm
*
* return void
*/
public function delete($processUid, $taskUid, $dynaFormUid)
{
try {
//Verify data
$process = new \Process();
if (!$process->exists($processUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" doesn't exist in table {1}")));
}
$arrayWebEntryData = $this->getData($processUid, "UID", $taskUid, $dynaFormUid);
if (count($arrayWebEntryData) == 0) {
throw (new \Exception("The Web Entry doesn't exist"));
}
//Delete
$webEntryPath = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP . $processUid;
unlink($webEntryPath . PATH_SEP . $arrayWebEntryData[$taskUid . "/" . $dynaFormUid]["fileName"] . ".php");
unlink($webEntryPath . PATH_SEP . $arrayWebEntryData[$taskUid . "/" . $dynaFormUid]["fileName"] . "Post.php");
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get data of a Web Entry from a record
*
* @param array $record Record
*
* return array Return an array with data of a Web Entry
*/
public function getWebEntryDataFromRecord($record)
{
try {
return array(
"tas_uid" => $record["taskUid"],
"tas_title" => $record["taskTitle"],
"dyn_uid" => $record["dynaFormUid"],
"dyn_title" => $record["dynaFormTitle"],
"url" => $record["url"]
);
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get data of a Web Entry
*
* @param string $processUid Unique id of Process
* @param string $taskUid Unique id of Task
* @param string $dynaFormUid Unique id of DynaForm
*
* return array Return an array with data of a Web Entry
*/
public function getWebEntry($processUid, $taskUid, $dynaFormUid)
{
try {
//Verify data
$process = new \Process();
if (!$process->exists($processUid)) {
throw (new \Exception(str_replace(array("{0}", "{1}"), array($processUid, "PROCESS"), "The UID \"{0}\" doesn't exist in table {1}")));
}
$arrayWebEntryData = $this->getData($processUid, "UID", $taskUid, $dynaFormUid);
if (count($arrayWebEntryData) == 0) {
throw (new \Exception("The Web Entry doesn't exist"));
}
//Get data
//Return
return $this->getWebEntryDataFromRecord($arrayWebEntryData[$taskUid . "/" . $dynaFormUid]);
} catch (\Exception $e) {
throw $e;
}
}
}

View File

@@ -182,5 +182,23 @@ class Project extends Api
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* @url GET /:projectUid/web-entries
*
* @param string $projectUid {@min 32}{@max 32}
*/
public function doGetWebEntries($projectUid)
{
try {
$process = new \BusinessModel\Process();
$response = $process->getWebEntries($projectUid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}

View File

@@ -14,8 +14,8 @@ class Assignee extends Api
/**
* @url GET /:prjUid/activity/:actUid/assignee
*
* @param string $prjUid
* @param string $actUid
* @param string $prjUid {@min 32} {@max 32}
* @param string $actUid {@min 32} {@max 32}
* @param string $filter
* @param int $start
* @param int $limit
@@ -39,8 +39,8 @@ class Assignee extends Api
/**
* @url GET /:prjUid/activity/:actUid/available-assignee
*
* @param string $prjUid
* @param string $actUid
* @param string $prjUid {@min 32} {@max 32}
* @param string $actUid {@min 32} {@max 32}
* @param string $filter
* @param int $start
* @param int $limit
@@ -64,9 +64,9 @@ class Assignee extends Api
/**
* @url GET /:prjUid/activity/:actUid/assignee/:aasUid
*
* @param string $prjUid
* @param string $actUid
* @param string $aasUid
* @param string $prjUid {@min 32} {@max 32}
* @param string $actUid {@min 32} {@max 32}
* @param string $aasUid {@min 32} {@max 32}
*
*/
public function doGetActivityAssignee($prjUid, $actUid, $aasUid)
@@ -87,9 +87,9 @@ class Assignee extends Api
/**
* @url POST /:prjUid/activity/:actUid/assignee
*
* @param string $prjUid
* @param string $actUid
* @param string $aas_uid
* @param string $prjUid {@min 32} {@max 32}
* @param string $actUid {@min 32} {@max 32}
* @param string $aas_uid {@min 32} {@max 32}
* @param string $aas_type {@choice user,group}
*
* @status 201
@@ -109,9 +109,9 @@ class Assignee extends Api
/**
* @url DELETE /:prjUid/activity/:actUid/assignee/:aasUid
*
* @param string $prjUid
* @param string $actUid
* @param string $aasUid
* @param string $prjUid {@min 32} {@max 32}
* @param string $actUid {@min 32} {@max 32}
* @param string $aasUid {@min 32} {@max 32}
*
*/
public function doDeleteActivityAssignee($prjUid, $actUid, $aasUid)
@@ -129,8 +129,8 @@ class Assignee extends Api
/**
* @url GET /:prjUid/activity/:actUid/adhoc-assignee
*
* @param string $prjUid
* @param string $actUid
* @param string $prjUid {@min 32} {@max 32}
* @param string $actUid {@min 32} {@max 32}
* @param string $filter
* @param int $start
* @param int $limit
@@ -154,8 +154,8 @@ class Assignee extends Api
/**
* @url GET /:prjUid/activity/:actUid/adhoc-available-assignee
*
* @param string $prjUid
* @param string $actUid
* @param string $prjUid {@min 32} {@max 32}
* @param string $actUid {@min 32} {@max 32}
* @param string $filter
* @param int $start
* @param int $limit
@@ -179,9 +179,9 @@ class Assignee extends Api
/**
* @url GET /:prjUid/activity/:actUid/adhoc-assignee/:aasUid
*
* @param string $prjUid
* @param string $actUid
* @param string $assUid
* @param string $prjUid {@min 32} {@max 32}
* @param string $actUid {@min 32} {@max 32}
* @param string $assUid {@min 32} {@max 32}
*
*/
public function doGetActivityAdhocAssignee($prjUid, $actUid, $aasUid)
@@ -202,9 +202,9 @@ class Assignee extends Api
/**
* @url POST /:prjUid/activity/:actUid/adhoc-assignee
*
* @param string $prjUid
* @param string $actUid
* @param string $ada_uid
* @param string $prjUid {@min 32} {@max 32}
* @param string $actUid {@min 32} {@max 32}
* @param string $ada_uid {@min 32} {@max 32}
* @param string $ada_type {@choice user,group}
*
* @status 201
@@ -224,9 +224,9 @@ class Assignee extends Api
/**
* @url DELETE /:prjUid/activity/:actUid/adhoc-assignee/:adaUid
*
* @param string $prjUid
* @param string $actUid
* @param string $adaUid
* @param string $prjUid {@min 32} {@max 32}
* @param string $actUid {@min 32} {@max 32}
* @param string $adaUid {@min 32} {@max 32}
*
*/
public function doDeleteActivityAdhocAssignee($prjUid, $actUid, $adaUid)

View File

@@ -0,0 +1,75 @@
<?php
namespace Services\Api\ProcessMaker\Project;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
* Project\ProjectUsers Api Controller
*
* @protected
*/
class ProjectUsers extends Api
{
/**
* @param string $prjUid {@min 32} {@max 32}
*
* @url GET /:prjUid/users
*/
public function doGetProjectUsers($prjUid)
{
try {
$supervisor = new \BusinessModel\ProjectUser();
$arrayData = $supervisor->getProjectUsers($prjUid);
//Response
$response = $arrayData;
} catch (\Exception $e) {
//response
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
return $response;
}
/**
* @param string $prjUid {@min 32} {@max 32}
*
* @url GET /:prjUid/starting-tasks
*/
public function doGetProjectStartingTasks($prjUid)
{
try {
$supervisor = new \BusinessModel\ProjectUser();
$arrayData = $supervisor->getProjectStartingTasks($prjUid);
//Response
$response = $arrayData;
} catch (\Exception $e) {
//response
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
return $response;
}
/**
* @param string $prjUid {@min 32} {@max 32}
* @param string $usrUid {@min 32} {@max 32}
*
* @url GET /:prjUid/user/:usrUid/starting-tasks
*/
public function doGetProjectStartingTaskUsers($prjUid, $usrUid)
{
try {
$supervisor = new \BusinessModel\ProjectUser();
$arrayData = $supervisor->getProjectStartingTaskUsers($prjUid, $usrUid);
//Response
$response = $arrayData;
} catch (\Exception $e) {
//response
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
return $response;
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace Services\Api\ProcessMaker\Project;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
* Project\WebEntry Api Controller
*
* @protected
*/
class WebEntry extends Api
{
/**
* @url GET /:projectUid/web-entry/:activityUid/:dynaFormUid
*
* @param string $dynaFormUid {@min 32}{@max 32}
* @param string $activityUid {@min 32}{@max 32}
* @param string $projectUid {@min 32}{@max 32}
*/
public function doGetWebEntry($dynaFormUid, $activityUid, $projectUid)
{
try {
$webEntry = new \BusinessModel\WebEntry();
$response = $webEntry->getWebEntry($projectUid, $activityUid, $dynaFormUid);
return $response;
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
///**
// * @url POST /:projectUid/case-tracker/object
// *
// * @param string $projectUid {@min 32}{@max 32}
// * @param array $request_data
// * @param string $cto_type_obj {@from body}{@choice DYNAFORM,INPUT_DOCUMENT,OUTPUT_DOCUMENT}{@required true}
// * @param string $cto_uid_obj {@from body}{@min 32}{@max 32}{@required true}
// * @param string $cto_condition
// * @param int $cto_position {@from body}{@min 1}
// *
// * @status 201
// */
//public function doPostWebEntry(
// $projectUid,
// $request_data,
// $cto_type_obj = "DYNAFORM",
// $cto_uid_obj = "00000000000000000000000000000000",
// $cto_condition = "",
// $cto_position = 1
//) {
// try {
// $caseTrackerObject = new \BusinessModel\WebEntry();
//
// $arrayData = $caseTrackerObject->create($projectUid, $request_data);
//
// $response = $arrayData;
//
// return $response;
// } catch (\Exception $e) {
// throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
// }
//}
/**
* @url DELETE /:projectUid/web-entry/:activityUid/:dynaFormUid
*
* @param string $dynaFormUid {@min 32}{@max 32}
* @param string $activityUid {@min 32}{@max 32}
* @param string $projectUid {@min 32}{@max 32}
*/
public function doDeleteWebEntry($dynaFormUid, $activityUid, $projectUid)
{
try {
$webEntry = new \BusinessModel\WebEntry();
$webEntry->delete($projectUid, $activityUid, $dynaFormUid);
} catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
}

View File

@@ -28,7 +28,8 @@ debug = 1
case-scheduler = "Services\Api\ProcessMaker\Project\CaseScheduler"
case-tracker = "Services\Api\ProcessMaker\Project\CaseTracker"
case-tracker-object = "Services\Api\ProcessMaker\Project\CaseTrackerObject"
data-base-connections = "Services\Api\ProcessMaker\Project\DataBaseConnection"
project-users = "Services\Api\ProcessMaker\Project\ProjectUsers"
web-entry = "Services\Api\ProcessMaker\Project\WebEntry"
[alias: projects]
project = "Services\Api\ProcessMaker\Project"