Merge branch 'master' of bitbucket.org:colosa/processmaker into CONSOLIDATED
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
/**
|
||||
* Description of ActionsByEmailService
|
||||
*
|
||||
*/
|
||||
class ActionsByEmail
|
||||
{
|
||||
|
||||
public function saveConfiguration($params)
|
||||
{
|
||||
if (\PMLicensedFeatures
|
||||
::getSingleton()
|
||||
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
|
||||
$feature = $params['ActionsByEmail'];
|
||||
switch ($feature['type']) {
|
||||
case 'configuration':
|
||||
require_once 'classes/model/AbeConfiguration.php';
|
||||
$abeConfigurationInstance = new \AbeConfiguration();
|
||||
$noteValues = json_decode($feature['fields']['ABE_CASE_NOTE_IN_RESPONSE']);
|
||||
foreach ($noteValues as $value) {
|
||||
$feature['fields']['ABE_CASE_NOTE_IN_RESPONSE'] = $value;
|
||||
}
|
||||
$abeConfigurationInstance->createOrUpdate($feature['fields']);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function loadConfiguration($params)
|
||||
{
|
||||
if ($params['type'] != 'activity'
|
||||
|| !\PMLicensedFeatures
|
||||
::getSingleton()
|
||||
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0='))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
require_once 'classes/model/AbeConfiguration.php';
|
||||
|
||||
$criteria = new \Criteria();
|
||||
$criteria->add(\AbeConfigurationPeer::PRO_UID, $params['PRO_UID']);
|
||||
$criteria->add(\AbeConfigurationPeer::TAS_UID, $params['TAS_UID']);
|
||||
$result = \AbeConfigurationPeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$result->next();
|
||||
$configuration = array();
|
||||
if ($configuration = $result->getRow()) {
|
||||
$configuration['ABE_EMAIL_FIELD_VALUE'] = $configuration['ABE_EMAIL_FIELD'];
|
||||
$configuration['ABE_ACTION_FIELD_VALUE'] = $configuration['ABE_ACTION_FIELD'];
|
||||
$configuration['ABE_CASE_NOTE_IN_RESPONSE'] = $configuration['ABE_CASE_NOTE_IN_RESPONSE'] ? '["1"]' : '[]';
|
||||
}
|
||||
$configuration['feature'] = 'ActionsByEmail';
|
||||
$configuration['prefix'] = 'abe';
|
||||
$configuration['PRO_UID'] = $params['PRO_UID'];
|
||||
$configuration['TAS_UID'] = $params['TAS_UID'];
|
||||
$configuration['SYS_LANG'] = SYS_LANG;
|
||||
return $configuration;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1991,7 +1991,7 @@ class Cases
|
||||
}
|
||||
|
||||
//Element origin and dest
|
||||
$messageEventTaskRelation = new \ProcessMaker\BusinessModel\MessageEventTaskRelation();
|
||||
$elementTaskRelation = new \ProcessMaker\BusinessModel\ElementTaskRelation();
|
||||
|
||||
$arrayElement = array(
|
||||
"elementOrigin" => array("uid" => $elementOriginUid, "type" => "bpmnActivity"),
|
||||
@@ -1999,16 +1999,17 @@ class Cases
|
||||
);
|
||||
|
||||
foreach ($arrayElement as $key => $value) {
|
||||
$arrayMessageEventTaskRelationData = $messageEventTaskRelation->getMessageEventTaskRelationWhere(
|
||||
$arrayElementTaskRelationData = $elementTaskRelation->getElementTaskRelationWhere(
|
||||
array(
|
||||
\MessageEventTaskRelationPeer::PRJ_UID => $arrayApplicationData["PRO_UID"],
|
||||
\MessageEventTaskRelationPeer::TAS_UID => $arrayElement[$key]["uid"]
|
||||
\ElementTaskRelationPeer::PRJ_UID => $arrayApplicationData["PRO_UID"],
|
||||
\ElementTaskRelationPeer::ELEMENT_TYPE => "bpmnEvent",
|
||||
\ElementTaskRelationPeer::TAS_UID => $arrayElement[$key]["uid"]
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
if (!is_null($arrayMessageEventTaskRelationData)) {
|
||||
$arrayElement[$key]["uid"] = $arrayMessageEventTaskRelationData["EVN_UID"];
|
||||
if (!is_null($arrayElementTaskRelationData)) {
|
||||
$arrayElement[$key]["uid"] = $arrayElementTaskRelationData["ELEMENT_UID"];
|
||||
$arrayElement[$key]["type"] = "bpmnEvent";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,65 @@ use \DepartmentPeer;
|
||||
*/
|
||||
class Department
|
||||
{
|
||||
/**
|
||||
* Verify if exists the title of a Department
|
||||
*
|
||||
* @param string $departmentTitle Title
|
||||
* @param string $departmentUidExclude Unique id of Department to exclude
|
||||
*
|
||||
* return bool Return true if exists the title of a Department, false otherwise
|
||||
*/
|
||||
public function existsTitle($departmentTitle, $departmentUidExclude = "")
|
||||
{
|
||||
try {
|
||||
$delimiter = \DBAdapter::getStringDelimiter();
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\DepartmentPeer::DEP_UID);
|
||||
|
||||
$criteria->addAlias("CT", \ContentPeer::TABLE_NAME);
|
||||
|
||||
$arrayCondition = array();
|
||||
$arrayCondition[] = array(\DepartmentPeer::DEP_UID, "CT.CON_ID", \Criteria::EQUAL);
|
||||
$arrayCondition[] = array("CT.CON_CATEGORY", $delimiter . "DEPO_TITLE" . $delimiter, \Criteria::EQUAL);
|
||||
$arrayCondition[] = array("CT.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL);
|
||||
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
|
||||
|
||||
if ($departmentUidExclude != "") {
|
||||
$criteria->add(\DepartmentPeer::DEP_UID, $departmentUidExclude, \Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
$criteria->add("CT.CON_VALUE", $departmentTitle, \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \DepartmentPeer::doSelectRS($criteria);
|
||||
|
||||
return ($rsCriteria->next())? true : false;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if exists the title of a Department
|
||||
*
|
||||
* @param string $departmentTitle Title
|
||||
* @param string $fieldNameForException Field name for the exception
|
||||
* @param string $departmentUidExclude Unique id of Department to exclude
|
||||
*
|
||||
* return void Throw exception if exists the title of a Department
|
||||
*/
|
||||
public function throwExceptionIfExistsTitle($departmentTitle, $fieldNameForException, $departmentUidExclude = "")
|
||||
{
|
||||
try {
|
||||
if ($this->existsTitle($departmentTitle, $departmentUidExclude)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_DEPARTMENT_TITLE_ALREADY_EXISTS", array($fieldNameForException, $departmentTitle)));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get list for Departments
|
||||
*
|
||||
@@ -76,9 +135,24 @@ class Department
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAvailableUser($dep_uid)
|
||||
public function getAvailableUser($dep_uid, $start = 0, $limit = 0, $search = '')
|
||||
{
|
||||
$dep_uid = Validator::depUid($dep_uid);
|
||||
|
||||
$start = (int)$start;
|
||||
$start = abs($start);
|
||||
if ($start != 0) {
|
||||
$start+1;
|
||||
}
|
||||
|
||||
$limit = (int)$limit;
|
||||
$limit = abs($limit);
|
||||
if ($limit == 0) {
|
||||
$limit = 25;
|
||||
} else {
|
||||
$limit = (int)$limit;
|
||||
}
|
||||
|
||||
$oCriteria = new \Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( UsersPeer::USR_UID );
|
||||
$oCriteria->addSelectColumn( UsersPeer::USR_USERNAME );
|
||||
@@ -88,6 +162,13 @@ class Department
|
||||
$oCriteria->add( UsersPeer::DEP_UID, '' );
|
||||
$oCriteria->add( UsersPeer::USR_STATUS, 'CLOSED', \Criteria::NOT_EQUAL );
|
||||
|
||||
$oCriteria->setLimit( $limit );
|
||||
$oCriteria->setOffset( $start );
|
||||
|
||||
if ($search != '') {
|
||||
$oCriteria->add( $oCriteria->getNewCriterion( UsersPeer::USR_USERNAME, '%' . $search . '%', \Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_FIRSTNAME, '%' . $search . '%', \Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( UsersPeer::USR_LASTNAME, '%' . $search . '%', \Criteria::LIKE ) ) ) );
|
||||
}
|
||||
|
||||
$oDataset = UsersPeer::doSelectRS( $oCriteria );
|
||||
$oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
|
||||
$aUsers = array ();
|
||||
@@ -99,25 +180,63 @@ class Department
|
||||
}
|
||||
|
||||
/**
|
||||
* Put Assign User
|
||||
* Assign User to Department
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @param string $departmentUid Unique id of Department
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* @return void
|
||||
* return array Return data of the User assigned to Department
|
||||
*/
|
||||
public function assignUser($dep_uid, $usr_uid)
|
||||
public function assignUser($departmentUid, array $arrayData)
|
||||
{
|
||||
$dep_uid = Validator::depUid($dep_uid);
|
||||
$usr_uid = Validator::usrUid($usr_uid);
|
||||
try {
|
||||
//Verify data
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
$validator = new \ProcessMaker\BusinessModel\Validator();
|
||||
|
||||
$dep = new \Department();
|
||||
$dep->load($dep_uid);
|
||||
$dep_manager = $dep->getDepManager();
|
||||
$manager = ($dep_manager == '') ? true : false;
|
||||
$dep->addUserToDepartment( $dep_uid, $usr_uid, $manager, false );
|
||||
$dep->updateDepartmentManager( $dep_uid );
|
||||
$validator->throwExceptionIfDataIsNotArray($arrayData, "\$arrayData");
|
||||
$validator->throwExceptionIfDataIsEmpty($arrayData, "\$arrayData");
|
||||
|
||||
//Set data
|
||||
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||
|
||||
unset($arrayData["DEP_UID"]);
|
||||
|
||||
//Set variables
|
||||
$arrayUserFieldDefinition = array(
|
||||
"DEP_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "departmentUid"),
|
||||
"USR_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "userUid")
|
||||
);
|
||||
|
||||
$arrayUserFieldNameForException = array(
|
||||
"departmentUid" => strtolower("DEP_UID"),
|
||||
"userUid" => strtolower("USR_UID")
|
||||
);
|
||||
|
||||
//Verify data
|
||||
$departmentUid = \ProcessMaker\BusinessModel\Validator::depUid($departmentUid);
|
||||
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $arrayUserFieldDefinition, $arrayUserFieldNameForException, true);
|
||||
|
||||
$process->throwExceptionIfNotExistsUser($arrayData["USR_UID"], $arrayUserFieldNameForException["userUid"]);
|
||||
|
||||
//Assign User
|
||||
$department = new \Department();
|
||||
|
||||
$department->load($departmentUid);
|
||||
|
||||
$department->addUserToDepartment($departmentUid, $arrayData["USR_UID"], ($department->getDepManager() == "")? true : false, false);
|
||||
$department->updateDepartmentManager($departmentUid);
|
||||
|
||||
//Return
|
||||
$arrayData = array_merge(array("DEP_UID" => $departmentUid), $arrayData);
|
||||
|
||||
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
|
||||
|
||||
return $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,11 +279,26 @@ class Department
|
||||
$dep_uid = Validator::depUid($dep_uid);
|
||||
$usr_uid = Validator::usrUid($usr_uid);
|
||||
|
||||
$oCriteria = new \Criteria( 'workflow' );
|
||||
$oCriteria->addSelectColumn( DepartmentPeer::DEP_UID );
|
||||
$oCriteria->add( DepartmentPeer::DEP_MANAGER, $usr_uid, \Criteria::EQUAL );
|
||||
|
||||
$oDataset = DepartmentPeer::doSelectRS( $oCriteria );
|
||||
$oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
|
||||
if ($oDataset->next()) {
|
||||
throw (new \Exception(\G::LoadTranslation("ID_DEPARTMENT_MANAGER_EXIST", array('usr_uid',$usr_uid))));
|
||||
}
|
||||
|
||||
$editDepartment['DEP_UID'] = $dep_uid;
|
||||
$editDepartment['DEP_MANAGER'] = $usr_uid;
|
||||
$oDept = new \Department();
|
||||
$oDept->update( $editDepartment );
|
||||
$oDept->updateDepartmentManager( $dep_uid );
|
||||
|
||||
$oDept = new \Department();
|
||||
$oDept->load($dep_uid);
|
||||
$oDept->addUserToDepartment($dep_uid, $usr_uid, ($oDept->getDepManager() == "")? true : false, false);
|
||||
$oDept->updateDepartmentManager($dep_uid);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,6 +342,10 @@ class Department
|
||||
$node['DEP_MANAGER_LASTNAME'] = '';
|
||||
}
|
||||
|
||||
$criteria = new \Criteria();
|
||||
$criteria->add(UsersPeer::DEP_UID, $dep_uid, \Criteria::EQUAL );
|
||||
$node['DEP_MEMBERS'] = UsersPeer::doCount($criteria);
|
||||
|
||||
$criteriaCount = new \Criteria( 'workflow' );
|
||||
$criteriaCount->clearSelectColumns();
|
||||
$criteriaCount->addSelectColumn( 'COUNT(*)' );
|
||||
@@ -239,6 +377,11 @@ class Department
|
||||
Validator::isBoolean($create, '$create');
|
||||
|
||||
$dep_data = array_change_key_case($dep_data, CASE_UPPER);
|
||||
|
||||
if ($create) {
|
||||
unset($dep_data["DEP_UID"]);
|
||||
}
|
||||
|
||||
$oDepartment = new \Department();
|
||||
if (isset($dep_data['DEP_UID']) && $dep_data['DEP_UID'] != '') {
|
||||
Validator::depUid($dep_data['DEP_UID']);
|
||||
@@ -254,18 +397,21 @@ class Department
|
||||
}
|
||||
|
||||
if (!$create) {
|
||||
$dep_data['DEPO_TITLE'] = $dep_data['DEP_TITLE'];
|
||||
if (isset($dep_data['DEP_TITLE'])) {
|
||||
Validator::depTitle($dep_data['DEP_TITLE'], $dep_data['DEP_UID']);
|
||||
if (isset($dep_data["DEP_TITLE"])) {
|
||||
$this->throwExceptionIfExistsTitle($dep_data["DEP_TITLE"], strtolower("DEP_TITLE"), $dep_data["DEP_UID"]);
|
||||
|
||||
$dep_data["DEPO_TITLE"] = $dep_data["DEP_TITLE"];
|
||||
}
|
||||
|
||||
$oDepartment->update($dep_data);
|
||||
$oDepartment->updateDepartmentManager($dep_data['DEP_UID']);
|
||||
} else {
|
||||
if (isset($dep_data['DEP_TITLE'])) {
|
||||
Validator::depTitle($dep_data['DEP_TITLE']);
|
||||
$this->throwExceptionIfExistsTitle($dep_data["DEP_TITLE"], strtolower("DEP_TITLE"));
|
||||
} else {
|
||||
throw (new \Exception(\G::LoadTranslation("ID_FIELD_REQUIRED", array('dep_title'))));
|
||||
}
|
||||
|
||||
$dep_uid = $oDepartment->create($dep_data);
|
||||
$response = $this->getDepartment($dep_uid);
|
||||
return $response;
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
class MessageEventTaskRelation
|
||||
class ElementTaskRelation
|
||||
{
|
||||
private $arrayFieldDefinition = array(
|
||||
"MSGETR_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "messageEventTaskRelationUid"),
|
||||
"ETR_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "elementTaskRelationUid"),
|
||||
|
||||
"PRJ_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "projectUid"),
|
||||
"EVN_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "eventUid"),
|
||||
"TAS_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "taskUid")
|
||||
"PRJ_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "projectUid"),
|
||||
"ELEMENT_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "elementUid"),
|
||||
"ELEMENT_TYPE" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "elementType"),
|
||||
"TAS_UID" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "taskUid")
|
||||
);
|
||||
|
||||
private $formatFieldNameInUppercase = true;
|
||||
@@ -84,16 +85,16 @@ class MessageEventTaskRelation
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if exists the Message-Event-Task-Relation
|
||||
* Verify if exists the Element-Task-Relation
|
||||
*
|
||||
* @param string $messageEventTaskRelationUid Unique id of Message-Event-Task-Relation
|
||||
* @param string $elementTaskRelationUid Unique id of Element-Task-Relation
|
||||
*
|
||||
* return bool Return true if exists the Message-Event-Task-Relation, false otherwise
|
||||
* return bool Return true if exists the Element-Task-Relation, false otherwise
|
||||
*/
|
||||
public function exists($messageEventTaskRelationUid)
|
||||
public function exists($elementTaskRelationUid)
|
||||
{
|
||||
try {
|
||||
$obj = \MessageEventTaskRelationPeer::retrieveByPK($messageEventTaskRelationUid);
|
||||
$obj = \ElementTaskRelationPeer::retrieveByPK($elementTaskRelationUid);
|
||||
|
||||
return (!is_null($obj))? true : false;
|
||||
} catch (\Exception $e) {
|
||||
@@ -102,18 +103,18 @@ class MessageEventTaskRelation
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if does not exists the Message-Event-Task-Relation
|
||||
* Verify if does not exists the Element-Task-Relation
|
||||
*
|
||||
* @param string $messageEventTaskRelationUid Unique id of Message-Event-Task-Relation
|
||||
* @param string $fieldNameForException Field name for the exception
|
||||
* @param string $elementTaskRelationUid Unique id of Element-Task-Relation
|
||||
* @param string $fieldNameForException Field name for the exception
|
||||
*
|
||||
* return void Throw exception if does not exists the Message-Event-Task-Relation
|
||||
* return void Throw exception if does not exists the Element-Task-Relation
|
||||
*/
|
||||
public function throwExceptionIfNotExistsMessageEventTaskRelation($messageEventTaskRelationUid, $fieldNameForException)
|
||||
public function throwExceptionIfNotExistsElementTaskRelation($elementTaskRelationUid, $fieldNameForException)
|
||||
{
|
||||
try {
|
||||
if (!$this->exists($messageEventTaskRelationUid)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_MESSAGE_EVENT_TASK_RELATION_DOES_NOT_EXIST", array($fieldNameForException, $messageEventTaskRelationUid)));
|
||||
if (!$this->exists($elementTaskRelationUid)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_MESSAGE_EVENT_TASK_RELATION_DOES_NOT_EXIST", array($fieldNameForException, $elementTaskRelationUid)));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
@@ -123,20 +124,20 @@ class MessageEventTaskRelation
|
||||
/**
|
||||
* Validate the data if they are invalid (INSERT and UPDATE)
|
||||
*
|
||||
* @param string $messageEventTaskRelationUid Unique id of Message-Event-Task-Relation
|
||||
* @param string $projectUid Unique id of Project
|
||||
* @param array $arrayData Data
|
||||
* @param string $elementTaskRelationUid Unique id of Element-Task-Relation
|
||||
* @param string $projectUid Unique id of Project
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return void Throw exception if data has an invalid value
|
||||
*/
|
||||
public function throwExceptionIfDataIsInvalid($messageEventTaskRelationUid, $projectUid, array $arrayData)
|
||||
public function throwExceptionIfDataIsInvalid($elementTaskRelationUid, $projectUid, array $arrayData)
|
||||
{
|
||||
try {
|
||||
//Set variables
|
||||
$arrayMessageEventTaskRelationData = ($messageEventTaskRelationUid == "")? array() : $this->getMessageEventTaskRelation($messageEventTaskRelationUid, true);
|
||||
$flagInsert = ($messageEventTaskRelationUid == "")? true : false;
|
||||
$arrayElementTaskRelationData = ($elementTaskRelationUid == "")? array() : $this->getElementTaskRelation($elementTaskRelationUid, true);
|
||||
$flagInsert = ($elementTaskRelationUid == "")? true : false;
|
||||
|
||||
$arrayFinalData = array_merge($arrayMessageEventTaskRelationData, $arrayData);
|
||||
$arrayFinalData = array_merge($arrayElementTaskRelationData, $arrayData);
|
||||
|
||||
//Verify data - Field definition
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
@@ -148,12 +149,12 @@ class MessageEventTaskRelation
|
||||
}
|
||||
|
||||
/**
|
||||
* Create Message-Event-Task-Relation for a Project
|
||||
* Create Element-Task-Relation for a Project
|
||||
*
|
||||
* @param string $projectUid Unique id of Project
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* return array Return data of the new Message-Event-Task-Relation created
|
||||
* return array Return data of the new Element-Task-Relation created
|
||||
*/
|
||||
public function create($projectUid, array $arrayData)
|
||||
{
|
||||
@@ -168,7 +169,7 @@ class MessageEventTaskRelation
|
||||
//Set data
|
||||
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||
|
||||
unset($arrayData["MSGETR_UID"]);
|
||||
unset($arrayData["ETR_UID"]);
|
||||
unset($arrayData["PRJ_UID"]);
|
||||
|
||||
//Verify data
|
||||
@@ -180,28 +181,28 @@ class MessageEventTaskRelation
|
||||
$cnn = \Propel::getConnection("workflow");
|
||||
|
||||
try {
|
||||
$messageEventTaskRelation = new \MessageEventTaskRelation();
|
||||
$elementTaskRelation = new \ElementTaskRelation();
|
||||
|
||||
$messageEventTaskRelationUid = \ProcessMaker\Util\Common::generateUID();
|
||||
$elementTaskRelationUid = \ProcessMaker\Util\Common::generateUID();
|
||||
|
||||
$messageEventTaskRelation->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
|
||||
$elementTaskRelation->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
$messageEventTaskRelation->setMsgetrUid($messageEventTaskRelationUid);
|
||||
$messageEventTaskRelation->setPrjUid($projectUid);
|
||||
$elementTaskRelation->setEtrUid($elementTaskRelationUid);
|
||||
$elementTaskRelation->setPrjUid($projectUid);
|
||||
|
||||
if ($messageEventTaskRelation->validate()) {
|
||||
if ($elementTaskRelation->validate()) {
|
||||
$cnn->begin();
|
||||
|
||||
$result = $messageEventTaskRelation->save();
|
||||
$result = $elementTaskRelation->save();
|
||||
|
||||
$cnn->commit();
|
||||
|
||||
//Return
|
||||
return $this->getMessageEventTaskRelation($messageEventTaskRelationUid);
|
||||
return $this->getElementTaskRelation($elementTaskRelationUid);
|
||||
} else {
|
||||
$msg = "";
|
||||
|
||||
foreach ($messageEventTaskRelation->getValidationFailures() as $validationFailure) {
|
||||
foreach ($elementTaskRelation->getValidationFailures() as $validationFailure) {
|
||||
$msg = $msg . (($msg != "")? "\n" : "") . $validationFailure->getMessage();
|
||||
}
|
||||
|
||||
@@ -218,7 +219,7 @@ class MessageEventTaskRelation
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Message-Event-Task-Relation
|
||||
* Delete Element-Task-Relation
|
||||
*
|
||||
* @param array $arrayCondition Conditions
|
||||
*
|
||||
@@ -238,26 +239,27 @@ class MessageEventTaskRelation
|
||||
}
|
||||
}
|
||||
|
||||
$result = \MessageEventTaskRelationPeer::doDelete($criteria);
|
||||
$result = \ElementTaskRelationPeer::doDelete($criteria);
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get criteria for Message-Event-Task-Relation
|
||||
* Get criteria for Element-Task-Relation
|
||||
*
|
||||
* return object
|
||||
*/
|
||||
public function getMessageEventTaskRelationCriteria()
|
||||
public function getElementTaskRelationCriteria()
|
||||
{
|
||||
try {
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\MessageEventTaskRelationPeer::MSGETR_UID);
|
||||
$criteria->addSelectColumn(\MessageEventTaskRelationPeer::PRJ_UID);
|
||||
$criteria->addSelectColumn(\MessageEventTaskRelationPeer::EVN_UID);
|
||||
$criteria->addSelectColumn(\MessageEventTaskRelationPeer::TAS_UID);
|
||||
$criteria->addSelectColumn(\ElementTaskRelationPeer::ETR_UID);
|
||||
$criteria->addSelectColumn(\ElementTaskRelationPeer::PRJ_UID);
|
||||
$criteria->addSelectColumn(\ElementTaskRelationPeer::ELEMENT_UID);
|
||||
$criteria->addSelectColumn(\ElementTaskRelationPeer::ELEMENT_TYPE);
|
||||
$criteria->addSelectColumn(\ElementTaskRelationPeer::TAS_UID);
|
||||
|
||||
return $criteria;
|
||||
} catch (\Exception $e) {
|
||||
@@ -266,19 +268,20 @@ class MessageEventTaskRelation
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data of a Message-Event-Task-Relation from a record
|
||||
* Get data of a Element-Task-Relation from a record
|
||||
*
|
||||
* @param array $record Record
|
||||
*
|
||||
* return array Return an array with data Message-Event-Task-Relation
|
||||
* return array Return an array with data Element-Task-Relation
|
||||
*/
|
||||
public function getMessageEventTaskRelationDataFromRecord(array $record)
|
||||
public function getElementTaskRelationDataFromRecord(array $record)
|
||||
{
|
||||
try {
|
||||
return array(
|
||||
$this->getFieldNameByFormatFieldName("MSGETR_UID") => $record["MSGETR_UID"],
|
||||
$this->getFieldNameByFormatFieldName("EVN_UID") => $record["EVN_UID"],
|
||||
$this->getFieldNameByFormatFieldName("TAS_UID") => $record["TAS_UID"]
|
||||
$this->getFieldNameByFormatFieldName("ETR_UID") => $record["ETR_UID"],
|
||||
$this->getFieldNameByFormatFieldName("ELEMENT_UID") => $record["ELEMENT_UID"],
|
||||
$this->getFieldNameByFormatFieldName("ELEMENT_TYPE") => $record["ELEMENT_TYPE"],
|
||||
$this->getFieldNameByFormatFieldName("TAS_UID") => $record["TAS_UID"]
|
||||
);
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
@@ -286,25 +289,25 @@ class MessageEventTaskRelation
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data of a Message-Event-Task-Relation
|
||||
* Get data of a Element-Task-Relation
|
||||
*
|
||||
* @param string $messageEventTaskRelationUid Unique id of Message-Event-Task-Relation
|
||||
* @param bool $flagGetRecord Value that set the getting
|
||||
* @param string $elementTaskRelationUid Unique id of Element-Task-Relation
|
||||
* @param bool $flagGetRecord Value that set the getting
|
||||
*
|
||||
* return array Return an array with data of a Message-Event-Task-Relation
|
||||
* return array Return an array with data of a Element-Task-Relation
|
||||
*/
|
||||
public function getMessageEventTaskRelation($messageEventTaskRelationUid, $flagGetRecord = false)
|
||||
public function getElementTaskRelation($elementTaskRelationUid, $flagGetRecord = false)
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsMessageEventTaskRelation($messageEventTaskRelationUid, $this->arrayFieldNameForException["messageEventTaskRelationUid"]);
|
||||
$this->throwExceptionIfNotExistsElementTaskRelation($elementTaskRelationUid, $this->arrayFieldNameForException["elementTaskRelationUid"]);
|
||||
|
||||
//Get data
|
||||
$criteria = $this->getMessageEventTaskRelationCriteria();
|
||||
$criteria = $this->getElementTaskRelationCriteria();
|
||||
|
||||
$criteria->add(\MessageEventTaskRelationPeer::MSGETR_UID, $messageEventTaskRelationUid, \Criteria::EQUAL);
|
||||
$criteria->add(\ElementTaskRelationPeer::ETR_UID, $elementTaskRelationUid, \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \MessageEventTaskRelationPeer::doSelectRS($criteria);
|
||||
$rsCriteria = \ElementTaskRelationPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$rsCriteria->next();
|
||||
@@ -312,25 +315,25 @@ class MessageEventTaskRelation
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
//Return
|
||||
return (!$flagGetRecord)? $this->getMessageEventTaskRelationDataFromRecord($row) : $row;
|
||||
return (!$flagGetRecord)? $this->getElementTaskRelationDataFromRecord($row) : $row;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data of a Message-Event-Task-Relation
|
||||
* Get data of a Element-Task-Relation
|
||||
*
|
||||
* @param array $arrayCondition Conditions
|
||||
* @param bool $flagGetRecord Value that set the getting
|
||||
*
|
||||
* return array Return an array with data of a Message-Event-Task-Relation, otherwise null
|
||||
* return array Return an array with data of a Element-Task-Relation, otherwise null
|
||||
*/
|
||||
public function getMessageEventTaskRelationWhere(array $arrayCondition, $flagGetRecord = false)
|
||||
public function getElementTaskRelationWhere(array $arrayCondition, $flagGetRecord = false)
|
||||
{
|
||||
try {
|
||||
//Get data
|
||||
$criteria = $this->getMessageEventTaskRelationCriteria();
|
||||
$criteria = $this->getElementTaskRelationCriteria();
|
||||
|
||||
foreach ($arrayCondition as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
@@ -340,14 +343,14 @@ class MessageEventTaskRelation
|
||||
}
|
||||
}
|
||||
|
||||
$rsCriteria = \MessageEventTaskRelationPeer::doSelectRS($criteria);
|
||||
$rsCriteria = \ElementTaskRelationPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
//Return
|
||||
return (!$flagGetRecord)? $this->getMessageEventTaskRelationDataFromRecord($row) : $row;
|
||||
return (!$flagGetRecord)? $this->getElementTaskRelationDataFromRecord($row) : $row;
|
||||
} else {
|
||||
//Return
|
||||
return null;
|
||||
@@ -403,8 +403,8 @@ class Light
|
||||
//$app_uid = \G::getPathFromUID($oAppDocument->Fields['APP_UID']);
|
||||
$file = \G::getPathFromFileUID($oAppDocument->Fields['APP_UID'], $sAppDocUid);
|
||||
|
||||
$realPath = PATH_DOCUMENT . $app_uid . '/' . $file[0] . $file[1] . '_' . $iDocVersion . '.' . $ext;
|
||||
$realPath1 = PATH_DOCUMENT . $app_uid . '/' . $file[0] . $file[1] . '.' . $ext;
|
||||
$realPath = PATH_DOCUMENT . G::getPathFromUID($app_uid) . '/' . $file[0] . $file[1] . '_' . $iDocVersion . '.' . $ext;
|
||||
$realPath1 = PATH_DOCUMENT . G::getPathFromUID($app_uid) . '/' . $file[0] . $file[1] . '.' . $ext;
|
||||
|
||||
$width = isset($fileData['width']) ? $fileData['width']:null;
|
||||
$height = isset($fileData['height']) ? $fileData['height']:null;
|
||||
@@ -604,15 +604,18 @@ class Light
|
||||
*/
|
||||
public function getInformation($userUid, $type, $app_uid)
|
||||
{
|
||||
$response = array();
|
||||
switch ($type) {
|
||||
case 'unassigned':
|
||||
case 'paused':
|
||||
case 'participated':
|
||||
$oCase = new \Cases();
|
||||
$iDelIndex = $oCase->getCurrentDelegationCase( $app_uid );
|
||||
$aFields = $oCase->loadCase( $app_uid, $iDelIndex );
|
||||
$this->getInfoResume($userUid, $aFields, $type);
|
||||
$response = $this->getInfoResume($userUid, $aFields, $type);
|
||||
break;
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -662,9 +665,149 @@ class Light
|
||||
$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();
|
||||
// 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* first step for upload file
|
||||
* create uid app_document for upload file
|
||||
*
|
||||
* @param $userUid
|
||||
* @param $Fields
|
||||
* @param $type
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function postUidUploadFiles($userUid, $app_uid, $request_data)
|
||||
{
|
||||
$response = array();
|
||||
if (count( $request_data ) > 0) {
|
||||
foreach ($request_data as $k => $file) {
|
||||
$indocUid = null;
|
||||
$fieldName = null;
|
||||
$oCase = new \Cases();
|
||||
$DEL_INDEX = $oCase->getCurrentDelegation( $app_uid, $userUid );
|
||||
|
||||
$aFields = array (
|
||||
"APP_UID" => $app_uid,
|
||||
"DEL_INDEX" => $DEL_INDEX,
|
||||
"USR_UID" => $userUid,
|
||||
"DOC_UID" => - 1,
|
||||
"APP_DOC_TYPE" => "ATTACHED",
|
||||
"APP_DOC_CREATE_DATE" => date( "Y-m-d H:i:s" ),
|
||||
"APP_DOC_COMMENT" => "",
|
||||
"APP_DOC_TITLE" => "",
|
||||
"APP_DOC_FILENAME" => $file['name'],
|
||||
"APP_DOC_FIELDNAME" => $fieldName
|
||||
);
|
||||
|
||||
$oAppDocument = new \AppDocument();
|
||||
$oAppDocument->create( $aFields );
|
||||
$response[$k]['docVersion'] = $iDocVersion = $oAppDocument->getDocVersion();
|
||||
$response[$k]['appDocUid'] = $sAppDocUid = $oAppDocument->getAppDocUid();
|
||||
}
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* second step for upload file
|
||||
* upload file in foler app_uid
|
||||
*
|
||||
* @param $userUid
|
||||
* @param $Fields
|
||||
* @param $type
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function documentUploadFiles($userUid, $app_uid, $app_doc_uid, $request_data)
|
||||
{
|
||||
$response = array("status" => "fail");
|
||||
if (isset( $_FILES["form"]["name"] ) && count( $_FILES["form"]["name"] ) > 0) {
|
||||
$arrayField = array ();
|
||||
$arrayFileName = array ();
|
||||
$arrayFileTmpName = array ();
|
||||
$arrayFileError = array ();
|
||||
$i = 0;
|
||||
|
||||
foreach ($_FILES["form"]["name"] as $fieldIndex => $fieldValue) {
|
||||
if (is_array( $fieldValue )) {
|
||||
foreach ($fieldValue as $index => $value) {
|
||||
if (is_array( $value )) {
|
||||
foreach ($value as $grdFieldIndex => $grdFieldValue) {
|
||||
$arrayField[$i]["grdName"] = $fieldIndex;
|
||||
$arrayField[$i]["grdFieldName"] = $grdFieldIndex;
|
||||
$arrayField[$i]["index"] = $index;
|
||||
|
||||
$arrayFileName[$i] = $_FILES["form"]["name"][$fieldIndex][$index][$grdFieldIndex];
|
||||
$arrayFileTmpName[$i] = $_FILES["form"]["tmp_name"][$fieldIndex][$index][$grdFieldIndex];
|
||||
$arrayFileError[$i] = $_FILES["form"]["error"][$fieldIndex][$index][$grdFieldIndex];
|
||||
$i = $i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$arrayField[$i] = $fieldIndex;
|
||||
|
||||
$arrayFileName[$i] = $_FILES["form"]["name"][$fieldIndex];
|
||||
$arrayFileTmpName[$i] = $_FILES["form"]["tmp_name"][$fieldIndex];
|
||||
$arrayFileError[$i] = $_FILES["form"]["error"][$fieldIndex];
|
||||
$i = $i + 1;
|
||||
}
|
||||
}
|
||||
if (count( $arrayField ) > 0) {
|
||||
for ($i = 0; $i <= count( $arrayField ) - 1; $i ++) {
|
||||
if ($arrayFileError[$i] == 0) {
|
||||
$indocUid = null;
|
||||
$fieldName = null;
|
||||
$fileSizeByField = 0;
|
||||
|
||||
$oAppDocument = new \AppDocument();
|
||||
$aAux = $oAppDocument->load($app_doc_uid);
|
||||
|
||||
$iDocVersion = $oAppDocument->getDocVersion();
|
||||
$sAppDocUid = $oAppDocument->getAppDocUid();
|
||||
$aInfo = pathinfo( $oAppDocument->getAppDocFilename() );
|
||||
$sExtension = ((isset( $aInfo["extension"] )) ? $aInfo["extension"] : "");
|
||||
$pathUID = G::getPathFromUID($app_uid);
|
||||
$sPathName = PATH_DOCUMENT . $pathUID . PATH_SEP;
|
||||
$sFileName = $sAppDocUid . "_" . $iDocVersion . "." . $sExtension;
|
||||
G::uploadFile( $arrayFileTmpName[$i], $sPathName, $sFileName );
|
||||
$response = array("status" => "ok");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* claim case
|
||||
*
|
||||
* @param $userUid
|
||||
* @param $Fields
|
||||
* @param $type
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function claimCaseUser($userUid, $sAppUid)
|
||||
{
|
||||
$response = array("status" => "fail");
|
||||
$oCase = new \Cases();
|
||||
$iDelIndex = $oCase->getCurrentDelegation( $sAppUid, $userUid );
|
||||
|
||||
$oAppDelegation = new \AppDelegation();
|
||||
$aDelegation = $oAppDelegation->load( $sAppUid, $iDelIndex );
|
||||
|
||||
//if there are no user in the delegation row, this case is still in selfservice
|
||||
if ($aDelegation['USR_UID'] == "") {
|
||||
$oCase->setCatchUser( $sAppUid,$iDelIndex, $userUid );
|
||||
$response = array("status" => "ok");
|
||||
} else {
|
||||
//G::SendMessageText( G::LoadTranslation( 'ID_CASE_ALREADY_DERIVATED' ), 'error' );
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
use \G;
|
||||
use \Criteria;
|
||||
use \UsersPeer;
|
||||
|
||||
/**
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
@@ -174,10 +176,52 @@ class Lists {
|
||||
$filtersData['date_to'] = $filters["dateTo"];
|
||||
$response['filters'] = $filtersData;
|
||||
$response['data'] = $result;
|
||||
$filtersData['action'] = $filters["action"];
|
||||
$response['totalCount'] = $list->countTotal($userUid, $filtersData);
|
||||
} else {
|
||||
$response = $result;
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get counters for lists
|
||||
*
|
||||
* @access public
|
||||
* @param array $userId, User Uid
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function getCounters($userId)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_INBOX);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_DRAFT);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_CANCELLED);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_PARTICIPATED);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_PAUSED);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_COMPLETED);
|
||||
$criteria->add( UsersPeer::USR_UID, $userId, Criteria::EQUAL );
|
||||
$dataset = UsersPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
$aRow = $dataset->getRow();
|
||||
|
||||
$oAppCache = new \AppCacheView();
|
||||
$totalUnassigned = $oAppCache->getListCounters('selfservice', $userId, false);
|
||||
|
||||
$response = array(
|
||||
array('count' => $aRow['USR_TOTAL_INBOX'], 'item' => 'CASES_INBOX'),
|
||||
array('count' => $aRow['USR_TOTAL_DRAFT'], 'item' => 'CASES_DRAFT'),
|
||||
array('count' => $aRow['USR_TOTAL_CANCELLED'], 'item' => 'CASES_CANCELLED'),
|
||||
array('count' => $aRow['USR_TOTAL_PARTICIPATED'], 'item' => 'CASES_SENT'),
|
||||
array('count' => $aRow['USR_TOTAL_PAUSED'], 'item' => 'CASES_PAUSED'),
|
||||
array('count' => $aRow['USR_TOTAL_COMPLETED'], 'item' => 'CASES_COMPLETED'),
|
||||
array('count' => $totalUnassigned, 'item' => 'CASES_SELFSERVICE')
|
||||
);
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -340,7 +340,7 @@ class MessageApplication
|
||||
$criteria->addSelectColumn(\MessageEventDefinitionPeer::MSGED_USR_UID);
|
||||
$criteria->addSelectColumn(\MessageEventDefinitionPeer::MSGED_VARIABLES);
|
||||
$criteria->addSelectColumn(\MessageEventDefinitionPeer::MSGED_CORRELATION);
|
||||
$criteria->addSelectColumn(\MessageEventTaskRelationPeer::TAS_UID);
|
||||
$criteria->addSelectColumn(\ElementTaskRelationPeer::TAS_UID);
|
||||
|
||||
$arrayEventType = array("START", "INTERMEDIATE");
|
||||
$arrayEventMarker = array("MESSAGECATCH");
|
||||
@@ -351,7 +351,8 @@ class MessageApplication
|
||||
|
||||
$criteria->addJoin(\MessageApplicationPeer::EVN_UID_CATCH, \MessageEventDefinitionPeer::EVN_UID, \Criteria::INNER_JOIN);
|
||||
|
||||
$criteria->addJoin(\MessageApplicationPeer::EVN_UID_CATCH, \MessageEventTaskRelationPeer::EVN_UID, \Criteria::INNER_JOIN);
|
||||
$criteria->addJoin(\MessageApplicationPeer::EVN_UID_CATCH, \ElementTaskRelationPeer::ELEMENT_UID, \Criteria::INNER_JOIN);
|
||||
$criteria->add(\ElementTaskRelationPeer::ELEMENT_TYPE, "bpmnEvent", \Criteria::EQUAL);
|
||||
|
||||
if (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData["messageApplicationStatus"]) && trim($arrayFilterData["messageApplicationStatus"]) != "") {
|
||||
$criteria->add(\MessageApplicationPeer::MSGAPP_STATUS, $arrayFilterData["messageApplicationStatus"], \Criteria::EQUAL);
|
||||
|
||||
@@ -169,6 +169,10 @@ class Process
|
||||
public function throwExceptionIfDataNotMetFieldDefinition($arrayData, $arrayFieldDefinition, $arrayFieldNameForException, $flagValidateRequired = true)
|
||||
{
|
||||
try {
|
||||
|
||||
\G::LoadSystem('inputfilter');
|
||||
$filter = new \InputFilter();
|
||||
|
||||
if ($flagValidateRequired) {
|
||||
foreach ($arrayFieldDefinition as $key => $value) {
|
||||
$fieldName = $key;
|
||||
@@ -187,6 +191,7 @@ class Process
|
||||
foreach ($arrayData as $key => $value) {
|
||||
$fieldName = $key;
|
||||
$fieldValue = $value;
|
||||
|
||||
|
||||
if (isset($arrayFieldDefinition[$fieldName])) {
|
||||
$fieldNameAux = (isset($arrayFieldNameForException[$arrayFieldDefinition[$fieldName]["fieldNameAux"]]))? $arrayFieldNameForException[$arrayFieldDefinition[$fieldName]["fieldNameAux"]] : "";
|
||||
@@ -281,6 +286,7 @@ class Process
|
||||
}
|
||||
|
||||
if (is_string($fieldValue) && trim($fieldValue) . "" != "") {
|
||||
$fieldValue = $filter->validateInput($fieldValue);
|
||||
eval("\$arrayAux = $fieldValue;");
|
||||
}
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ class User
|
||||
if ($form['USR_REPLACED_BY'] != '') {
|
||||
$oReplacedBy = \UsersPeer::retrieveByPK($form['USR_REPLACED_BY']);
|
||||
if (is_null($oReplacedBy)) {
|
||||
throw new \Exception('usr_replaced_by:'.$form['USR_REPLACED_BY'].' '.\G::LoadTranslation('ID_AUTHENTICATION_SOURCE_INVALID'));
|
||||
throw new \Exception(\G::LoadTranslation("ID_USER_DOES_NOT_EXIST", array(strtolower("USR_REPLACED_BY"), $form["USR_REPLACED_BY"])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,47 +35,6 @@ class Validator
|
||||
return $dep_uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate dep_title
|
||||
* @var string $dep_title. Name or Title for Departament
|
||||
* @var string $dep_uid. Uid for Departament
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @url GET
|
||||
*/
|
||||
static public function depTitle($dep_title, $dep_uid = '')
|
||||
{
|
||||
$dep_title = trim($dep_title);
|
||||
if ($dep_title == '') {
|
||||
throw (new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array('dep_title',''))));
|
||||
}
|
||||
|
||||
$oCriteria = new \Criteria( 'workflow' );
|
||||
$oCriteria->clearSelectColumns();
|
||||
$oCriteria->addSelectColumn( \ContentPeer::CON_CATEGORY );
|
||||
$oCriteria->addSelectColumn( \ContentPeer::CON_VALUE );
|
||||
$oCriteria->addSelectColumn( \DepartmentPeer::DEP_PARENT );
|
||||
$oCriteria->add( \ContentPeer::CON_CATEGORY, 'DEPO_TITLE' );
|
||||
$oCriteria->addJoin( \ContentPeer::CON_ID, \DepartmentPeer::DEP_UID, \Criteria::LEFT_JOIN );
|
||||
$oCriteria->add( \ContentPeer::CON_VALUE, $dep_title );
|
||||
$oCriteria->add( \ContentPeer::CON_LANG, SYS_LANG );
|
||||
if ($dep_uid != '') {
|
||||
$oCriteria->add( \ContentPeer::CON_ID, $dep_uid, \Criteria::NOT_EQUAL );
|
||||
}
|
||||
|
||||
$oDataset = \DepartmentPeer::doSelectRS( $oCriteria );
|
||||
$oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
|
||||
if ($oDataset->next()) {
|
||||
throw (new \Exception(\G::LoadTranslation("ID_DEPARTMENT_NOT_EXIST", array('dep_title',$dep_title))));
|
||||
}
|
||||
return $dep_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate dep_status
|
||||
* @var string $dep_uid. Uid for Departament
|
||||
|
||||
@@ -398,7 +398,7 @@ class WebEntry
|
||||
|
||||
|
||||
$fileContent .= "G::LoadClass('pmDynaform');\n";
|
||||
$fileContent .= "\$a = new pmDynaform('".$arrayWebEntryData["DYN_UID"]."', array());\n";
|
||||
$fileContent .= "\$a = new pmDynaform(array('CURRENT_DYNAFORM'=>'" . $arrayWebEntryData["DYN_UID"] . "'));\n";
|
||||
$fileContent .= "if(\$a->isResponsive()){";
|
||||
$fileContent .= "\$a->printWebEntry('".$fileName."Post.php');";
|
||||
$fileContent .= "}else {";
|
||||
|
||||
@@ -288,7 +288,7 @@ class WebEntryEvent
|
||||
throw new \Exception(\G::LoadTranslation("ID_EVENT_NOT_EXIST", array($this->arrayFieldNameForException["eventUid"], $arrayData["EVN_UID"])));
|
||||
}
|
||||
|
||||
if ($obj->getEvnType() != "START") {
|
||||
if (($obj->getEvnType() != "START") || ($obj->getEvnType() == "START" && $obj->getEvnMarker() != "EMPTY")) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_EVENT_NOT_IS_START_EVENT", array($this->arrayFieldNameForException["eventUid"], $arrayData["EVN_UID"])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
"intermediate-catch-message-event" => array("type" => "INTERMEDIATE-CATCH-MESSAGE-EVENT", "prefix" => "icme-")
|
||||
);
|
||||
|
||||
private $arrayMessageEventTaskRelation = array();
|
||||
private $arrayElementTaskRelation = array();
|
||||
|
||||
/**
|
||||
* OVERRIDES
|
||||
@@ -212,30 +212,49 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
}
|
||||
|
||||
public function removeGateway($gatUid)
|
||||
public function removeElementTaskRelation($elementUid, $elementType)
|
||||
{
|
||||
// $gatewayData = $this->getGateway($gatUid);
|
||||
// $flowsDest = \BpmnFlow::findAllBy(\BpmnFlowPeer::FLO_ELEMENT_DEST, $gatUid);
|
||||
try {
|
||||
$elementTaskRelation = new \ProcessMaker\BusinessModel\ElementTaskRelation();
|
||||
|
||||
// foreach ($flowsDest as $flowDest) {
|
||||
// switch ($flowDest->getFloElementOriginType()) {
|
||||
// case "bpmnActivity":
|
||||
// $actUid = $flowDest->getFloElementOrigin();
|
||||
// $flowsOrigin = \BpmnFlow::findAllBy(\BpmnFlowPeer::FLO_ELEMENT_ORIGIN, $gatUid);
|
||||
//
|
||||
// foreach ($flowsOrigin as $flowOrigin) {
|
||||
// switch ($flowOrigin->getFloElementDestType()) {
|
||||
// case "bpmnActivity":
|
||||
// $toActUid = $flowOrigin->getFloElementDest();
|
||||
// $this->wp->removeRouteFromTo($actUid, $toActUid);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
$arrayElementTaskRelationData = $elementTaskRelation->getElementTaskRelationWhere(
|
||||
array(
|
||||
\ElementTaskRelationPeer::PRJ_UID => $this->wp->getUid(),
|
||||
\ElementTaskRelationPeer::ELEMENT_UID => $elementUid,
|
||||
\ElementTaskRelationPeer::ELEMENT_TYPE => $elementType
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
parent::removeGateway($gatUid);
|
||||
if (!is_null($arrayElementTaskRelationData)) {
|
||||
//Task - Delete
|
||||
$arrayTaskData = $this->wp->getTask($arrayElementTaskRelationData["TAS_UID"]);
|
||||
|
||||
if (!is_null($arrayTaskData)) {
|
||||
$this->wp->removeTask($arrayElementTaskRelationData["TAS_UID"]);
|
||||
}
|
||||
|
||||
//Element-Task-Relation - Delete
|
||||
$elementTaskRelation->deleteWhere(array(\ElementTaskRelationPeer::ETR_UID => $arrayElementTaskRelationData["ETR_UID"]));
|
||||
|
||||
//Array - Delete element
|
||||
unset($this->arrayElementTaskRelation[$elementUid]);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function removeGateway($gatewayUid)
|
||||
{
|
||||
try {
|
||||
//Element-Task-Relation - Delete
|
||||
$this->removeElementTaskRelation($gatewayUid, "bpmnGateway");
|
||||
|
||||
parent::removeGateway($gatewayUid);
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function addFlow($data)
|
||||
@@ -249,7 +268,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
case "bpmnActivity":
|
||||
$event = \BpmnEventPeer::retrieveByPK($data["FLO_ELEMENT_ORIGIN"]);
|
||||
|
||||
// setting as start task
|
||||
//Setting as start Task
|
||||
if (!is_null($event) && $event->getEvnType() == "START" && $event->getEvnMarker() == "EMPTY") {
|
||||
$this->wp->setStartTask($data["FLO_ELEMENT_DEST"]);
|
||||
}
|
||||
@@ -269,7 +288,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
case "bpmnEvent":
|
||||
$event = \BpmnEventPeer::retrieveByPK($data["FLO_ELEMENT_DEST"]);
|
||||
|
||||
// setting as end task
|
||||
//Setting as end Task
|
||||
if (!is_null($event) && $event->getEvnType() == "END" && $event->getEvnMarker() == "EMPTY") {
|
||||
$this->wp->setEndTask($data["FLO_ELEMENT_ORIGIN"]);
|
||||
}
|
||||
@@ -298,10 +317,10 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$event = \BpmnEventPeer::retrieveByPK($flowBefore->getFloElementOrigin());
|
||||
|
||||
if (!is_null($event) && $event->getEvnType() == "START" && $event->getEvnMarker() == "EMPTY") {
|
||||
//Remove as start task
|
||||
//Remove as start Task
|
||||
$this->wp->setStartTask($flowBefore->getFloElementDest(), false);
|
||||
|
||||
//Setting as start task
|
||||
//Setting as start Task
|
||||
$this->wp->setStartTask($flowCurrent->getFloElementDest());
|
||||
|
||||
$this->updateEventStartObjects($flowCurrent->getFloElementOrigin(), $flowCurrent->getFloElementDest());
|
||||
@@ -320,10 +339,10 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$event = \BpmnEventPeer::retrieveByPK($flowBefore->getFloElementDest());
|
||||
|
||||
if (!is_null($event) && $event->getEvnType() == "END" && $event->getEvnMarker() == "EMPTY") {
|
||||
//Remove as end task
|
||||
//Remove as end Task
|
||||
$this->wp->setEndTask($flowBefore->getFloElementOrigin(), false);
|
||||
|
||||
//Setting as end task
|
||||
//Setting as end Task
|
||||
$this->wp->setEndTask($flowCurrent->getFloElementOrigin());
|
||||
}
|
||||
}
|
||||
@@ -336,7 +355,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$event = \BpmnEventPeer::retrieveByPK($flowBefore->getFloElementDest());
|
||||
|
||||
if (!is_null($event) && $event->getEvnType() == "END" && $event->getEvnMarker() == "EMPTY") {
|
||||
//Remove as end task
|
||||
//Remove as end Task
|
||||
$this->wp->setEndTask($flowBefore->getFloElementOrigin(), false);
|
||||
}
|
||||
}
|
||||
@@ -395,6 +414,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
if (!is_null($event) && $event->getEvnType() == "START" && $event->getEvnMarker() == "EMPTY") {
|
||||
$activity = \BpmnActivityPeer::retrieveByPK($flow->getFloElementDest());
|
||||
|
||||
//Remove as start Task
|
||||
if (!is_null($activity)) {
|
||||
$this->wp->setStartTask($activity->getActUid(), false);
|
||||
}
|
||||
@@ -416,6 +436,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
if (!is_null($event) && $event->getEvnType() == "END" && $event->getEvnMarker() == "EMPTY") {
|
||||
$activity = \BpmnActivityPeer::retrieveByPK($flow->getFloElementOrigin());
|
||||
|
||||
//Remove as end Task
|
||||
if (! is_null($activity)) {
|
||||
$this->wp->setEndTask($activity->getActUid(), false);
|
||||
}
|
||||
@@ -453,6 +474,79 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
// TODO Complete for other routes, activity->activity, activity->gateway and viceversa
|
||||
}
|
||||
|
||||
public function updateEventActivityDefinition(\BpmnEvent $bpmnEvent, $flagStartTask)
|
||||
{
|
||||
try {
|
||||
if ($bpmnEvent->getEvnType() == "START") {
|
||||
//Flows
|
||||
$arrayFlow = \BpmnFlow::findAllBy(array(
|
||||
\BpmnFlowPeer::FLO_TYPE => array("MESSAGE", \Criteria::NOT_EQUAL),
|
||||
\BpmnFlowPeer::FLO_ELEMENT_ORIGIN => $bpmnEvent->getEvnUid(),
|
||||
\BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => "bpmnEvent"
|
||||
));
|
||||
|
||||
foreach ($arrayFlow as $value) {
|
||||
$arrayFlowData = $value->toArray();
|
||||
|
||||
switch ($arrayFlowData["FLO_ELEMENT_DEST_TYPE"]) {
|
||||
case "bpmnActivity":
|
||||
//Setting as start Task
|
||||
//or
|
||||
//Remove as start Task
|
||||
$this->wp->setStartTask($arrayFlowData["FLO_ELEMENT_DEST"], $flagStartTask);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function removeEventDefinition(\BpmnEvent $bpmnEvent)
|
||||
{
|
||||
try {
|
||||
//Case-Scheduler - Delete
|
||||
if ($bpmnEvent->getEvnType() == "START" && $bpmnEvent->getEvnMarker() == "TIMER") {
|
||||
$caseScheduler = new \CaseScheduler();
|
||||
|
||||
if ($caseScheduler->Exists($bpmnEvent->getEvnUid())) {
|
||||
$this->wp->removeCaseScheduler($bpmnEvent->getEvnUid());
|
||||
}
|
||||
}
|
||||
|
||||
//WebEntry-Event - Delete
|
||||
if ($bpmnEvent->getEvnType() == "START" && $bpmnEvent->getEvnMarker() == "EMPTY") {
|
||||
$webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
|
||||
|
||||
if ($webEntryEvent->existsEvent($bpmnEvent->getPrjUid(), $bpmnEvent->getEvnUid())) {
|
||||
$arrayWebEntryEventData = $webEntryEvent->getWebEntryEventByEvent($bpmnEvent->getPrjUid(), $bpmnEvent->getEvnUid(), true);
|
||||
|
||||
$webEntryEvent->delete($arrayWebEntryEventData["WEE_UID"]);
|
||||
}
|
||||
}
|
||||
|
||||
//Message-Event-Definition - Delete
|
||||
$arrayEventType = array("START", "END", "INTERMEDIATE");
|
||||
$arrayEventMarker = array("MESSAGETHROW", "MESSAGECATCH");
|
||||
|
||||
if (in_array($bpmnEvent->getEvnType(), $arrayEventType) && in_array($bpmnEvent->getEvnMarker(), $arrayEventMarker)) {
|
||||
$messageEventDefinition = new \ProcessMaker\BusinessModel\MessageEventDefinition();
|
||||
|
||||
if ($messageEventDefinition->existsEvent($bpmnEvent->getPrjUid(), $bpmnEvent->getEvnUid())) {
|
||||
$arrayMessageEventDefinitionData = $messageEventDefinition->getMessageEventDefinitionByEvent($bpmnEvent->getPrjUid(), $bpmnEvent->getEvnUid(), true);
|
||||
|
||||
$messageEventDefinition->delete($arrayMessageEventDefinitionData["MSGED_UID"]);
|
||||
}
|
||||
}
|
||||
|
||||
//Element-Task-Relation - Delete
|
||||
$this->removeElementTaskRelation($bpmnEvent->getEvnUid(), "bpmnEvent");
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function addEvent($data)
|
||||
{
|
||||
if (! array_key_exists("EVN_TYPE", $data)) {
|
||||
@@ -475,80 +569,49 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
return $eventUid;
|
||||
}
|
||||
|
||||
public function updateEvent($eventUid, array $arrayEventData)
|
||||
{
|
||||
try {
|
||||
$bpmnEvent = \BpmnEventPeer::retrieveByPK($eventUid);
|
||||
|
||||
if ((isset($arrayEventData["EVN_TYPE"]) && $arrayEventData["EVN_TYPE"] != $bpmnEvent->getEvnType()) ||
|
||||
(isset($arrayEventData["EVN_MARKER"]) && $arrayEventData["EVN_MARKER"] != $bpmnEvent->getEvnMarker())
|
||||
) {
|
||||
$this->updateEventActivityDefinition($bpmnEvent, false);
|
||||
$this->removeEventDefinition($bpmnEvent);
|
||||
}
|
||||
|
||||
parent::updateEvent($eventUid, $arrayEventData);
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function removeEvent($eventUid)
|
||||
{
|
||||
$event = \BpmnEventPeer::retrieveByPK($eventUid);
|
||||
try {
|
||||
$bpmnEvent = \BpmnEventPeer::retrieveByPK($eventUid);
|
||||
|
||||
//Delete case scheduler
|
||||
if ($event && $event->getEvnMarker() == "TIMER" && $event->getEvnType() == "START") {
|
||||
$this->wp->removeCaseScheduler($eventUid);
|
||||
$this->updateEventActivityDefinition($bpmnEvent, false);
|
||||
$this->removeEventDefinition($bpmnEvent);
|
||||
|
||||
parent::removeEvent($eventUid);
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
if (!is_null($event)) {
|
||||
//WebEntry-Event - Delete
|
||||
if ($event->getEvnType() == "START") {
|
||||
$webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
|
||||
|
||||
if ($webEntryEvent->existsEvent($event->getPrjUid(), $eventUid)) {
|
||||
$arrayWebEntryEventData = $webEntryEvent->getWebEntryEventByEvent($event->getPrjUid(), $eventUid, true);
|
||||
|
||||
$webEntryEvent->delete($arrayWebEntryEventData["WEE_UID"]);
|
||||
}
|
||||
}
|
||||
|
||||
//Message-Event-Definition - Delete
|
||||
$arrayEventType = array("START", "END", "INTERMEDIATE");
|
||||
$arrayEventMarker = array("MESSAGETHROW", "MESSAGECATCH");
|
||||
|
||||
if (!is_null($event) &&
|
||||
in_array($event->getEvnType(), $arrayEventType) && in_array($event->getEvnMarker(), $arrayEventMarker)
|
||||
) {
|
||||
$messageEventDefinition = new \ProcessMaker\BusinessModel\MessageEventDefinition();
|
||||
|
||||
if ($messageEventDefinition->existsEvent($event->getPrjUid(), $eventUid)) {
|
||||
$arrayMessageEventDefinitionData = $messageEventDefinition->getMessageEventDefinitionByEvent($event->getPrjUid(), $eventUid, true);
|
||||
|
||||
$messageEventDefinition->delete($arrayMessageEventDefinitionData["MSGED_UID"]);
|
||||
}
|
||||
}
|
||||
|
||||
//Message-Event-Task-Relation - Delete
|
||||
$messageEventTaskRelation = new \ProcessMaker\BusinessModel\MessageEventTaskRelation();
|
||||
|
||||
$arrayMessageEventTaskRelationData = $messageEventTaskRelation->getMessageEventTaskRelationWhere(
|
||||
array(
|
||||
\MessageEventTaskRelationPeer::PRJ_UID => $event->getPrjUid(),
|
||||
\MessageEventTaskRelationPeer::EVN_UID => $event->getEvnUid()
|
||||
),
|
||||
true
|
||||
);
|
||||
|
||||
if (!is_null($arrayMessageEventTaskRelationData)) {
|
||||
//Task - Delete
|
||||
$arrayTaskData = $this->wp->getTask($arrayMessageEventTaskRelationData["TAS_UID"]);
|
||||
|
||||
if (!is_null($arrayTaskData)) {
|
||||
$this->wp->removeTask($arrayMessageEventTaskRelationData["TAS_UID"]);
|
||||
}
|
||||
|
||||
//Message-Event-Task-Relation - Delete
|
||||
$messageEventTaskRelation->deleteWhere(array(\MessageEventTaskRelationPeer::MSGETR_UID => $arrayMessageEventTaskRelationData["MSGETR_UID"]));
|
||||
|
||||
//Array - Delete element
|
||||
unset($this->arrayMessageEventTaskRelation[$eventUid]);
|
||||
}
|
||||
}
|
||||
|
||||
parent::removeEvent($eventUid);
|
||||
}
|
||||
|
||||
public function updateEventStartObjects($eventUid, $taskUid)
|
||||
{
|
||||
$event = \BpmnEventPeer::retrieveByPK($eventUid);
|
||||
|
||||
//Update case scheduler
|
||||
//Case-Scheduler - Update
|
||||
if (!is_null($event) && $event->getEvnType() == "START" && $event->getEvnMarker() == "TIMER") {
|
||||
$this->wp->updateCaseScheduler($eventUid, array("TAS_UID" => $taskUid));
|
||||
$caseScheduler = new \CaseScheduler();
|
||||
|
||||
if ($caseScheduler->Exists($eventUid)) {
|
||||
$this->wp->updateCaseScheduler($eventUid, array("TAS_UID" => $taskUid));
|
||||
}
|
||||
}
|
||||
|
||||
//Update web entry
|
||||
@@ -560,8 +623,8 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
public function createTaskByElement($elementUid, $elementType, $key)
|
||||
{
|
||||
try {
|
||||
if (isset($this->arrayMessageEventTaskRelation[$elementUid])) {
|
||||
$taskUid = $this->arrayMessageEventTaskRelation[$elementUid];
|
||||
if (isset($this->arrayElementTaskRelation[$elementUid])) {
|
||||
$taskUid = $this->arrayElementTaskRelation[$elementUid];
|
||||
} else {
|
||||
$taskPosX = 0;
|
||||
$taskPosY = 0;
|
||||
@@ -604,7 +667,6 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
if ($elementType == "bpmnEvent" &&
|
||||
in_array($key, array("end-message-event", "start-message-event", "intermediate-catch-message-event"))
|
||||
) {
|
||||
|
||||
if (in_array($key, array("start-message-event", "intermediate-catch-message-event"))) {
|
||||
//Task - User
|
||||
//Assign to admin
|
||||
@@ -612,21 +674,22 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
$result = $task->assignUser($taskUid, "00000000000000000000000000000001", 1);
|
||||
}
|
||||
|
||||
//Message-Event-Task-Relation - Create
|
||||
$messageEventTaskRelation = new \ProcessMaker\BusinessModel\MessageEventTaskRelation();
|
||||
|
||||
$arrayResult = $messageEventTaskRelation->create(
|
||||
$this->wp->getUid(),
|
||||
array(
|
||||
"EVN_UID" => $elementUid,
|
||||
"TAS_UID" => $taskUid
|
||||
)
|
||||
);
|
||||
|
||||
//Array - Add element
|
||||
$this->arrayMessageEventTaskRelation[$elementUid] = $taskUid;
|
||||
}
|
||||
|
||||
//Element-Task-Relation - Create
|
||||
$elementTaskRelation = new \ProcessMaker\BusinessModel\ElementTaskRelation();
|
||||
|
||||
$arrayResult = $elementTaskRelation->create(
|
||||
$this->wp->getUid(),
|
||||
array(
|
||||
"ELEMENT_UID" => $elementUid,
|
||||
"ELEMENT_TYPE" => $elementType,
|
||||
"TAS_UID" => $taskUid
|
||||
)
|
||||
);
|
||||
|
||||
//Array - Add element
|
||||
$this->arrayElementTaskRelation[$elementUid] = $taskUid;
|
||||
}
|
||||
|
||||
//Return
|
||||
@@ -695,9 +758,9 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
\BpmnFlowPeer::FLO_ELEMENT_ORIGIN_TYPE => "bpmnGateway"
|
||||
));
|
||||
|
||||
if ($arrayFlow > 0) {
|
||||
$this->wp->resetTaskRoutes($activityUid);
|
||||
}
|
||||
//if ($arrayFlow > 0) {
|
||||
// $this->wp->resetTaskRoutes($activityUid);
|
||||
//}
|
||||
|
||||
foreach ($arrayFlow as $value) {
|
||||
$arrayFlowData = $value->toArray();
|
||||
@@ -734,9 +797,6 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
case "END":
|
||||
//$event->getEvnMarker(): EMPTY or MESSAGETHROW
|
||||
switch ($event->getEvnMarker()) {
|
||||
case "EMPTY":
|
||||
$result = $this->wp->addRoute($activityUid, -1, $routeType, $routeCondition, $routeDefault);
|
||||
break;
|
||||
case "MESSAGETHROW":
|
||||
$taskUid = $this->createTaskByElement(
|
||||
$event->getEvnUid(),
|
||||
@@ -747,9 +807,14 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$result = $this->wp->addRoute($activityUid, $taskUid, $routeType, $routeCondition, $routeDefault);
|
||||
$result = $this->wp->addRoute($taskUid, -1, "SEQUENTIAL");
|
||||
break;
|
||||
default:
|
||||
//EMPTY //and others types
|
||||
$result = $this->wp->addRoute($activityUid, -1, $routeType, $routeCondition, $routeDefault);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "INTERMEDIATE":
|
||||
default:
|
||||
//INTERMEDIATE //and others types
|
||||
$this->mapBpmnEventToWorkflowRoutes($activityUid, $arrayFlowData["FLO_ELEMENT_DEST"], $routeType, $routeCondition, $routeDefault);
|
||||
break;
|
||||
}
|
||||
@@ -774,12 +839,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
try {
|
||||
$arrayEventData = \BpmnEvent::findOneBy(\BpmnEventPeer::EVN_UID, $eventUid)->toArray();
|
||||
|
||||
$arrayEventType = array("START", "INTERMEDIATE");
|
||||
$arrayEventMarker = array("MESSAGETHROW", "MESSAGECATCH");
|
||||
|
||||
if (!is_null($arrayEventData) &&
|
||||
in_array($arrayEventData["EVN_TYPE"], $arrayEventType) && in_array($arrayEventData["EVN_MARKER"], $arrayEventMarker)
|
||||
) {
|
||||
if (!is_null($arrayEventData)) {
|
||||
//Event - INTERMEDIATE-CATCH-MESSAGE-EVENT
|
||||
if ($arrayEventData["EVN_TYPE"] == "INTERMEDIATE" && $arrayEventData["EVN_MARKER"] == "MESSAGECATCH") {
|
||||
$taskUid = $this->createTaskByElement(
|
||||
@@ -828,9 +888,6 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
case "END":
|
||||
//$event->getEvnMarker(): EMPTY or MESSAGETHROW
|
||||
switch ($event->getEvnMarker()) {
|
||||
case "EMPTY":
|
||||
$result = $this->wp->addRoute($activityUid, -1, $routeType, $routeCondition, $routeDefault);
|
||||
break;
|
||||
case "MESSAGETHROW":
|
||||
$taskUid = $this->createTaskByElement(
|
||||
$event->getEvnUid(),
|
||||
@@ -841,9 +898,14 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$result = $this->wp->addRoute($activityUid, $taskUid, $routeType, $routeCondition, $routeDefault);
|
||||
$result = $this->wp->addRoute($taskUid, -1, "SEQUENTIAL");
|
||||
break;
|
||||
default:
|
||||
//EMPTY //and others types
|
||||
$result = $this->wp->addRoute($activityUid, -1, $routeType, $routeCondition, $routeDefault);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "INTERMEDIATE":
|
||||
default:
|
||||
//INTERMEDIATE //and others types
|
||||
$this->mapBpmnEventToWorkflowRoutes($activityUid, $arrayFlowData["FLO_ELEMENT_DEST"], $routeType, $routeCondition, $routeDefault);
|
||||
break;
|
||||
}
|
||||
@@ -866,18 +928,18 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
public function mapBpmnFlowsToWorkflowRoutes()
|
||||
{
|
||||
//Task - Delete dummies
|
||||
$this->wp->deleteTaskByArrayType(
|
||||
$this->wp->getUid(),
|
||||
array(
|
||||
$this->arrayTaskAttribute["gateway-to-gateway"]["type"]
|
||||
)
|
||||
);
|
||||
//Task dummies //Delete Task Routes
|
||||
foreach ($this->arrayElementTaskRelation as $value) {
|
||||
$this->wp->resetTaskRoutes($value);
|
||||
}
|
||||
|
||||
//Activities
|
||||
foreach ($this->getActivities() as $value) {
|
||||
$activity = $value;
|
||||
|
||||
//Delete Task Routes
|
||||
$this->wp->resetTaskRoutes($activity["ACT_UID"]);
|
||||
|
||||
//Flows
|
||||
$arrayFlow = \BpmnFlow::findAllBy(array(
|
||||
\BpmnFlowPeer::FLO_TYPE => array("MESSAGE", \Criteria::NOT_EQUAL),
|
||||
@@ -910,9 +972,6 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
case "END":
|
||||
//$event->getEvnMarker(): EMPTY or MESSAGETHROW
|
||||
switch ($event->getEvnMarker()) {
|
||||
case "EMPTY":
|
||||
//This it's already implemented
|
||||
break;
|
||||
case "MESSAGETHROW":
|
||||
$taskUid = $this->createTaskByElement(
|
||||
$event->getEvnUid(),
|
||||
@@ -923,9 +982,15 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$result = $this->wp->addRoute($activity["ACT_UID"], $taskUid, "SEQUENTIAL");
|
||||
$result = $this->wp->addRoute($taskUid, -1, "SEQUENTIAL");
|
||||
break;
|
||||
default:
|
||||
//EMPTY //This it's already implemented
|
||||
//and others types
|
||||
$result = $this->wp->addRoute($activity["ACT_UID"], -1, "SEQUENTIAL");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "INTERMEDIATE":
|
||||
default:
|
||||
//INTERMEDIATE //and others types
|
||||
$this->mapBpmnEventToWorkflowRoutes($activity["ACT_UID"], $flow->getFloElementDest());
|
||||
break;
|
||||
}
|
||||
@@ -935,31 +1000,33 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
}
|
||||
}
|
||||
|
||||
//Events - Message-Event
|
||||
$arrayEventType = array("START", "END", "INTERMEDIATE");
|
||||
$arrayEventMarker = array("MESSAGETHROW", "MESSAGECATCH");
|
||||
|
||||
//Events
|
||||
foreach ($this->getEvents() as $value) {
|
||||
$event = $value;
|
||||
|
||||
if (in_array($event["EVN_TYPE"], $arrayEventType) && in_array($event["EVN_MARKER"], $arrayEventMarker)) {
|
||||
switch ($event["EVN_TYPE"]) {
|
||||
case "START":
|
||||
$taskUid = $this->createTaskByElement(
|
||||
$event["EVN_UID"],
|
||||
"bpmnEvent",
|
||||
"start-message-event"
|
||||
);
|
||||
switch ($event["EVN_TYPE"]) {
|
||||
case "START":
|
||||
switch ($event["EVN_MARKER"]) {
|
||||
case "MESSAGECATCH":
|
||||
$taskUid = $this->createTaskByElement(
|
||||
$event["EVN_UID"],
|
||||
"bpmnEvent",
|
||||
"start-message-event"
|
||||
);
|
||||
|
||||
$this->wp->setStartTask($taskUid);
|
||||
$this->wp->setStartTask($taskUid);
|
||||
|
||||
$this->mapBpmnEventToWorkflowRoutes($taskUid, $event["EVN_UID"]);
|
||||
break;
|
||||
case "END":
|
||||
break;
|
||||
case "INTERMEDIATE":
|
||||
break;
|
||||
}
|
||||
$this->mapBpmnEventToWorkflowRoutes($taskUid, $event["EVN_UID"]);
|
||||
break;
|
||||
case "EMPTY":
|
||||
$this->updateEventActivityDefinition(\BpmnEventPeer::retrieveByPK($event["EVN_UID"]), true);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case "END":
|
||||
break;
|
||||
case "INTERMEDIATE":
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1102,6 +1169,29 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
return $project;
|
||||
}
|
||||
|
||||
public function updateBoundByArrayUid(array $arrayObjectData, array $arrayUid)
|
||||
{
|
||||
try {
|
||||
unset($arrayObjectData["BOU_UID"]);
|
||||
|
||||
if ($arrayObjectData["BOU_CONTAINER"] == "bpmnPool" ||
|
||||
$arrayObjectData["BOU_CONTAINER"] == "bpmnLane" ||
|
||||
$arrayObjectData["BOU_CONTAINER"] == "bpmnActivity"
|
||||
) {
|
||||
foreach ($arrayUid as $value) {
|
||||
if ($arrayObjectData["BOU_ELEMENT"] == $value["old_uid"]) {
|
||||
$arrayObjectData["BOU_ELEMENT"] = $value["new_uid"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Return
|
||||
return $arrayObjectData;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update project from a struct defined.
|
||||
*
|
||||
@@ -1164,24 +1254,24 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$bwp->update($projectRecord);
|
||||
|
||||
//Array - Set empty
|
||||
$bwp->arrayMessageEventTaskRelation = array();
|
||||
$bwp->arrayElementTaskRelation = array();
|
||||
|
||||
//Message-Event-Task-Relation - Get all records
|
||||
//Element-Task-Relation - Get all records
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\MessageEventTaskRelationPeer::EVN_UID);
|
||||
$criteria->addSelectColumn(\MessageEventTaskRelationPeer::TAS_UID);
|
||||
$criteria->addSelectColumn(\ElementTaskRelationPeer::ELEMENT_UID);
|
||||
$criteria->addSelectColumn(\ElementTaskRelationPeer::TAS_UID);
|
||||
|
||||
$criteria->add(\MessageEventTaskRelationPeer::PRJ_UID, $bwp->wp->getUid(), \Criteria::EQUAL);
|
||||
$criteria->add(\ElementTaskRelationPeer::PRJ_UID, $bwp->wp->getUid(), \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \MessageEventTaskRelationPeer::doSelectRS($criteria);
|
||||
$rsCriteria = \ElementTaskRelationPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
//Array - Add element
|
||||
$bwp->arrayMessageEventTaskRelation[$row["EVN_UID"]] = $row["TAS_UID"];
|
||||
$bwp->arrayElementTaskRelation[$row["ELEMENT_UID"]] = $row["TAS_UID"];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1195,7 +1285,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
if ($forceInsert || is_null($dataObject)) {
|
||||
if ($generateUid) {
|
||||
//Laneset
|
||||
//Generate and update UID
|
||||
unset($lanesetData["BOU_UID"]);
|
||||
|
||||
$uidOld = $lanesetData["LNS_UID"];
|
||||
@@ -1246,7 +1336,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
if ($forceInsert || is_null($dataObject)) {
|
||||
if ($generateUid) {
|
||||
//Laneset
|
||||
//Generate and update UID
|
||||
unset($laneData["BOU_UID"]);
|
||||
|
||||
$uidOld = $laneData["LAN_UID"];
|
||||
@@ -1295,20 +1385,10 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
}
|
||||
|
||||
if ($forceInsert || is_null($activity)) {
|
||||
|
||||
if ($generateUid) {
|
||||
//Activity
|
||||
//Generate and update UID
|
||||
$activityData = $bwp->updateBoundByArrayUid($activityData, $result);
|
||||
|
||||
//Update UIDs
|
||||
if ($activityData["BOU_CONTAINER"] == "bpmnPool" || $activityData["BOU_CONTAINER"] == "bpmnLane" || $activityData["BOU_CONTAINER"] == "bpmnActivity") {
|
||||
foreach ($result as $value) {
|
||||
if ($activityData["BOU_ELEMENT"] == $value["old_uid"]) {
|
||||
$activityData["BOU_ELEMENT"] = $value["new_uid"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($activityData["BOU_UID"]);
|
||||
$uidOld = $activityData["ACT_UID"];
|
||||
$activityData["ACT_UID"] = Util\Common::generateUID();
|
||||
|
||||
@@ -1356,18 +1436,8 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
if ($forceInsert || is_null($artifact)) {
|
||||
if ($generateUid) {
|
||||
//Artifact
|
||||
|
||||
//Update UIDs
|
||||
if ($artifactData["BOU_CONTAINER"] == "bpmnPool" || $artifactData["BOU_CONTAINER"] == "bpmnLane" || $artifactData["BOU_CONTAINER"] == "bpmnActivity") {
|
||||
foreach ($result as $value) {
|
||||
if ($artifactData["BOU_ELEMENT"] == $value["old_uid"]) {
|
||||
$artifactData["BOU_ELEMENT"] = $value["new_uid"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($artifactData["BOU_UID"]);
|
||||
//Generate and update UID
|
||||
$artifactData = $bwp->updateBoundByArrayUid($artifactData, $result);
|
||||
|
||||
$uidOld = $artifactData["ART_UID"];
|
||||
$artifactData["ART_UID"] = Util\Common::generateUID();
|
||||
@@ -1401,6 +1471,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
/*
|
||||
* Diagram's Gateways Handling
|
||||
*/
|
||||
$arrayGatewayUid = array();
|
||||
$arrayUidGatewayParallel = array();
|
||||
$flagGatewayParallel = false;
|
||||
|
||||
@@ -1420,18 +1491,8 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
if ($forceInsert || is_null($gateway)) {
|
||||
if ($generateUid) {
|
||||
//Gateway
|
||||
|
||||
//Update UIDs
|
||||
if ($gatewayData["BOU_CONTAINER"] == "bpmnPool" || $gatewayData["BOU_CONTAINER"] == "bpmnLane" || $gatewayData["BOU_CONTAINER"] == "bpmnActivity") {
|
||||
foreach ($result as $value) {
|
||||
if ($gatewayData["BOU_ELEMENT"] == $value["old_uid"]) {
|
||||
$gatewayData["BOU_ELEMENT"] = $value["new_uid"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($gatewayData["BOU_UID"]);
|
||||
//Generate and update UID
|
||||
$gatewayData = $bwp->updateBoundByArrayUid($gatewayData, $result);
|
||||
|
||||
$uidOld = $gatewayData["GAT_UID"];
|
||||
$gatewayData["GAT_UID"] = Util\Common::generateUID();
|
||||
@@ -1463,6 +1524,8 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
}
|
||||
}
|
||||
|
||||
$arrayGatewayUid[$gatewayData["GAT_UID"]] = 1;
|
||||
|
||||
$diagram["gateways"][$i] = $gatewayData;
|
||||
$whiteList[] = $gatewayData["GAT_UID"];
|
||||
}
|
||||
@@ -1482,10 +1545,13 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$whiteList = array();
|
||||
foreach ($diagram["events"] as $i => $eventData) {
|
||||
$eventData = array_change_key_case($eventData, CASE_UPPER);
|
||||
|
||||
unset($eventData["_EXTENDED"]);
|
||||
|
||||
if (array_key_exists("EVN_CANCEL_ACTIVITY", $eventData)) {
|
||||
$eventData["EVN_CANCEL_ACTIVITY"] = $eventData["EVN_CANCEL_ACTIVITY"] ? 1 : 0;
|
||||
}
|
||||
|
||||
if (array_key_exists("EVN_WAIT_FOR_COMPLETION", $eventData)) {
|
||||
$eventData["EVN_WAIT_FOR_COMPLETION"] = $eventData["EVN_WAIT_FOR_COMPLETION"] ? 1 : 0;
|
||||
}
|
||||
@@ -1498,18 +1564,8 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
if ($forceInsert || is_null($event)) {
|
||||
if ($generateUid) {
|
||||
//Event
|
||||
|
||||
//Update UIDs
|
||||
if ($eventData["BOU_CONTAINER"] == "bpmnPool" || $eventData["BOU_CONTAINER"] == "bpmnLane" || $eventData["BOU_CONTAINER"] == "bpmnActivity") {
|
||||
foreach ($result as $value) {
|
||||
if ($eventData["BOU_ELEMENT"] == $value["old_uid"]) {
|
||||
$eventData["BOU_ELEMENT"] = $value["new_uid"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($eventData["BOU_UID"]);
|
||||
//Generate and update UID
|
||||
$eventData = $bwp->updateBoundByArrayUid($eventData, $result);
|
||||
|
||||
$uidOld = $eventData["EVN_UID"];
|
||||
$eventData["EVN_UID"] = Util\Common::generateUID();
|
||||
@@ -1558,18 +1614,8 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
if ($forceInsert || is_null($dataObject)) {
|
||||
if ($generateUid) {
|
||||
//Data
|
||||
|
||||
//Update UIDs
|
||||
if ($dataObjectData["BOU_CONTAINER"] == "bpmnPool" || $dataObjectData["BOU_CONTAINER"] == "bpmnLane" || $dataObjectData["BOU_CONTAINER"] == "bpmnActivity") {
|
||||
foreach ($result as $value) {
|
||||
if ($dataObjectData["BOU_ELEMENT"] == $value["old_uid"]) {
|
||||
$dataObjectData["BOU_ELEMENT"] = $value["new_uid"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($dataObjectData["BOU_UID"]);
|
||||
//Generate and update UID
|
||||
$dataObjectData = $bwp->updateBoundByArrayUid($dataObjectData, $result);
|
||||
|
||||
$uidOld = $dataObjectData["DAT_UID"];
|
||||
$dataObjectData["DAT_UID"] = Util\Common::generateUID();
|
||||
@@ -1618,18 +1664,8 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
|
||||
if ($forceInsert || is_null($participant)) {
|
||||
if ($generateUid) {
|
||||
//Participant
|
||||
|
||||
//Update UIDs
|
||||
if ($participantData["BOU_CONTAINER"] == "bpmnPool" || $participantData["BOU_CONTAINER"] == "bpmnLane" || $participantData["BOU_CONTAINER"] == "bpmnActivity") {
|
||||
foreach ($result as $value) {
|
||||
if ($participantData["BOU_ELEMENT"] == $value["old_uid"]) {
|
||||
$participantData["BOU_ELEMENT"] = $value["new_uid"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unset($participantData["BOU_UID"]);
|
||||
//Generate and update UID
|
||||
$participantData = $bwp->updateBoundByArrayUid($participantData, $result);
|
||||
|
||||
$uidOld = $participantData["PAR_UID"];
|
||||
$participantData["PAR_UID"] = Util\Common::generateUID();
|
||||
@@ -1665,9 +1701,9 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
/*
|
||||
* Diagram's Flows Handling
|
||||
*/
|
||||
$arrayGatewayGatDefaultFlow = array();
|
||||
|
||||
$whiteList = array();
|
||||
$defaultFlow = array();
|
||||
$pos = 0;
|
||||
|
||||
foreach ($diagram["flows"] as $i => $flowData) {
|
||||
$flowData = array_change_key_case($flowData, CASE_UPPER);
|
||||
@@ -1675,8 +1711,8 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
// if it is a new flow record
|
||||
if ($forceInsert || ($generateUid && !\BpmnFlow::exists($flowData["FLO_UID"]))) {
|
||||
$uidOld = $flowData["FLO_UID"];
|
||||
|
||||
$flowData["FLO_UID"] = Util\Common::generateUID();
|
||||
|
||||
$result[] = array(
|
||||
"object" => "flow",
|
||||
"old_uid" => $uidOld,
|
||||
@@ -1695,12 +1731,6 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$flowData["FLO_ELEMENT_DEST"] = $mappedUid;
|
||||
}
|
||||
}
|
||||
//Save the default flow Uid's
|
||||
if($flowData["FLO_TYPE"] == 'DEFAULT'){
|
||||
$defaultFlow[$pos]['GAT_UID'] = $flowData["FLO_ELEMENT_ORIGIN"];
|
||||
$defaultFlow[$pos]['GAT_DEFAULT_FLOW'] = $flowData["FLO_UID"];
|
||||
$pos++;
|
||||
}
|
||||
|
||||
//Update UIDs
|
||||
foreach ($result as $value) {
|
||||
@@ -1718,6 +1748,11 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$flowData["FLO_CONDITION"] = "";
|
||||
}
|
||||
|
||||
//Add element to array Gateway default flow
|
||||
if ($flowData["FLO_TYPE"] == "DEFAULT" && isset($arrayGatewayUid[$flowData["FLO_ELEMENT_ORIGIN"]])) {
|
||||
$arrayGatewayGatDefaultFlow[$flowData["FLO_ELEMENT_ORIGIN"]] = $flowData["FLO_UID"];
|
||||
}
|
||||
|
||||
$diagram["flows"][$i] = $flowData;
|
||||
$whiteList[] = $flowData["FLO_UID"];
|
||||
}
|
||||
@@ -1742,19 +1777,14 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
}
|
||||
}
|
||||
|
||||
$bwp->mapBpmnFlowsToWorkflowRoutes();
|
||||
|
||||
//Update the Default gateway
|
||||
$gateways = $bwp->getGateways();
|
||||
foreach ($gateways as $gatewayData) {
|
||||
foreach ($defaultFlow as $def) {
|
||||
if($gatewayData["GAT_UID"] == $def["GAT_UID"]){
|
||||
$gatewayData["GAT_DEFAULT_FLOW"] = $def["GAT_DEFAULT_FLOW"];
|
||||
$bwp->updateGateway($gatewayData["GAT_UID"], $gatewayData);
|
||||
}
|
||||
}
|
||||
//Update BPMN_GATEWAY.GAT_DEFAULT_FLOW
|
||||
foreach ($arrayGatewayGatDefaultFlow as $key => $value) {
|
||||
$bwp->updateGateway($key, array("GAT_DEFAULT_FLOW" => $value));
|
||||
}
|
||||
|
||||
$bwp->mapBpmnFlowsToWorkflowRoutes();
|
||||
|
||||
//Return
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -1780,7 +1810,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
try {
|
||||
$bpmnEvent = \BpmnEventPeer::retrieveByPK($eventUid);
|
||||
|
||||
if (!is_null($bpmnEvent) && $bpmnEvent->getEvnType() == "START") {
|
||||
if (!is_null($bpmnEvent) && $bpmnEvent->getEvnType() == "START" && $bpmnEvent->getEvnMarker() == "EMPTY") {
|
||||
$webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
|
||||
|
||||
if ($webEntryEvent->existsEvent($bpmnEvent->getPrjUid(), $bpmnEvent->getEvnUid())) {
|
||||
|
||||
@@ -828,9 +828,9 @@ class Workflow extends Handler
|
||||
$messageEventRelation->deleteWhere(array(\MessageEventRelationPeer::PRJ_UID => $sProcessUID));
|
||||
|
||||
//Delete Message-Event-Task-Relation
|
||||
$messageEventTaskRelation = new \ProcessMaker\BusinessModel\MessageEventTaskRelation();
|
||||
$elementTaskRelation = new \ProcessMaker\BusinessModel\ElementTaskRelation();
|
||||
|
||||
$messageEventTaskRelation->deleteWhere(array(\MessageEventTaskRelationPeer::PRJ_UID => $sProcessUID));
|
||||
$elementTaskRelation->deleteWhere(array(\ElementTaskRelationPeer::PRJ_UID => $sProcessUID));
|
||||
|
||||
//Delete Message-Event-Definition
|
||||
$messageEventDefinition = new \ProcessMaker\BusinessModel\MessageEventDefinition();
|
||||
@@ -1286,33 +1286,5 @@ class Workflow extends Handler
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteTaskByArrayType($processUid, array $arrayTaskType)
|
||||
{
|
||||
try {
|
||||
$task = new \Tasks();
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\TaskPeer::TAS_UID);
|
||||
$criteria->add(\TaskPeer::PRO_UID, $processUid, \Criteria::EQUAL);
|
||||
$criteria->add(\TaskPeer::TAS_TYPE, $arrayTaskType, \Criteria::IN);
|
||||
|
||||
$rsCriteria = \TaskPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
$taskUid = $row["TAS_UID"];
|
||||
|
||||
$task->deleteTask($taskUid);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
548
workflow/engine/src/ProcessMaker/Services/Api/ActionsByEmail.php
Normal file
548
workflow/engine/src/ProcessMaker/Services/Api/ActionsByEmail.php
Normal file
@@ -0,0 +1,548 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
require_once 'classes/model/AbeConfiguration.php';
|
||||
require_once 'classes/model/AbeRequests.php';
|
||||
require_once 'classes/model/AbeResponses.php';
|
||||
require_once 'classes/model/AppDelegation.php';
|
||||
require_once 'classes/model/Application.php';
|
||||
require_once 'classes/model/Users.php';
|
||||
|
||||
/**
|
||||
* Class ActionsByEmail
|
||||
*
|
||||
* @author gustavo cruz <gustavo.cruz@colosa.com>
|
||||
*/
|
||||
class ActionsByEmail extends Api
|
||||
{
|
||||
|
||||
/**
|
||||
* @url GET
|
||||
*/
|
||||
public function getABEList()
|
||||
{
|
||||
try {
|
||||
$projects = array('status' => 200, 'message' => 'Hello');
|
||||
return $projects;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @url GET /editTemplate
|
||||
*/
|
||||
public function editTemplate($params)
|
||||
{
|
||||
// Action Validations
|
||||
if (!isset($_REQUEST['TEMPLATE'])) {
|
||||
$_REQUEST['TEMPLATE'] = '';
|
||||
}
|
||||
|
||||
if ($_REQUEST['TEMPLATE'] == '') {
|
||||
throw new Exception('The TEMPLATE parameter is empty.');
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'CONTENT' => file_get_contents(PATH_DATA_MAILTEMPLATES . $_REQUEST['PRO_UID'] . PATH_SEP . $_REQUEST['TEMPLATE']),
|
||||
'TEMPLATE' => $_REQUEST['TEMPLATE'],
|
||||
);
|
||||
|
||||
global $G_PUBLISH;
|
||||
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'actionsByEmail/actionsByEmail_FileEdit', '', $data);
|
||||
|
||||
G::RenderPage('publish', 'raw');
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @url PUT /updateTemplate
|
||||
*/
|
||||
public function updateTemplate($params)
|
||||
{
|
||||
// Action Validations
|
||||
if (!isset($_REQUEST['TEMPLATE'])) {
|
||||
$_REQUEST['TEMPLATE'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['CONTENT'])) {
|
||||
$_REQUEST['CONTENT'] = '';
|
||||
}
|
||||
|
||||
if ($_REQUEST['TEMPLATE'] == '') {
|
||||
throw new Exception('The TEMPLATE parameter is empty.');
|
||||
}
|
||||
|
||||
$templateFile = fopen(PATH_DATA_MAILTEMPLATES . $_REQUEST['PRO_UID'] . PATH_SEP . $_REQUEST['TEMPLATE'], 'w');
|
||||
$content = stripslashes($_REQUEST['CONTENT']);
|
||||
$content = str_replace('@amp@', '&', $content);
|
||||
$content = base64_decode($content);
|
||||
|
||||
fwrite($templateFile, $content);
|
||||
fclose($templateFile);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @url GET /loadFields
|
||||
*/
|
||||
public function loadFields($params)
|
||||
{
|
||||
if (!isset($_REQUEST['DYN_UID'])) {
|
||||
$_REQUEST['DYN_UID'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['PRO_UID'])) {
|
||||
$_REQUEST['PRO_UID'] = '';
|
||||
}
|
||||
|
||||
$response->emailFields = array();
|
||||
$response->actionFields = array();
|
||||
|
||||
if ($_REQUEST['PRO_UID'] != '' && $_REQUEST['DYN_UID']) {
|
||||
$dynaform = new Form($_REQUEST['PRO_UID'] . PATH_SEP . $_REQUEST['DYN_UID'], PATH_DYNAFORM, SYS_LANG, false);
|
||||
|
||||
foreach ($dynaform->fields as $fieldName => $data) {
|
||||
switch ($data->type) {
|
||||
case 'text':
|
||||
case 'suggest':
|
||||
case 'hidden':
|
||||
case 'textarea':
|
||||
$response->emailFields[] = array('value' => $data->name, 'label' => $data->label . ' (@@' . $data->name . ')');
|
||||
break;
|
||||
case 'dropdown':
|
||||
case 'radiogroup':
|
||||
case 'yesno':
|
||||
case 'checkbox':
|
||||
$response->actionFields[] = array('value' => $data->name, 'label' => $data->label . ' (@@' . $data->name . ')');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @url PUT /saveConfiguration
|
||||
*/
|
||||
public function saveConfiguration($params)
|
||||
{
|
||||
if (!isset($_REQUEST['ABE_UID'])) {
|
||||
$_REQUEST['ABE_UID'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['PRO_UID'])) {
|
||||
$_REQUEST['PRO_UID'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['TAS_UID'])) {
|
||||
$_REQUEST['TAS_UID'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['ABE_TYPE'])) {
|
||||
$_REQUEST['ABE_TYPE'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['ABE_TEMPLATE'])) {
|
||||
$_REQUEST['ABE_TEMPLATE'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['DYN_UID'])) {
|
||||
$_REQUEST['DYN_UID'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['ABE_EMAIL_FIELD'])) {
|
||||
$_REQUEST['ABE_EMAIL_FIELD'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['ABE_ACTION_FIELD'])) {
|
||||
$_REQUEST['ABE_ACTION_FIELD'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['ABE_CASE_NOTE_IN_RESPONSE'])) {
|
||||
$_REQUEST['ABE_CASE_NOTE_IN_RESPONSE'] = 0;
|
||||
}
|
||||
|
||||
if ($_REQUEST['PRO_UID'] == '') {
|
||||
throw new Exception('The PRO_UID parameter is empty.');
|
||||
}
|
||||
|
||||
if ($_REQUEST['TAS_UID'] == '') {
|
||||
throw new Exception('The TAS_UID parameter is empty.');
|
||||
}
|
||||
|
||||
require_once 'classes/model/AbeConfiguration.php';
|
||||
|
||||
$abeConfigurationInstance = new AbeConfiguration();
|
||||
|
||||
if ($_REQUEST['ABE_TYPE'] != '') {
|
||||
if ($_REQUEST['DYN_UID'] == '') {
|
||||
throw new Exception('The DYN_UID parameter is empty.');
|
||||
}
|
||||
|
||||
try {
|
||||
$response->ABE_UID = $abeConfigurationInstance->createOrUpdate($_REQUEST);
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
$abeConfigurationInstance->deleteByTasUid($_REQUEST['TAS_UID']);
|
||||
$response->ABE_UID = '';
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @url GET /loadActionByEmail
|
||||
*/
|
||||
public function loadActionByEmail($params)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn('COUNT(*)');
|
||||
|
||||
$criteria->addJoin(AbeConfigurationPeer::ABE_UID, AbeRequestsPeer::ABE_UID);
|
||||
$criteria->addJoin(AppDelegationPeer::APP_UID, AbeRequestsPeer::APP_UID);
|
||||
$criteria->addJoin(AppDelegationPeer::DEL_INDEX, AbeRequestsPeer::DEL_INDEX);
|
||||
$result = AbeConfigurationPeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$result->next();
|
||||
$totalCount = $result->getRow();
|
||||
$totalCount = $totalCount['COUNT(*)'];
|
||||
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_UPDATE_DATE);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_TEMPLATE);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID);
|
||||
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::APP_UID);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SENT_TO);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_STATUS);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SUBJECT);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_ANSWERED);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_BODY);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_DATE);
|
||||
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_NUMBER);
|
||||
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS);
|
||||
|
||||
$criteria->addJoin(AbeConfigurationPeer::ABE_UID, AbeRequestsPeer::ABE_UID);
|
||||
$criteria->addJoin(ApplicationPeer::APP_UID, AbeRequestsPeer::APP_UID);
|
||||
|
||||
$criteria->addJoin(AppDelegationPeer::APP_UID, AbeRequestsPeer::APP_UID);
|
||||
$criteria->addJoin(AppDelegationPeer::DEL_INDEX, AbeRequestsPeer::DEL_INDEX);
|
||||
$criteria->addDescendingOrderByColumn(AbeRequestsPeer::ABE_REQ_DATE);
|
||||
$criteria->setLimit($_REQUEST['limit']);
|
||||
$criteria->setOffset($_REQUEST['start']);
|
||||
$result = AbeConfigurationPeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$data = Array();
|
||||
$arrayPro = Array();
|
||||
$arrayTAS = Array();
|
||||
$index = 0;
|
||||
|
||||
while ($result->next()) {
|
||||
$data[] = $result->getRow();
|
||||
$criteriaRes = new Criteria();
|
||||
|
||||
$criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_UID);
|
||||
$criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_CLIENT_IP);
|
||||
$criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_DATA);
|
||||
$criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_STATUS);
|
||||
$criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_MESSAGE);
|
||||
|
||||
$criteriaRes->add(AbeResponsesPeer::ABE_REQ_UID, $data[$index]['ABE_REQ_UID']);
|
||||
|
||||
$resultRes = AbeResponsesPeer::doSelectRS($criteriaRes);
|
||||
$resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$resultRes->next();
|
||||
$dataRes = Array();
|
||||
|
||||
if ($dataRes = $resultRes->getRow()) {
|
||||
$data[$index]['ABE_RES_UID'] = $dataRes['ABE_RES_UID'];
|
||||
$data[$index]['ABE_RES_CLIENT_IP'] = $dataRes['ABE_RES_CLIENT_IP'];
|
||||
$data[$index]['ABE_RES_DATA'] = $dataRes['ABE_RES_DATA'];
|
||||
$data[$index]['ABE_RES_STATUS'] = $dataRes['ABE_RES_STATUS'];
|
||||
$data[$index]['ABE_RES_MESSAGE'] = $dataRes['ABE_RES_MESSAGE'];
|
||||
} else {
|
||||
$data[$index]['ABE_RES_UID'] = '';
|
||||
$data[$index]['ABE_RES_CLIENT_IP'] = '';
|
||||
$data[$index]['ABE_RES_DATA'] = '';
|
||||
$data[$index]['ABE_RES_STATUS'] = '';
|
||||
$data[$index]['ABE_RES_MESSAGE'] = '';
|
||||
}
|
||||
|
||||
$criteriaRes = new Criteria();
|
||||
|
||||
$criteriaRes->addSelectColumn(AppDelegationPeer::USR_UID);
|
||||
$criteriaRes->addSelectColumn(UsersPeer::USR_FIRSTNAME);
|
||||
$criteriaRes->addSelectColumn(UsersPeer::USR_LASTNAME);
|
||||
|
||||
$criteria->addJoin(AppDelegationPeer::APP_UID, $data[$index]['APP_UID']);
|
||||
$criteria->addJoin(AppDelegationPeer::DEL_INDEX, $data[$index]['DEL_PREVIOUS']);
|
||||
$criteria->addJoin(AppDelegationPeer::USR_UID, UsersPeer::USR_UID);
|
||||
$resultRes = AppDelegationPeer::doSelectRS($criteriaRes);
|
||||
$resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$resultRes->next();
|
||||
|
||||
if ($dataRes = $resultRes->getRow()) {
|
||||
$data[$index]['USER'] = $dataRes['USR_FIRSTNAME'] . ' ' . $dataRes['USR_LASTNAME'];
|
||||
} else {
|
||||
$data[$index]['USER'] = '';
|
||||
}
|
||||
|
||||
$data[$index]['ABE_REQ_ANSWERED'] = ($data[$index]['ABE_REQ_ANSWERED'] == 1) ? 'YES' : 'NO';
|
||||
$index++;
|
||||
}
|
||||
|
||||
$response = array();
|
||||
$response['totalCount'] = $totalCount;
|
||||
$response['data'] = $data;
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @url POST /forwardMail
|
||||
*/
|
||||
public function forwardMail($params)
|
||||
{
|
||||
if (!isset($_REQUEST['REQ_UID'])) {
|
||||
$_REQUEST['REQ_UID'] = '';
|
||||
}
|
||||
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID);
|
||||
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::APP_UID);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SENT_TO);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SUBJECT);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_BODY);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_ANSWERED);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_STATUS);
|
||||
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
|
||||
|
||||
$criteria->add(AbeRequestsPeer::ABE_REQ_UID, $_REQUEST['REQ_UID']);
|
||||
$criteria->addJoin(AbeRequestsPeer::ABE_UID, AbeConfigurationPeer::ABE_UID);
|
||||
$criteria->addJoin(AppDelegationPeer::APP_UID, AbeRequestsPeer::APP_UID);
|
||||
$criteria->addJoin(AppDelegationPeer::DEL_INDEX, AbeRequestsPeer::DEL_INDEX);
|
||||
$resultRes = AbeRequestsPeer::doSelectRS($criteria);
|
||||
$resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$resultRes->next();
|
||||
$dataRes = Array();
|
||||
|
||||
if ($dataRes = $resultRes->getRow()) {
|
||||
if (is_null($dataRes['DEL_FINISH_DATE'])) {
|
||||
require_once 'classes/model/Configuration.php';
|
||||
G::LoadClass('spool');
|
||||
|
||||
$configuration = new Configuration();
|
||||
$sDelimiter = DBAdapter::getStringDelimiter();
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(ConfigurationPeer::CFG_UID, 'Emails');
|
||||
$criteria->add(ConfigurationPeer::OBJ_UID, '');
|
||||
$criteria->add(ConfigurationPeer::PRO_UID, '');
|
||||
$criteria->add(ConfigurationPeer::USR_UID, '');
|
||||
$criteria->add(ConfigurationPeer::APP_UID, '');
|
||||
|
||||
if (ConfigurationPeer::doCount($criteria) == 0) {
|
||||
$configuration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => '', 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => ''));
|
||||
$newConfiguration = array();
|
||||
} else {
|
||||
$newConfiguration = $configuration->load('Emails', '', '', '', '');
|
||||
|
||||
if ($newConfiguration['CFG_VALUE'] != '') {
|
||||
$newConfiguration = unserialize($newConfiguration['CFG_VALUE']);
|
||||
} else {
|
||||
$newConfiguration = array();
|
||||
}
|
||||
}
|
||||
|
||||
$spool = new spoolRun();
|
||||
$spool->setConfig(array(
|
||||
'MESS_ENGINE' => $newConfiguration['MESS_ENGINE'],
|
||||
'MESS_SERVER' => $newConfiguration['MESS_SERVER'],
|
||||
'MESS_PORT' => $newConfiguration['MESS_PORT'],
|
||||
'MESS_ACCOUNT' => $newConfiguration['MESS_ACCOUNT'],
|
||||
'MESS_PASSWORD' => $newConfiguration['MESS_PASSWORD'],
|
||||
'SMTPAuth' => $newConfiguration['MESS_RAUTH']
|
||||
));
|
||||
|
||||
$spool->create(array(
|
||||
'msg_uid' => '',
|
||||
'app_uid' => $dataRes['APP_UID'],
|
||||
'del_index' => $dataRes['DEL_INDEX'],
|
||||
'app_msg_type' => 'TEST',
|
||||
'app_msg_subject' => $dataRes['ABE_REQ_SUBJECT'],
|
||||
'app_msg_from' => $newConfiguration['MESS_ACCOUNT'],
|
||||
'app_msg_to' => $dataRes['ABE_REQ_SENT_TO'],
|
||||
'app_msg_body' => $dataRes['ABE_REQ_BODY'],
|
||||
'app_msg_cc' => '',
|
||||
'app_msg_bcc' => '',
|
||||
'app_msg_attach' => '',
|
||||
'app_msg_template' => '',
|
||||
'app_msg_status' => 'pending'
|
||||
));
|
||||
|
||||
if ($spool->sendMail()) {
|
||||
$dataRes['ABE_REQ_STATUS'] = 'SENT';
|
||||
|
||||
$message = 'The email was resend to: ' . $dataRes['ABE_REQ_SENT_TO'];
|
||||
} else {
|
||||
$dataRes['ABE_REQ_STATUS'] = 'ERROR';
|
||||
$message = 'There was a problem sending the email to: ' . $dataRes['ABE_REQ_SENT_TO'] . ', please try later.';
|
||||
}
|
||||
|
||||
try {
|
||||
$abeRequestsInstance = new AbeRequests();
|
||||
$abeRequestsInstance->createOrUpdate($dataRes);
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
} else {
|
||||
$message = 'Unable to send email, the task is closed.';
|
||||
}
|
||||
} else {
|
||||
$message = 'An unexpected error occurred please try again later.';
|
||||
}
|
||||
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @url GET /viewForm
|
||||
*/
|
||||
public function viewForm($params)
|
||||
{
|
||||
//coment
|
||||
if (!isset($_REQUEST['REQ_UID'])) {
|
||||
$_REQUEST['REQ_UID'] = '';
|
||||
}
|
||||
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD);
|
||||
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::APP_UID);
|
||||
$criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX);
|
||||
|
||||
$criteria->addSelectColumn(AbeResponsesPeer::ABE_RES_UID);
|
||||
$criteria->addSelectColumn(AbeResponsesPeer::ABE_RES_DATA);
|
||||
|
||||
|
||||
$criteria->add(AbeRequestsPeer::ABE_REQ_UID, $_REQUEST['REQ_UID']);
|
||||
$criteria->addJoin(AbeRequestsPeer::ABE_UID, AbeConfigurationPeer::ABE_UID);
|
||||
$criteria->addJoin(AbeResponsesPeer::ABE_REQ_UID, AbeRequestsPeer::ABE_REQ_UID);
|
||||
$resultRes = AbeRequestsPeer::doSelectRS($criteria);
|
||||
$resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$resultRes->next();
|
||||
$dataRes = Array();
|
||||
$message = 'The user has not responded to this request.';
|
||||
|
||||
if ($dataRes = $resultRes->getRow()) {
|
||||
$_SESSION['CURRENT_DYN_UID'] = trim($dataRes['DYN_UID']);
|
||||
$dynaform = new Form($dataRes['PRO_UID'] . PATH_SEP . trim($dataRes['DYN_UID']), PATH_DYNAFORM, SYS_LANG, false);
|
||||
$dynaform->mode = 'view';
|
||||
|
||||
if ($dataRes['ABE_RES_DATA'] != '') {
|
||||
$value = unserialize($dataRes['ABE_RES_DATA']);
|
||||
|
||||
if (is_array($value)) {
|
||||
$dynaform->values = $value;
|
||||
|
||||
foreach ($dynaform->fields as $fieldName => $field) {
|
||||
if ($field->type == 'submit') {
|
||||
unset($dynaform->fields[$fieldName]);
|
||||
}
|
||||
}
|
||||
|
||||
$message = $dynaform->render(PATH_CORE . 'templates/xmlform.html', $scriptCode);
|
||||
} else {
|
||||
$response = $dynaform->render(PATH_CORE . 'templates/xmlform.html', $scriptCode);
|
||||
$field = $dynaform->fields[$dataRes['ABE_ACTION_FIELD']];
|
||||
$message = '<b>Type: </b>' . $field->type . '<br>';
|
||||
|
||||
switch ($field->type) {
|
||||
case 'dropdown':
|
||||
case 'radiogroup':
|
||||
$message .=$field->label . ' - ';
|
||||
$message .= $field->options[$value];
|
||||
break;
|
||||
case 'yesno':
|
||||
$message .= '<b>' . $field->label . ' </b>- ';
|
||||
$message .= ($value == 1) ? 'Yes' : 'No';
|
||||
break;
|
||||
case 'checkbox':
|
||||
$message .= '<b>' . $field->label . '</b> - ';
|
||||
$message .= ($value == 'On') ? 'Check' : 'Uncheck';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $message;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @url GET /Templates/:proId
|
||||
*/
|
||||
public function getTemplates($proId)
|
||||
{
|
||||
$templates = array();
|
||||
$path = PATH_DATA_MAILTEMPLATES . $proId . PATH_SEP;
|
||||
|
||||
\G::verifyPath($path, true);
|
||||
|
||||
if (defined('PARTNER_FLAG')) {
|
||||
if (!file_exists($path . 'actionsByEmailPartner.html')) {
|
||||
@copy(PATH_TPL . 'actionsByEmail' . PATH_SEP . 'actionsByEmailPartner.html', $path . 'actionsByEmail.html');
|
||||
}
|
||||
} else {
|
||||
if (!file_exists($path . 'actionsByEmail.html')) {
|
||||
@copy(PATH_TPL . 'actionsByEmail' . PATH_SEP . 'actionsByEmail.html', $path . 'actionsByEmail.html');
|
||||
}
|
||||
}
|
||||
|
||||
$directory = dir($path);
|
||||
|
||||
while ($object = $directory->read()) {
|
||||
if (($object !== '.') && ($object !== '..') && ($object !== 'alert_message.html')) {
|
||||
$templates[] = array('FILE' => $object, 'NAME' => $object);
|
||||
}
|
||||
}
|
||||
return $templates;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -59,6 +59,9 @@ class Department extends Api
|
||||
|
||||
/**
|
||||
* @param string $dep_uid {@min 1}{@max 32}
|
||||
* @param string $start {@from path}
|
||||
* @param string $limit {@from path}
|
||||
* @param string $search {@from path}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
@@ -68,11 +71,11 @@ class Department extends Api
|
||||
*
|
||||
* @url GET /:dep_uid/available-user
|
||||
*/
|
||||
public function doGetAvailableUser($dep_uid)
|
||||
public function doGetAvailableUser($dep_uid, $start = 0, $limit = 0, $search = '')
|
||||
{
|
||||
try {
|
||||
$oDepartment = new \ProcessMaker\BusinessModel\Department();
|
||||
$response = $oDepartment->getAvailableUser($dep_uid);
|
||||
$response = $oDepartment->getAvailableUser($dep_uid, $start, $limit, $search);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
@@ -80,25 +83,21 @@ class Department extends Api
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $dep_uid {@min 1}{@max 32}
|
||||
* @param string $usr_uid {@min 1}{@max 32}
|
||||
* @url POST /:dep_uid/assign-user
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @param string $dep_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @url PUT /:dep_uid/assign-user/:usr_uid
|
||||
* @status 201
|
||||
*/
|
||||
public function doPutAssignUser($dep_uid, $usr_uid)
|
||||
public function doPostAssignUser($dep_uid, array $request_data)
|
||||
{
|
||||
try {
|
||||
$oDepartment = new \ProcessMaker\BusinessModel\Department();
|
||||
$response = $oDepartment->assignUser($dep_uid, $usr_uid);
|
||||
return $response;
|
||||
$department = new \ProcessMaker\BusinessModel\Department();
|
||||
|
||||
$arrayData = $department->assignUser($dep_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -351,26 +351,27 @@ class Light extends Api
|
||||
foreach ($d as $field => $value) {
|
||||
if (array_key_exists($field, $structure)) {
|
||||
$newName = $structure[$field];
|
||||
$newData[$newName] = $value;
|
||||
$newData[$newName] = is_null($value) ? "":$value;
|
||||
} else {
|
||||
foreach ($structure as $name => $str) {
|
||||
if (is_array($str) && array_key_exists($field, $str)) {
|
||||
$newName = $str[$field];
|
||||
$newData[$name][$newName] = $value;
|
||||
$newData[$name][$newName] = is_null($value) ? "":$value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$response[] = $newData;
|
||||
if (count($newData) > 0)
|
||||
$response[] = $newData;
|
||||
} else {
|
||||
if (array_key_exists($field, $structure)) {
|
||||
$newName = $structure[$field];
|
||||
$response[$newName] = $d;
|
||||
$response[$newName] = is_null($d) ? "":$d;
|
||||
} else {
|
||||
foreach ($structure as $name => $str) {
|
||||
if (is_array($str) && array_key_exists($field, $str)) {
|
||||
$newName = $str[$field];
|
||||
$response[$name][$newName] = $d;
|
||||
$response[$name][$newName] = is_null($d) ? "":$d;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -610,52 +611,18 @@ class Light extends Api
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /case/:app_uid/input-document
|
||||
* @url POST /case/:app_uid/upload/location
|
||||
*
|
||||
* @param string $app_uid { @min 32}{@max 32}
|
||||
* @param string $tas_uid {@min 32}{@max 32}
|
||||
* @param string $app_doc_comment
|
||||
* @param string $inp_doc_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doPostInputDocument($app_uid, $tas_uid, $app_doc_comment, $inp_doc_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$inputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();
|
||||
$file = $inputDocument->addCasesInputDocument($app_uid, $tas_uid, $app_doc_comment, $inp_doc_uid, $userUid);
|
||||
$response = $this->parserInputDocument($file);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function parserInputDocument ($data)
|
||||
{
|
||||
$structure = array(
|
||||
'app_doc_uid' => 'fileId',
|
||||
'app_doc_filename' => 'fileName',
|
||||
'app_doc_version' => 'version'
|
||||
);
|
||||
$response = $this->replaceFields($data, $structure);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /case/:app_uid/input-document/location
|
||||
*
|
||||
* @param string $app_uid { @min 32}{@max 32}
|
||||
* @param string $tas_uid {@min 32}{@max 32}
|
||||
* @param string $app_doc_comment
|
||||
* @param string $inp_doc_uid {@min 32}{@max 32}
|
||||
* @param float $latitude {@min -90}{@max 90}
|
||||
* @param string $app_uid { @min 32}{@max 32}
|
||||
* @param float $latitude {@min -90}{@max 90}
|
||||
* @param float $longitude {@min -180}{@max 180}
|
||||
*/
|
||||
public function postInputDocumentLocation($app_uid, $tas_uid, $app_doc_comment, $inp_doc_uid, $latitude, $longitude)
|
||||
public function postInputDocumentLocation($app_uid, $latitude, $longitude)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$inputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();
|
||||
$oMobile = new \ProcessMaker\BusinessModel\Light();
|
||||
|
||||
$url = "http://maps.googleapis.com/maps/api/staticmap?center=".$latitude.','.$longitude."&format=jpg&size=600x600&zoom=15&markers=color:blue%7Clabel:S%7C".$latitude.','.$longitude;
|
||||
$imageLocation = imagecreatefromjpeg($url);
|
||||
$tmpfname = tempnam("php://temp","pmm");
|
||||
@@ -667,17 +634,21 @@ class Light extends Api
|
||||
$_FILES["form"]["error"] = 0;
|
||||
$sizes = getimagesize($tmpfname);
|
||||
$_FILES["form"]["size"] = ($sizes['0'] * $sizes['1']);
|
||||
$file = $inputDocument->addCasesInputDocument($app_uid, $tas_uid, $app_doc_comment, $inp_doc_uid, $userUid);
|
||||
|
||||
$request_data = array(array('name' => $_FILES["form"]["name"]));
|
||||
$file = $oMobile->postUidUploadFiles($userUid, $app_uid, $request_data);
|
||||
|
||||
$strPathName = PATH_DOCUMENT . G::getPathFromUID($app_uid) . PATH_SEP;
|
||||
$strFileName = $file->app_doc_uid . "_" . $file->app_doc_version . ".jpg";
|
||||
copy($tmpfname, $strPathName . "/" . $strFileName);
|
||||
$response = $this->parserInputDocument($file);
|
||||
$strFileName = $file[0]['appDocUid'] . "_" . $file[0]['docVersion'] . ".jpg";
|
||||
if (! is_dir( $strPathName )) {
|
||||
G::verifyPath( $strPathName, true );
|
||||
}
|
||||
copy($tmpfname, $strPathName . $strFileName);
|
||||
unlink($tmpfname);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
return $response;
|
||||
return $file;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -726,9 +697,95 @@ class Light extends Api
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$oMobile = new \ProcessMaker\BusinessModel\Light();
|
||||
$oMobile->getInformation($userUid, $type, $app_uid);
|
||||
$response = $oMobile->getInformation($userUid, $type, $app_uid);
|
||||
$response = $this->parserGetInformation($response);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function parserGetInformation ($data)
|
||||
{
|
||||
$structure = array(
|
||||
'case' => array(
|
||||
'PRO_TITLE' => 'processTitle',
|
||||
'APP_TITLE' => 'caseTitle',
|
||||
'APP_NUMBER' => 'caseNumber',
|
||||
'APP_STATUS' => 'caseStatus',
|
||||
'APP_UID' => 'caseId',
|
||||
'CREATOR' => 'caseCreator',
|
||||
'CREATE_DATE' => 'caseCreateDate',
|
||||
'UPDATE_DATE' => 'caseUpdateData',
|
||||
'DESCRIPTION' => 'caseDescription'
|
||||
),
|
||||
'task' => array(
|
||||
'TAS_TITLE' => 'taskTitle',
|
||||
'CURRENT_USER' => 'currentUser',
|
||||
'DEL_DELEGATE_DATE' => 'delDelegateDate',
|
||||
'DEL_INIT_DATE' => 'delInitDate',
|
||||
'DEL_TASK_DUE_DATE' => 'delDueDate',
|
||||
'DEL_FINISH_DATE' => 'delFinishDate'
|
||||
)
|
||||
);
|
||||
|
||||
$response = $this->replaceFields($data, $structure);
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /case/:app_uid/upload
|
||||
*
|
||||
* @param $access
|
||||
* @param $refresh
|
||||
* @return mixed
|
||||
*/
|
||||
public function uidUploadFiles($app_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$oMobile = new \ProcessMaker\BusinessModel\Light();
|
||||
$filesUids = $oMobile->postUidUploadFiles($userUid, $app_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
return $filesUids;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /case/:app_uid/upload/:app_doc_uid
|
||||
*
|
||||
* @param $access
|
||||
* @param $refresh
|
||||
* @return mixed
|
||||
*/
|
||||
public function documentUploadFiles($app_uid, $app_doc_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$oMobile = new \ProcessMaker\BusinessModel\Light();
|
||||
$response = $oMobile->documentUploadFiles($userUid, $app_uid, $app_doc_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /case/:app_uid/claim
|
||||
*
|
||||
* @param $app_uid
|
||||
* @return mixed
|
||||
*/
|
||||
public function claimCaseUser($app_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$oMobile = new \ProcessMaker\BusinessModel\Light();
|
||||
$response = $oMobile->claimCaseUser($userUid, $app_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,44 @@ class Activity extends Api
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
/**
|
||||
* @param string $pro_uid {@min 32} {@max 32}
|
||||
* @param string $tas_uid {@min 32} {@max 32}
|
||||
* @param string $filter {@choice definition,,properties}
|
||||
*
|
||||
* @author Gustavo Cruz <gustavo.cruz@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @return array
|
||||
*
|
||||
* @url GET /:pro_uid/activity/:tas_uid/feature-configuration
|
||||
*/
|
||||
public function doGetProjectActivityFeatureConfiguration($pro_uid, $tas_uid, $filter = '')
|
||||
{
|
||||
try {
|
||||
$configurations = array();
|
||||
/*** starts retrieval of action by emails configuration ***/
|
||||
if (\PMLicensedFeatures
|
||||
::getSingleton()
|
||||
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
|
||||
$params = array(
|
||||
'type' => 'activity',
|
||||
'form' => 'configuration',
|
||||
'PRO_UID' => $pro_uid,
|
||||
'TAS_UID' => $tas_uid
|
||||
);
|
||||
$actionsByEmailService = new \ProcessMaker\BusinessModel\ActionsByEmail();
|
||||
$configurations[] = $actionsByEmailService->loadConfiguration($params);
|
||||
}
|
||||
/*** end retrieval of action by emails configuration ***/
|
||||
return $configurations;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
/**
|
||||
* @param string $prj_uid {@min 32} {@max 32}
|
||||
* @param string $act_uid {@min 32} {@max 32}
|
||||
@@ -79,6 +116,15 @@ class Activity extends Api
|
||||
}
|
||||
$task = new \ProcessMaker\BusinessModel\Task();
|
||||
$properties = $task->updateProperties($prj_uid, $act_uid, $request_data);
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if (\PMLicensedFeatures
|
||||
::getSingleton()
|
||||
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
|
||||
$actionsByEmailService = new \ProcessMaker\BusinessModel\ActionsByEmail();
|
||||
$actionsByEmailService->saveConfiguration($request_data['properties']['_features']);
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class DynaForm extends Api
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @url POST /:prj_uid/dynaform
|
||||
*
|
||||
|
||||
@@ -29,5 +29,52 @@ class System extends Api
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count for all lists
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /counters-lists
|
||||
*/
|
||||
public function doGetCountersLists()
|
||||
{
|
||||
try {
|
||||
$userId = $this->getUserId();
|
||||
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $lists->getCounters($userId);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*
|
||||
* @author Gustavo Cruz <gustavo.cruz@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /enabled-features
|
||||
*/
|
||||
public function doGetEnabledFeatures()
|
||||
{
|
||||
try {
|
||||
$enabledFeatures = array();
|
||||
$keys = array ('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=');
|
||||
foreach ($keys as $key) {
|
||||
if (\PMLicensedFeatures
|
||||
::getSingleton()
|
||||
->verifyfeature($key)) {
|
||||
$enabledFeatures[] = $key;
|
||||
}
|
||||
}
|
||||
return $enabledFeatures;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class Server implements iAuthenticate
|
||||
}
|
||||
|
||||
// Pass a storage object or array of storage objects to the OAuth2 server class
|
||||
$this->server = new \OAuth2\Server($this->storage, array('allow_implicit' => true));
|
||||
$this->server = new \OAuth2\Server($this->storage, array('allow_implicit' => true, 'access_lifetime' => 86400));
|
||||
|
||||
$this->server->setConfig('enforce_state', false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user