HOR-4408
This commit is contained in:
@@ -2,10 +2,26 @@
|
||||
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use AbeConfiguration;
|
||||
use AbeConfigurationPeer;
|
||||
use AbeRequests;
|
||||
use AbeRequestsPeer;
|
||||
use AbeResponsesPeer;
|
||||
use ApplicationPeer;
|
||||
use AppDelegationPeer;
|
||||
use Criteria;
|
||||
use Exception;
|
||||
use G;
|
||||
use Publisher;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use PmDynaform;
|
||||
use PMLicensedFeatures;
|
||||
use ResultSet;
|
||||
use SpoolRun;
|
||||
use stdClass;
|
||||
use UsersPeer;
|
||||
use TaskPeer;
|
||||
|
||||
/**
|
||||
* Description of ActionsByEmailService
|
||||
@@ -16,14 +32,14 @@ class ActionsByEmail
|
||||
|
||||
public function saveConfiguration($params)
|
||||
{
|
||||
if (\PMLicensedFeatures
|
||||
if (PMLicensedFeatures
|
||||
::getSingleton()
|
||||
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
|
||||
$feature = $params['ActionsByEmail'];
|
||||
switch ($feature['type']) {
|
||||
case 'configuration':
|
||||
require_once 'classes/model/AbeConfiguration.php';
|
||||
$abeConfigurationInstance = new \AbeConfiguration();
|
||||
$abeConfigurationInstance = new AbeConfiguration();
|
||||
|
||||
if (isset($feature['fields']['ABE_CASE_NOTE_IN_RESPONSE'])) {
|
||||
$arrayAux = json_decode($feature['fields']['ABE_CASE_NOTE_IN_RESPONSE']);
|
||||
@@ -48,7 +64,7 @@ class ActionsByEmail
|
||||
public function loadConfiguration($params)
|
||||
{
|
||||
if ($params['type'] != 'activity'
|
||||
|| !\PMLicensedFeatures
|
||||
|| !PMLicensedFeatures
|
||||
::getSingleton()
|
||||
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0='))
|
||||
{
|
||||
@@ -56,11 +72,11 @@ class ActionsByEmail
|
||||
}
|
||||
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);
|
||||
$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()) {
|
||||
@@ -92,7 +108,7 @@ class ActionsByEmail
|
||||
}
|
||||
|
||||
if ($arrayData['TEMPLATE'] == '') {
|
||||
throw new Exception(\G::LoadTranslation('ID_TEMPLATE_PARAMETER_EMPTY'));
|
||||
throw new Exception(G::LoadTranslation('ID_TEMPLATE_PARAMETER_EMPTY'));
|
||||
}
|
||||
|
||||
$data = array(
|
||||
@@ -104,10 +120,10 @@ class ActionsByEmail
|
||||
|
||||
global $G_PUBLISH;
|
||||
|
||||
$G_PUBLISH = new \Publisher();
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'actionsByEmail/actionsByEmail_FileEdit', '', $data);
|
||||
|
||||
\G::RenderPage('publish', 'raw');
|
||||
G::RenderPage('publish', 'raw');
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -123,7 +139,7 @@ class ActionsByEmail
|
||||
}
|
||||
|
||||
if ($arrayData['TEMPLATE'] == '') {
|
||||
throw new Exception(\G::LoadTranslation('ID_TEMPLATE_PARAMETER_EMPTY'));
|
||||
throw new Exception(G::LoadTranslation('ID_TEMPLATE_PARAMETER_EMPTY'));
|
||||
}
|
||||
|
||||
$templateFile = fopen(PATH_DATA_MAILTEMPLATES . $arrayData['PRO_UID'] . PATH_SEP . $arrayData['TEMPLATE'], 'w');
|
||||
@@ -145,8 +161,9 @@ class ActionsByEmail
|
||||
$arrayData['PRO_UID'] = '';
|
||||
}
|
||||
|
||||
$response->emailFields = array();
|
||||
$response->actionFields = array();
|
||||
$response = new stdClass();
|
||||
$response->emailFields = [];
|
||||
$response->actionFields = [];
|
||||
|
||||
if ($arrayData['PRO_UID'] != '' && $arrayData['DYN_UID']) {
|
||||
$dynaform = new Form($arrayData['PRO_UID'] . PATH_SEP . $arrayData['DYN_UID'], PATH_DYNAFORM, SYS_LANG, false);
|
||||
@@ -212,30 +229,31 @@ class ActionsByEmail
|
||||
}
|
||||
|
||||
if ($arrayData['PRO_UID'] == '') {
|
||||
throw new Exception(\G::LoadTranslation('ID_PRO_UID_PARAMETER_IS_EMPTY'));
|
||||
throw new Exception(G::LoadTranslation('ID_PRO_UID_PARAMETER_IS_EMPTY'));
|
||||
}
|
||||
|
||||
if ($arrayData['TAS_UID'] == '') {
|
||||
throw new Exception(\G::LoadTranslation('ID_TAS_UID_PARAMETER_IS_EMPTY'));
|
||||
throw new Exception(G::LoadTranslation('ID_TAS_UID_PARAMETER_IS_EMPTY'));
|
||||
}
|
||||
|
||||
$abeConfigurationInstance = new \AbeConfiguration();
|
||||
$abeConfigurationInstance = new AbeConfiguration();
|
||||
|
||||
$response = new stdClass();
|
||||
if ($arrayData['ABE_TYPE'] != '') {
|
||||
if ($arrayData['DYN_UID'] == '') {
|
||||
throw new Exception(\G::LoadTranslation('ID_DYN_UID_PARAMETER_IS_EMPTY'));
|
||||
throw new Exception(G::LoadTranslation('ID_DYN_UID_PARAMETER_IS_EMPTY'));
|
||||
}
|
||||
|
||||
try {
|
||||
$response->ABE_UID = $abeConfigurationInstance->createOrUpdate($arrayData);
|
||||
} catch (\Exception $error) {
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
$abeConfigurationInstance->deleteByTasUid($arrayData['TAS_UID']);
|
||||
$response->ABE_UID = '';
|
||||
} catch (\Exception $error) {
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
@@ -246,51 +264,51 @@ class ActionsByEmail
|
||||
|
||||
public function loadActionByEmail(array $arrayData)
|
||||
{
|
||||
$criteria = new \Criteria();
|
||||
$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);
|
||||
$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 = 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(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(ApplicationPeer::APP_NUMBER);
|
||||
|
||||
$criteria->addSelectColumn(\AppDelegationPeer::DEL_PREVIOUS);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS);
|
||||
|
||||
$criteria->addJoin(\AbeConfigurationPeer::ABE_UID, \AbeRequestsPeer::ABE_UID);
|
||||
$criteria->addJoin(\ApplicationPeer::APP_UID, \AbeRequestsPeer::APP_UID);
|
||||
$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->addJoin(AppDelegationPeer::APP_UID, AbeRequestsPeer::APP_UID);
|
||||
$criteria->addJoin(AppDelegationPeer::DEL_INDEX, AbeRequestsPeer::DEL_INDEX);
|
||||
$criteria->addDescendingOrderByColumn(AbeRequestsPeer::ABE_REQ_DATE);
|
||||
$criteria->setLimit($arrayData['limit']);
|
||||
$criteria->setOffset($arrayData['start']);
|
||||
$result = \AbeConfigurationPeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$result = AbeConfigurationPeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$data = Array();
|
||||
$arrayPro = Array();
|
||||
$arrayTAS = Array();
|
||||
@@ -298,18 +316,18 @@ class ActionsByEmail
|
||||
|
||||
while ($result->next()) {
|
||||
$data[] = $result->getRow();
|
||||
$criteriaRes = new \Criteria();
|
||||
$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->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']);
|
||||
$criteriaRes->add(AbeResponsesPeer::ABE_REQ_UID, $data[$index]['ABE_REQ_UID']);
|
||||
|
||||
$resultRes = \AbeResponsesPeer::doSelectRS($criteriaRes);
|
||||
$resultRes->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$resultRes = AbeResponsesPeer::doSelectRS($criteriaRes);
|
||||
$resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$resultRes->next();
|
||||
$dataRes = Array();
|
||||
|
||||
@@ -327,17 +345,17 @@ class ActionsByEmail
|
||||
$data[$index]['ABE_RES_MESSAGE'] = '';
|
||||
}
|
||||
|
||||
$criteriaRes = new \Criteria();
|
||||
$criteriaRes = new Criteria();
|
||||
|
||||
$criteriaRes->addSelectColumn(\AppDelegationPeer::USR_UID);
|
||||
$criteriaRes->addSelectColumn(\UsersPeer::USR_FIRSTNAME);
|
||||
$criteriaRes->addSelectColumn(\UsersPeer::USR_LASTNAME);
|
||||
$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);
|
||||
$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()) {
|
||||
@@ -370,31 +388,31 @@ class ActionsByEmail
|
||||
$arrayData['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, $arrayData['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);
|
||||
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID);
|
||||
$criteria->addSelectColumn(TaskPeer::TAS_ID);
|
||||
$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->addSelectColumn(AppDelegationPeer::APP_NUMBER);
|
||||
$criteria->addJoin(AbeConfigurationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
|
||||
$criteria->addJoin(AbeConfigurationPeer::ABE_UID, AbeRequestsPeer::ABE_UID, Criteria::LEFT_JOIN);
|
||||
$conditions[] = [AbeRequestsPeer::APP_UID, AppDelegationPeer::APP_UID];
|
||||
$conditions[] = [AbeRequestsPeer::DEL_INDEX, AppDelegationPeer::DEL_INDEX];
|
||||
$criteria->addJoinMC($conditions, Criteria::LEFT_JOIN);
|
||||
$criteria->add(AbeRequestsPeer::ABE_REQ_UID, $arrayData['REQ_UID']);
|
||||
$resultRes = AbeRequestsPeer::doSelectRS($criteria);
|
||||
$resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$resultRes->next();
|
||||
$dataRes = Array();
|
||||
$dataRes = [];
|
||||
|
||||
if ($dataRes = $resultRes->getRow()) {
|
||||
if (is_null($dataRes['DEL_FINISH_DATE'])) {
|
||||
@@ -402,7 +420,7 @@ class ActionsByEmail
|
||||
$emailServer = new \ProcessMaker\BusinessModel\EmailServer();
|
||||
$criteria = $emailServer->getEmailServerCriteria();
|
||||
$rsCriteria = \EmailServerPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
@@ -414,7 +432,7 @@ class ActionsByEmail
|
||||
$spool = new SpoolRun();
|
||||
$spool->setConfig($aSetup);
|
||||
|
||||
$spool->create(array(
|
||||
$spool->create([
|
||||
'msg_uid' => '',
|
||||
'app_uid' => $dataRes['APP_UID'],
|
||||
'del_index' => $dataRes['DEL_INDEX'],
|
||||
@@ -427,29 +445,30 @@ class ActionsByEmail
|
||||
'app_msg_bcc' => '',
|
||||
'app_msg_attach' => '',
|
||||
'app_msg_template' => '',
|
||||
'app_msg_status' => 'pending'
|
||||
));
|
||||
'app_msg_status' => 'pending',
|
||||
"tas_id" => $dataRes['TAS_ID'],
|
||||
"app_number" => isset($dataRes['APP_NUMBER']) ? $dataRes['APP_NUMBER'] : ''
|
||||
]);
|
||||
|
||||
if ($spool->sendMail()) {
|
||||
$dataRes['ABE_REQ_STATUS'] = 'SENT';
|
||||
|
||||
$message = \G::LoadTranslation('ID_EMAIL_RESENT_TO') . ': '. $dataRes['ABE_REQ_SENT_TO'];
|
||||
$message = G::LoadTranslation('ID_EMAIL_RESENT_TO') . ': ' . $dataRes['ABE_REQ_SENT_TO'];
|
||||
} else {
|
||||
$dataRes['ABE_REQ_STATUS'] = 'ERROR';
|
||||
$message = \G::LoadTranslation('ID_THERE_PROBLEM_SENDING_EMAIL') . ': '. $dataRes['ABE_REQ_SENT_TO'] . ', ' . G::LoadTranslation('ID_PLEASE_TRY_LATER');
|
||||
$message = G::LoadTranslation('ID_THERE_PROBLEM_SENDING_EMAIL') . ': ' . $dataRes['ABE_REQ_SENT_TO'] . ', ' . G::LoadTranslation('ID_PLEASE_TRY_LATER');
|
||||
}
|
||||
|
||||
try {
|
||||
$abeRequestsInstance = new \AbeRequests();
|
||||
$abeRequestsInstance = new AbeRequests();
|
||||
$abeRequestsInstance->createOrUpdate($dataRes);
|
||||
} catch (\Exception $error) {
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
} else {
|
||||
$message = \G::LoadTranslation('ID_UNABLE_TO_SEND_EMAIL');
|
||||
$message = G::LoadTranslation('ID_UNABLE_TO_SEND_EMAIL');
|
||||
}
|
||||
} else {
|
||||
$message = \G::LoadTranslation('ID_UNEXPECTED_ERROR_OCCURRED_PLEASE');
|
||||
$message = G::LoadTranslation('ID_UNEXPECTED_ERROR_OCCURRED_PLEASE');
|
||||
}
|
||||
|
||||
//Return
|
||||
@@ -469,29 +488,29 @@ class ActionsByEmail
|
||||
$arrayData['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 = 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(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->addSelectColumn(AbeResponsesPeer::ABE_RES_UID);
|
||||
$criteria->addSelectColumn(AbeResponsesPeer::ABE_RES_DATA);
|
||||
|
||||
$criteria->add(\AbeRequestsPeer::ABE_REQ_UID, $arrayData['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);
|
||||
$criteria->add(AbeRequestsPeer::ABE_REQ_UID, $arrayData['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 = \G::LoadTranslation('ID_USER_NOT_RESPONDED_REQUEST');
|
||||
$message = G::LoadTranslation('ID_USER_NOT_RESPONDED_REQUEST');
|
||||
if ($dataRes = $resultRes->getRow()) {
|
||||
$_SESSION['CURRENT_DYN_UID'] = trim($dataRes['DYN_UID']);
|
||||
|
||||
@@ -572,12 +591,12 @@ class ActionsByEmail
|
||||
$configuration['CURRENT_DYNAFORM'] = trim($dataRes['DYN_UID']);
|
||||
$configuration['PRO_UID'] = trim($dataRes['PRO_UID']);
|
||||
|
||||
$criteriaD = new \Criteria();
|
||||
$criteriaD = new Criteria();
|
||||
$criteriaD->addSelectColumn(\DynaformPeer::DYN_CONTENT);
|
||||
$criteriaD->addSelectColumn(\DynaformPeer::PRO_UID);
|
||||
$criteriaD->add(\DynaformPeer::DYN_UID, trim($dataRes['DYN_UID']));
|
||||
$resultD = \DynaformPeer::doSelectRS($criteriaD);
|
||||
$resultD->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$resultD->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$resultD->next();
|
||||
$configuration = $resultD->getRow();
|
||||
|
||||
@@ -587,7 +606,7 @@ class ActionsByEmail
|
||||
if ($dataRes['ABE_RES_DATA'] !== '') {
|
||||
$value = unserialize($dataRes['ABE_RES_DATA']);
|
||||
$actionField = str_replace(array('@@','@#','@=','@%','@?','@$'), '', $dataRes['ABE_ACTION_FIELD']);
|
||||
$variables = \G::json_decode($configuration['DYN_CONTENT'], true);
|
||||
$variables = G::json_decode($configuration['DYN_CONTENT'], true);
|
||||
if (is_array($value)) {
|
||||
if(isset($variables['items'][0]['items'])) {
|
||||
$fields = $variables['items'][0]['items'];
|
||||
@@ -654,13 +673,13 @@ class ActionsByEmail
|
||||
);
|
||||
|
||||
//Verify login
|
||||
$criteria = new \Criteria('workflow');
|
||||
$criteria = new Criteria('workflow');
|
||||
|
||||
$criteria->add(\AbeConfigurationPeer::PRO_UID, $arrayAppDelegationData['PRO_UID'], \Criteria::EQUAL);
|
||||
$criteria->add(\AbeConfigurationPeer::TAS_UID, $arrayAppDelegationData['TAS_UID'], \Criteria::EQUAL);
|
||||
$criteria->add(AbeConfigurationPeer::PRO_UID, $arrayAppDelegationData['PRO_UID'], Criteria::EQUAL);
|
||||
$criteria->add(AbeConfigurationPeer::TAS_UID, $arrayAppDelegationData['TAS_UID'], Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \AbeConfigurationPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria = AbeConfigurationPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
$record = $rsCriteria->getRow();
|
||||
@@ -671,7 +690,7 @@ class ActionsByEmail
|
||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
/*----------------------------------********---------------------------------*/
|
||||
//SSO
|
||||
if (\PMLicensedFeatures::getSingleton()->verifyfeature('x4TTzlISnp2K2tnSTJoMC8rTDRMTjlhMCtZeXV0QnNCLzU=')) {
|
||||
if (PMLicensedFeatures::getSingleton()->verifyfeature('x4TTzlISnp2K2tnSTJoMC8rTDRMTjlhMCtZeXV0QnNCLzU=')) {
|
||||
|
||||
$sso = new \PmSsoClass();
|
||||
|
||||
@@ -716,7 +735,7 @@ class ActionsByEmail
|
||||
$flagLogin = true;
|
||||
} else {
|
||||
if ($_SESSION['USER_LOGGED'] != $arrayAppDelegationData['USR_UID']) {
|
||||
\G::SendTemporalMessage('ID_CASE_ASSIGNED_ANOTHER_USER', 'error', 'label');
|
||||
G::SendTemporalMessage('ID_CASE_ASSIGNED_ANOTHER_USER', 'error', 'label');
|
||||
|
||||
$flagLogin = true;
|
||||
}
|
||||
@@ -724,7 +743,7 @@ class ActionsByEmail
|
||||
|
||||
if ($flagLogin) {
|
||||
header(
|
||||
'Location: /sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN .
|
||||
'Location: /sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN .
|
||||
'/login/login?u=' . urlencode($_SERVER['REQUEST_URI'])
|
||||
);
|
||||
|
||||
@@ -732,7 +751,7 @@ class ActionsByEmail
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -802,8 +802,8 @@ class InputDocument
|
||||
break;
|
||||
}
|
||||
G::SendMessageText( $message, "ERROR" );
|
||||
$backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] );
|
||||
G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] );
|
||||
$backUrlObj = explode( "sys" . config("system.workspace"), $_SERVER['HTTP_REFERER'] );
|
||||
G::header( "location: " . "/sys" . config("system.workspace") . $backUrlObj[1] );
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -855,9 +855,9 @@ class InputDocument
|
||||
if ($msg != '') {
|
||||
if ($runningWorkflow) {
|
||||
G::SendMessageText($msg, 'ERROR');
|
||||
$backUrlObj = explode('sys' . SYS_SYS, $_SERVER['HTTP_REFERER']);
|
||||
$backUrlObj = explode('sys' . config("system.workspace"), $_SERVER['HTTP_REFERER']);
|
||||
|
||||
G::header('location: ' . '/sys' . SYS_SYS . $backUrlObj[1]);
|
||||
G::header('location: ' . '/sys' . config("system.workspace") . $backUrlObj[1]);
|
||||
exit(0);
|
||||
} else {
|
||||
throw new Exception($msg);
|
||||
@@ -1005,8 +1005,8 @@ class InputDocument
|
||||
}
|
||||
$message = $res->message;
|
||||
G::SendMessageText($message, "ERROR");
|
||||
$backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']);
|
||||
G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]);
|
||||
$backUrlObj = explode("sys" . config("system.workspace"), $_SERVER['HTTP_REFERER']);
|
||||
G::header("location: " . "/sys" . config("system.workspace") . $backUrlObj[1]);
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -1019,8 +1019,8 @@ class InputDocument
|
||||
if ($inpDocMaxFilesize > 0 && $fileSizeByField > 0) {
|
||||
if ($fileSizeByField > $inpDocMaxFilesize) {
|
||||
G::SendMessageText(G::LoadTranslation("ID_SIZE_VERY_LARGE_PERMITTED"), "ERROR");
|
||||
$arrayAux1 = explode("sys" . SYS_SYS, $_SERVER["HTTP_REFERER"]);
|
||||
G::header("location: /sys" . SYS_SYS . $arrayAux1[1]);
|
||||
$arrayAux1 = explode("sys" . config("system.workspace"), $_SERVER["HTTP_REFERER"]);
|
||||
G::header("location: /sys" . config("system.workspace") . $arrayAux1[1]);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
@@ -1035,8 +1035,8 @@ class InputDocument
|
||||
$message = G::LoadTranslation('THE_UPLOAD_OF_PHP_FILES_WAS_DISABLED');
|
||||
Bootstrap::registerMonologPhpUploadExecution('phpUpload', 550, $message, 'processmaker.log');
|
||||
G::SendMessageText($message, "ERROR");
|
||||
$backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']);
|
||||
G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]);
|
||||
$backUrlObj = explode("sys" . config("system.workspace"), $_SERVER['HTTP_REFERER']);
|
||||
G::header("location: " . "/sys" . config("system.workspace") . $backUrlObj[1]);
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -1140,4 +1140,40 @@ class InputDocument
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function get all the supervisor's documents
|
||||
* When the DEL_INDEX = 100000
|
||||
*
|
||||
* @param string $appUid, uid related to the case
|
||||
* @param array $docType, can be INPUT, ATTACHED, OUTPUT
|
||||
* @param array $docStatus, can be ACTIVE, DELETED
|
||||
*
|
||||
* @return array $documents
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getSupervisorDocuments($appUid, $docType = ['INPUT'], $docStatus = ['ACTIVE'])
|
||||
{
|
||||
try {
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(AppDocumentPeer::APP_UID, $appUid);
|
||||
$criteria->add(AppDocumentPeer::APP_DOC_TYPE, $docType, Criteria::IN);
|
||||
$criteria->add(AppDocumentPeer::APP_DOC_STATUS, $docStatus, Criteria::IN);
|
||||
$criteria->add(AppDocumentPeer::DEL_INDEX, 100000);
|
||||
$criteria->addJoin(AppDocumentPeer::APP_UID, ApplicationPeer::APP_UID, Criteria::LEFT_JOIN);
|
||||
$dataset = AppDocumentPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
$documents = [];
|
||||
while ($row = $dataset->getRow()) {
|
||||
$documents[] = $row;
|
||||
$dataset->next();
|
||||
}
|
||||
|
||||
return $documents;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ class Consolidated
|
||||
$className = $tableName;
|
||||
|
||||
if (!class_exists($className)) {
|
||||
require_once(PATH_DB . SYS_SYS . PATH_SEP . "classes" . PATH_SEP . $className . ".php");
|
||||
require_once(PATH_DB . config("system.workspace") . PATH_SEP . "classes" . PATH_SEP . $className . ".php");
|
||||
}
|
||||
|
||||
$oCriteria = new Criteria("workflow");
|
||||
@@ -1056,7 +1056,7 @@ class Consolidated
|
||||
}
|
||||
}
|
||||
|
||||
@unlink(PATH_C . "ws" . PATH_SEP . SYS_SYS . PATH_SEP . "xmlform" . PATH_SEP . $pro_uid . PATH_SEP . $dyn_uid . "." . SYS_LANG);
|
||||
@unlink(PATH_C . "ws" . PATH_SEP . config("system.workspace") . PATH_SEP . "xmlform" . PATH_SEP . $pro_uid . PATH_SEP . $dyn_uid . "." . SYS_LANG);
|
||||
|
||||
|
||||
$array ['columnModel'] = $caseColumns;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use G;
|
||||
|
||||
class EmailEvent
|
||||
{
|
||||
/*private $arrayFieldDefinition = array(
|
||||
@@ -277,7 +279,7 @@ class EmailEvent
|
||||
try {
|
||||
//Verify data
|
||||
if (!$this->existsEvent($prj_uid, $evn_uid)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_EMAIL_EVENT_DEFINITION_DOES_NOT_EXIST"));
|
||||
throw new \Exception(G::LoadTranslation("ID_EMAIL_EVENT_DEFINITION_DOES_NOT_EXIST"));
|
||||
}
|
||||
$arrayData = $this->existsEvent($prj_uid, $evn_uid);
|
||||
$this->delete($prj_uid, $arrayData[0]);
|
||||
@@ -387,7 +389,7 @@ class EmailEvent
|
||||
public function verifyIfEmailEventExists($emailEventUid)
|
||||
{
|
||||
if (!$this->exists($emailEventUid)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_EMAIL_EVENT_DEFINITION_DOES_NOT_EXIST", array("Email Event Uid", $emailEventUid)));
|
||||
throw new \Exception(G::LoadTranslation("ID_EMAIL_EVENT_DEFINITION_DOES_NOT_EXIST", array("Email Event Uid", $emailEventUid)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,7 +432,7 @@ class EmailEvent
|
||||
public function sendEmail($appUID, $prj_uid, $eventUid, $arrayApplicationData)
|
||||
{
|
||||
if (!$this->existsEvent($prj_uid, $eventUid)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_EMAIL_EVENT_DEFINITION_DOES_NOT_EXIST"));
|
||||
throw new \Exception(G::LoadTranslation("ID_EMAIL_EVENT_DEFINITION_DOES_NOT_EXIST"));
|
||||
}
|
||||
$arrayData = $this->existsEvent($prj_uid, $eventUid);
|
||||
if (sizeof($arrayData)) {
|
||||
@@ -471,11 +473,11 @@ class EmailEvent
|
||||
}
|
||||
if (!empty($emailTo)) {
|
||||
$subject = $arrayData[5];
|
||||
$subject = \G::replaceDataField($arrayData[5], $arrayApplicationData['APP_DATA']);
|
||||
\PMFSendMessage($appUID, $configEmailData['MESS_ACCOUNT'], $emailTo, '', '', $subject,
|
||||
$subject = G::replaceDataField($arrayData[5], $arrayApplicationData['APP_DATA']);
|
||||
PMFSendMessage($appUID, G::buildFrom($configEmailData), $emailTo, '', '', $subject,
|
||||
$contentFile['prf_filename'], array(), array(), true, 0, $configEmailData);
|
||||
} else {
|
||||
\Bootstrap::registerMonolog('EmailEventMailError', 200, \G::LoadTranslation('ID_EMAIL_EVENT_CONFIGURATION_EMAIL', array($eventUid, $prj_uid)), ['eventUid' => $eventUid, 'prj_uid' => $prj_uid], SYS_SYS, 'processmaker.log');
|
||||
\Bootstrap::registerMonolog('EmailEventMailError', 200, G::LoadTranslation('ID_EMAIL_EVENT_CONFIGURATION_EMAIL', array($eventUid, $prj_uid)), ['eventUid' => $eventUid, 'prj_uid' => $prj_uid], config("system.workspace"), 'processmaker.log');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class EmailServer
|
||||
$currentUser = $RBAC->aUserInfo['USER_INFO'];
|
||||
$info = array(
|
||||
'ip' => G::getIpAddress(),
|
||||
'workspace' => (defined("SYS_SYS")) ? SYS_SYS : "Workspace undefined",
|
||||
'workspace' => (!empty(config("system.workspace"))) ? config("system.workspace") : "Undefined Workspace",
|
||||
'usrUid' => $currentUser['USR_UID']
|
||||
);
|
||||
$this->setContextLog($info);
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use \G;
|
||||
use Criteria;
|
||||
use ProcessFilesPeer;
|
||||
use ProcessPeer;
|
||||
use TaskPeer;
|
||||
|
||||
class FilesManager
|
||||
{
|
||||
@@ -397,26 +401,27 @@ class FilesManager
|
||||
*
|
||||
* @param string $path
|
||||
* @param string $fileName the name of template
|
||||
* @throws Exception
|
||||
*
|
||||
* return array
|
||||
* @return array
|
||||
*/
|
||||
public function getFileManagerUid($path, $fileName = '')
|
||||
{
|
||||
try {
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
$path = str_replace("/", DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR, $path);
|
||||
$path = str_replace("/", DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, $path);
|
||||
}
|
||||
$path = explode(DIRECTORY_SEPARATOR,$path);
|
||||
$baseName = $path[count($path)-2]."\\\\".$path[count($path)-1];
|
||||
$baseName2 = $path[count($path)-2]."/".$path[count($path)-1];
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria->addSelectColumn(\ProcessFilesPeer::PRF_UID);
|
||||
$criteria->addSelectColumn(\ProcessPeer::PRO_DERIVATION_SCREEN_TPL);
|
||||
$criteria->addSelectColumn(\TaskPeer::TAS_DERIVATION_SCREEN_TPL);
|
||||
$criteria->addJoin(\ProcessFilesPeer::PRO_UID, \ProcessPeer::PRO_UID);
|
||||
$criteria->addJoin(\ProcessPeer::PRO_UID, \TaskPeer::PRO_UID);
|
||||
$criteria->add( $criteria->getNewCriterion( \ProcessFilesPeer::PRF_PATH, '%' . $baseName . '%', \Criteria::LIKE )->addOr( $criteria->getNewCriterion( \ProcessFilesPeer::PRF_PATH, '%' . $baseName2 . '%', \Criteria::LIKE )));
|
||||
$rsCriteria = \ProcessFilesPeer::doSelectRS($criteria);
|
||||
$path = explode(DIRECTORY_SEPARATOR, $path);
|
||||
$baseName = $path[count($path) - 2] . "\\\\" . $path[count($path) - 1];
|
||||
$baseName2 = $path[count($path) - 2] . "/" . $path[count($path) - 1];
|
||||
$criteria = new Criteria("workflow");
|
||||
$criteria->addSelectColumn(ProcessFilesPeer::PRF_UID);
|
||||
$criteria->addSelectColumn(ProcessPeer::PRO_DERIVATION_SCREEN_TPL);
|
||||
$criteria->addSelectColumn(TaskPeer::TAS_DERIVATION_SCREEN_TPL);
|
||||
$criteria->addJoin(ProcessFilesPeer::PRO_UID, ProcessPeer::PRO_UID);
|
||||
$criteria->addJoin(ProcessPeer::PRO_UID, TaskPeer::PRO_UID, Criteria::LEFT_JOIN);
|
||||
$criteria->add($criteria->getNewCriterion(ProcessFilesPeer::PRF_PATH, '%' . $baseName . '%', Criteria::LIKE)->addOr($criteria->getNewCriterion(ProcessFilesPeer::PRF_PATH, '%' . $baseName2 . '%', Criteria::LIKE)));
|
||||
$rsCriteria = ProcessFilesPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$row = array();
|
||||
while ($rsCriteria->next()) {
|
||||
@@ -430,7 +435,7 @@ class FilesManager
|
||||
}
|
||||
}
|
||||
return $row;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ class Light
|
||||
|
||||
//Log
|
||||
Bootstrap::registerMonolog('MobileCreateCase', 200, "Create case",
|
||||
['application_uid' => $aData['APPLICATION'], 'usr_uid' => $userId], SYS_SYS, 'processmaker.log');
|
||||
['application_uid' => $aData['APPLICATION'], 'usr_uid' => $userId], config("system.workspace"), 'processmaker.log');
|
||||
} catch (Exception $e) {
|
||||
$response['status'] = 'failure';
|
||||
$response['message'] = $e->getMessage();
|
||||
@@ -399,7 +399,7 @@ class Light
|
||||
$_SESSION["PROCESS"] = $prj_uid;
|
||||
$_SESSION["TASK"] = $act_uid;
|
||||
$_SESSION["USER_LOGGED"] = $usr_uid;
|
||||
$_SESSION["USR_USERNAME"] = $userData['firstName'];
|
||||
$_SESSION["USR_USERNAME"] = $userData['userName'];
|
||||
$_SESSION["INDEX"] = $Fields["DEL_INDEX"] = $del_index !== null ? $del_index : \AppDelegation::getCurrentIndex($cas_uid);
|
||||
$Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], G::getSystemConstants());
|
||||
$triggers = $oCase->loadTriggers($act_uid, 'DYNAFORM', $step_uid_obj, strtoupper($type));
|
||||
@@ -574,7 +574,7 @@ class Light
|
||||
|
||||
//Log
|
||||
Bootstrap::registerMonolog('MobileRouteCase', 200, 'Route case',
|
||||
['application_uid' => $applicationUid, 'usr_uid' => $userUid], SYS_SYS, 'processmaker.log');
|
||||
['application_uid' => $applicationUid, 'usr_uid' => $userUid], config("system.workspace"), 'processmaker.log');
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
@@ -807,7 +807,7 @@ class Light
|
||||
session_start();
|
||||
session_regenerate_id();
|
||||
|
||||
setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . SYS_SYS, null, false, true);
|
||||
setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . config("system.workspace"), null, false, true);
|
||||
|
||||
if (strlen($msg) > 0) {
|
||||
$_SESSION['G_MESSAGE'] = $msg;
|
||||
@@ -1236,7 +1236,7 @@ class Light
|
||||
public function getUsersToReassign($usr_uid, $task_uid)
|
||||
{
|
||||
|
||||
$memcache = PMmemcached::getSingleton(SYS_SYS);
|
||||
$memcache = PMmemcached::getSingleton(config("system.workspace"));
|
||||
$RBAC = RBAC::getSingleton(PATH_DATA, session_id());
|
||||
$RBAC->sSystem = 'PROCESSMAKER';
|
||||
$RBAC->initRBAC();
|
||||
@@ -1323,7 +1323,7 @@ class Light
|
||||
*/
|
||||
public function getConfiguration($params)
|
||||
{
|
||||
$sysConf = Bootstrap::getSystemConfiguration('', '', SYS_SYS);
|
||||
$sysConf = Bootstrap::getSystemConfiguration('', '', config("system.workspace"));
|
||||
$multiTimeZone = false;
|
||||
//Set Time Zone
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
@@ -12,7 +12,7 @@ class NotificationDevice
|
||||
|
||||
public function checkMobileNotifications()
|
||||
{
|
||||
$conf = System::getSystemConfiguration('', '', SYS_SYS);
|
||||
$conf = System::getSystemConfiguration('', '', config("system.workspace"));
|
||||
$activeNotifications = true;
|
||||
if (isset($conf['mobileNotifications'])) {
|
||||
$activeNotifications = $conf['mobileNotifications'] == 1 ? true : false;
|
||||
|
||||
@@ -371,7 +371,7 @@ class MessageApplication
|
||||
$ws = new \WsBase();
|
||||
$case = new \Cases();
|
||||
$common = new \ProcessMaker\Util\Common();
|
||||
$sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined";
|
||||
$sysSys = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined";
|
||||
|
||||
$common->setFrontEnd($frontEnd);
|
||||
|
||||
@@ -683,7 +683,7 @@ class MessageApplication
|
||||
)
|
||||
{
|
||||
try {
|
||||
\Bootstrap::registerMonolog('MessageEventCron', $level, $message, $aContext, SYS_SYS, 'processmaker.log');
|
||||
\Bootstrap::registerMonolog('MessageEventCron', $level, $message, $aContext, config("system.workspace"), 'processmaker.log');
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class FileHandler
|
||||
{
|
||||
$workflowFile = array();
|
||||
$workspaceTargetDir = ($target === 'PUBLIC') ? 'public' : 'mailTemplates';
|
||||
$workspaceDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP;
|
||||
$workspaceDir = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP;
|
||||
|
||||
$templatesDir = $workspaceDir . $workspaceTargetDir . PATH_SEP . $prj_uid;
|
||||
$templatesFiles = Util\Common::rglob("$templatesDir/*", 0, true);
|
||||
|
||||
@@ -44,7 +44,7 @@ class FilesMigrator implements Importable, Exportable
|
||||
}
|
||||
$aPath = $data['PATH'];
|
||||
foreach ($aPath as $target => $files) {
|
||||
$basePath = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP;
|
||||
$basePath = PATH_DATA . 'sites' . PATH_SEP . config("system.workspace") . PATH_SEP . 'public' . PATH_SEP;
|
||||
if (strtoupper($target) === 'PUBLIC') {
|
||||
foreach ($files as $file) {
|
||||
$filename = $basePath . ((isset($file["file_path"])) ? $file["file_path"] : $file["filepath"]);
|
||||
|
||||
@@ -65,7 +65,7 @@ class GranularExporter
|
||||
$projectData = $bpmnProject->getProject();
|
||||
$this->prjName = $projectData['PRJ_NAME'];
|
||||
$getProjectName = $this->publisher->truncateName($projectData['PRJ_NAME'], false);
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx2") + 1;
|
||||
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx2");
|
||||
|
||||
@@ -143,7 +143,7 @@ class GranularExporter
|
||||
"export_server_os" => PHP_OS ,
|
||||
"export_server_php_version" => PHP_VERSION_ID,
|
||||
);
|
||||
$data["metadata"]["workspace"] = defined("SYS_SYS") ? SYS_SYS : "Unknown";
|
||||
$data["metadata"]["workspace"] = !empty(config("system.workspace")) ? config("system.workspace") : "Unknown";
|
||||
$data["metadata"]["name"] = $projectData['PRJ_NAME'];
|
||||
$data["metadata"]["uid"] = $projectData['PRJ_UID'];
|
||||
$data["metadata"]["export_version"] = $version;
|
||||
|
||||
@@ -44,7 +44,7 @@ class TemplatesMigrator implements Importable, Exportable
|
||||
}
|
||||
$aPath = $data['PATH'];
|
||||
foreach ($aPath as $target => $files) {
|
||||
$basePath = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'mailTemplates' . PATH_SEP;
|
||||
$basePath = PATH_DATA . 'sites' . PATH_SEP . config("system.workspace") . PATH_SEP . 'mailTemplates' . PATH_SEP;
|
||||
if (strtoupper($target) === 'TEMPLATE') {
|
||||
foreach ($files as $file) {
|
||||
$filename = $basePath . ((isset($file["file_path"])) ? $file["file_path"] : $file["filepath"]);
|
||||
|
||||
@@ -4,6 +4,8 @@ namespace ProcessMaker\BusinessModel;
|
||||
use G;
|
||||
use Criteria;
|
||||
use DynaformHandler;
|
||||
use ProcessPeer;
|
||||
use ResultSet;
|
||||
|
||||
class Process
|
||||
{
|
||||
@@ -964,7 +966,7 @@ class Process
|
||||
|
||||
$process = new \Process();
|
||||
|
||||
$memcache = &\PMmemcached::getSingleton(SYS_SYS);
|
||||
$memcache = &\PMmemcached::getSingleton(config("system.workspace"));
|
||||
|
||||
$memkey = "no memcache";
|
||||
$memcacheUsed = "not used";
|
||||
@@ -1775,8 +1777,8 @@ class Process
|
||||
$aInvalidTypes = array("title", "subtitle", "file", "button", "reset", "submit", "javascript");
|
||||
$aMultipleSelectionFields = array("listbox", "checkgroup", "grid");
|
||||
|
||||
if (is_file( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) {
|
||||
$dyn = new DynaformHandler( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' );
|
||||
if (is_file( PATH_DATA . '/sites/'. config("system.workspace") .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. config("system.workspace") .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) {
|
||||
$dyn = new DynaformHandler( PATH_DATA . '/sites/'. config("system.workspace") .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' );
|
||||
$dynaformFields[] = $dyn->getFields();
|
||||
|
||||
$fields = $dyn->getFields();
|
||||
@@ -1837,4 +1839,43 @@ class Process
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* We will get the process list
|
||||
* will be return the "PRO_ID" value for the processes, otherwise, return the "PRO_UID" value
|
||||
*
|
||||
* @param string $search
|
||||
* @param boolean $useProId, we can define if we use the PRO ID instead of PRO_UID
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getProcessList($search = '', $useProId = false)
|
||||
{
|
||||
$processes = [];
|
||||
$processes[] = ["", G::LoadTranslation("ID_ALL_PROCESS")];
|
||||
|
||||
$process = new Criteria("workflow");
|
||||
$process->clearSelectColumns();
|
||||
$process->addSelectColumn(ProcessPeer::PRO_ID);
|
||||
$process->addSelectColumn(ProcessPeer::PRO_UID);
|
||||
$process->addSelectColumn(ProcessPeer::PRO_TITLE);
|
||||
$process->add(ProcessPeer::PRO_STATUS, "ACTIVE");
|
||||
if (!empty($search)) {
|
||||
$process->add(ProcessPeer::PRO_TITLE, "%$search%", Criteria::LIKE);
|
||||
}
|
||||
$dataset = ProcessPeer::doSelectRS($process);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
while ($row = $dataset->getRow()) {
|
||||
if ($useProId) {
|
||||
$processes[] = [$row["PRO_ID"], $row["PRO_TITLE"]];
|
||||
} else {
|
||||
$processes[] = [$row['PRO_UID'], $row['PRO_TITLE']];
|
||||
}
|
||||
|
||||
$dataset->next();
|
||||
}
|
||||
|
||||
return $processes;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ use Behat\Behat\Exception\Exception;
|
||||
use \G;
|
||||
use \Criteria;
|
||||
use \ObjectPermissionPeer;
|
||||
use \Exception as StandardException;
|
||||
|
||||
/**
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
@@ -224,6 +225,9 @@ class ProcessPermissions
|
||||
if ($opUid != '') {
|
||||
$opUid = $this->validateOpUid($opUid);
|
||||
}
|
||||
if (empty($data['USR_UID']) || (isset($data['USR_UID']) && $data['USR_UID'] === "null")) {
|
||||
throw (new StandardException(G::LoadTranslation("ID_SELECT_USER_OR_GROUP")));
|
||||
}
|
||||
if ($data['OP_USER_RELATION'] == "1") {
|
||||
$this->validateUsrUid($data['USR_UID']);
|
||||
} else {
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use \G;
|
||||
use Criteria;
|
||||
use DynaformPeer;
|
||||
use Exception;
|
||||
use G;
|
||||
use GroupUserPeer;
|
||||
use ProcessUserPeer;
|
||||
use ResultSet;
|
||||
use StepSupervisorPeer;
|
||||
|
||||
class ProcessSupervisor
|
||||
{
|
||||
@@ -1526,4 +1533,40 @@ class ProcessSupervisor
|
||||
|
||||
return $canEdit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the objects supervisor
|
||||
*
|
||||
* @param string $proUid
|
||||
* @param array $typeObject, can be DYNAFORM or INPUT_DOCUMENT
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function getObjectSupervisor($proUid, $typeObject = [])
|
||||
{
|
||||
try {
|
||||
$result = [];
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->addSelectColumn(StepSupervisorPeer::STEP_UID);
|
||||
$criteria->addSelectColumn(StepSupervisorPeer::PRO_UID);
|
||||
$criteria->addSelectColumn(StepSupervisorPeer::STEP_TYPE_OBJ);
|
||||
$criteria->addSelectColumn(StepSupervisorPeer::STEP_UID_OBJ);
|
||||
$criteria->addSelectColumn(StepSupervisorPeer::STEP_POSITION);
|
||||
$criteria->add(StepSupervisorPeer::PRO_UID, $proUid);
|
||||
if (!empty($typeObject)) {
|
||||
$criteria->add(StepSupervisorPeer::STEP_TYPE_OBJ, $typeObject, Criteria::IN);
|
||||
}
|
||||
$dataset = StepSupervisorPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
while ($row = $dataset->getRow()) {
|
||||
$result[] = $row['STEP_UID_OBJ'];
|
||||
$dataset->next();
|
||||
}
|
||||
return $result;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ class ProjectUser
|
||||
} else {
|
||||
$http = 'http://';
|
||||
}
|
||||
$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2';
|
||||
$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2';
|
||||
@$client = new \SoapClient( $endpoint );
|
||||
$user = $sWS_USER;
|
||||
$pass = $sWS_PASS;
|
||||
@@ -325,7 +325,7 @@ class ProjectUser
|
||||
try {
|
||||
$http = (\G::is_https())? "https://" : "http://";
|
||||
|
||||
$client = new \SoapClient($http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/wsdl2");
|
||||
$client = new \SoapClient($http . $_SERVER["HTTP_HOST"] . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/wsdl2");
|
||||
|
||||
$params = array(
|
||||
"userid" => $username,
|
||||
|
||||
@@ -99,7 +99,7 @@ class Skins
|
||||
|
||||
$xmlConfiguration = file_get_contents($configFileOriginal);
|
||||
|
||||
$workspace = ($skinWorkspace == 'global') ? '' : SYS_SYS;
|
||||
$workspace = ($skinWorkspace == 'global') ? '' : config("system.workspace");
|
||||
|
||||
$xmlConfigurationObj = G::xmlParser($xmlConfiguration);
|
||||
$skinInformationArray = $xmlConfigurationObj->result["skinConfiguration"]["__CONTENT__"]["information"]["__CONTENT__"];
|
||||
|
||||
@@ -592,7 +592,7 @@ class Table
|
||||
}
|
||||
$className = $table['ADD_TAB_CLASS_NAME'];
|
||||
$classPeerName = $className . 'Peer';
|
||||
$sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
|
||||
$sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP;
|
||||
if (! file_exists( $sPath . $className . '.php' )) {
|
||||
throw new \Exception( 'Update:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $className ) );
|
||||
}
|
||||
@@ -684,7 +684,7 @@ class Table
|
||||
}
|
||||
$className = $table['ADD_TAB_CLASS_NAME'];
|
||||
$classPeerName = $className . 'Peer';
|
||||
$sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
|
||||
$sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP;
|
||||
if (! file_exists( $sPath . $className . '.php' )) {
|
||||
throw new \Exception( 'Update:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $className ) );
|
||||
}
|
||||
|
||||
@@ -1151,7 +1151,7 @@ class TimerEvent
|
||||
private function log($action, $value = "", $status = "action")
|
||||
{
|
||||
try {
|
||||
$workspace = (defined("SYS_SYS"))? SYS_SYS : "Wokspace Undefined";
|
||||
$workspace = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined Workspace";
|
||||
$ipClient = \G::getIpAddress();
|
||||
|
||||
$actionTimer = "timereventcron: ";
|
||||
@@ -1192,7 +1192,7 @@ class TimerEvent
|
||||
)
|
||||
{
|
||||
try {
|
||||
\Bootstrap::registerMonolog('TimerEventCron', $level, $message, $aContext, SYS_SYS, 'processmaker.log');
|
||||
\Bootstrap::registerMonolog('TimerEventCron', $level, $message, $aContext, config("system.workspace"), 'processmaker.log');
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
@@ -1214,7 +1214,7 @@ class TimerEvent
|
||||
$ws = new \WsBase();
|
||||
$case = new \Cases();
|
||||
$common = new \ProcessMaker\Util\Common();
|
||||
$sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined";
|
||||
$sysSys = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined";
|
||||
|
||||
$common->setFrontEnd($frontEnd);
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ class Trigger
|
||||
) {
|
||||
//Check disabled code
|
||||
|
||||
$cs = new \CodeScanner(SYS_SYS);
|
||||
$cs = new \CodeScanner(config("system.workspace"));
|
||||
|
||||
$arrayFoundDisabledCode = $cs->checkDisabledCode("SOURCE", $dataTrigger["TRI_WEBBOT"]);
|
||||
|
||||
|
||||
@@ -22,9 +22,11 @@ use IsoLocationPeer;
|
||||
use IsoSubdivisionPeer;
|
||||
use ListParticipatedLast;
|
||||
use PMmemcached;
|
||||
use ProcessMaker\BusinessModel\ProcessSupervisor as BmProcessSupervisor;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use ProcessMaker\Util\DateTime;
|
||||
use ProcessMaker\Util\System;
|
||||
use ProcessUser;
|
||||
use Propel;
|
||||
use RBAC;
|
||||
use RbacUsers;
|
||||
@@ -735,7 +737,7 @@ class User
|
||||
$aUserProperty = $userProperty->loadOrCreateIfNotExists($userUid, array("USR_PASSWORD_HISTORY" => serialize(array(Bootstrap::hashPassword($arrayData["USR_PASSWORD"])))));
|
||||
|
||||
$memKey = "rbacSession" . session_id();
|
||||
$memcache = &PMmemcached::getSingleton(defined("SYS_SYS") ? SYS_SYS : "");
|
||||
$memcache = &PMmemcached::getSingleton(!empty(config("system.workspace")) ? config("system.workspace") : "");
|
||||
|
||||
if (($rbac->aUserInfo = $memcache->get($memKey)) == false) {
|
||||
$rbac->loadUserRolePermission("PROCESSMAKER", $userUidLogged);
|
||||
@@ -1713,4 +1715,53 @@ class User
|
||||
|
||||
return $dataUsers;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function get the list of process that the user can reassign
|
||||
* If the user has the permission PM_REASSIGNCASE can reassign any process
|
||||
* If the user has the permission PM_REASSIGNCASE_SUPERVISOR can reassign only their processes
|
||||
*
|
||||
* @param array $listPermissions
|
||||
*
|
||||
* @return mixed array|null where:
|
||||
* Array empty if he can reassign any process
|
||||
* List of processes that he can reassign
|
||||
* Will be return null if can not reassign
|
||||
*/
|
||||
public function getProcessToReassign($listPermissions = [])
|
||||
{
|
||||
global $RBAC;
|
||||
$processes = [];
|
||||
if (in_array('PM_REASSIGNCASE', $listPermissions) && $RBAC->userCanAccess('PM_REASSIGNCASE') === 1){
|
||||
//The user can reassign any process
|
||||
return $processes;
|
||||
} elseif (in_array('PM_REASSIGNCASE_SUPERVISOR', $listPermissions) && $RBAC->userCanAccess('PM_REASSIGNCASE_SUPERVISOR') === 1){
|
||||
$userLogged = $RBAC->aUserInfo['USER_INFO']['USR_UID'];
|
||||
$processUser = new ProcessUser();
|
||||
$processes = $processUser->getProUidSupervisor($userLogged);
|
||||
//The user can reassign only their processes
|
||||
return $processes;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function review if the user can reassign cases
|
||||
*
|
||||
* @param string $usrUid
|
||||
* @param string $proUid
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function userCanReassign($usrUid, $proUid)
|
||||
{
|
||||
if ($this->checkPermission($usrUid, 'PM_REASSIGNCASE')) {
|
||||
return true;
|
||||
} elseif ($this->checkPermission($usrUid, 'PM_REASSIGNCASE_SUPERVISOR')) {
|
||||
$processSupervisor = new BmProcessSupervisor();
|
||||
$isSupervisor = $processSupervisor->isUserProcessSupervisor($proUid, $usrUid);
|
||||
return $isSupervisor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ use G;
|
||||
use Exception;
|
||||
use AdditionalTables;
|
||||
use PmDynaform;
|
||||
use ProcessMaker\BusinessModel\Cases;
|
||||
|
||||
class Variable
|
||||
{
|
||||
@@ -773,11 +774,14 @@ class Variable
|
||||
unset($params["limit"]);
|
||||
|
||||
//Get appData and system variables
|
||||
$paramsWithoutAppData = $params;
|
||||
$globalVariables = [];
|
||||
if ($appUid !== null) {
|
||||
$case = new \Cases();
|
||||
$fields = $case->loadCase($appUid, $delIndex);
|
||||
$appData = $fields["APP_DATA"];
|
||||
$appData = array_merge($appData, \ProcessMaker\BusinessModel\Cases::getGlobalVariables($appData));
|
||||
$globalVariables = Cases::getGlobalVariables($appData);
|
||||
$appData = array_merge($appData, $globalVariables);
|
||||
$params = array_merge($appData, $params);
|
||||
}
|
||||
|
||||
@@ -795,6 +799,14 @@ class Variable
|
||||
$field->queryFilter = $filter;
|
||||
$field->queryStart = $start;
|
||||
$field->queryLimit = $limit;
|
||||
//Grids only access the global variables of 'ProcessMaker', other variables are removed.
|
||||
//The property 'columnWidth' is only present in the controls of a grid,
|
||||
//in the current change there is no specific property that indicates
|
||||
//if the control is in the grid.
|
||||
if (isset($field->columnWidth)) {
|
||||
$pmDynaform->fields["APP_DATA"] = $globalVariables;
|
||||
$field->queryInputData = $paramsWithoutAppData;
|
||||
}
|
||||
|
||||
//Populate control data
|
||||
$pmDynaform->jsonr($field);
|
||||
|
||||
@@ -43,7 +43,7 @@ class WebEntry
|
||||
{
|
||||
$this->pathDataPublic = defined("PATH_DATA_PUBLIC") ? PATH_DATA_PUBLIC : \G::$pathDataPublic;
|
||||
$this->httpHost = isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : \G::$httpHost;
|
||||
$this->sysSys = defined("SYS_SYS") ? SYS_SYS : \G::$sysSys;
|
||||
$this->sysSys = !empty(config("system.workspace")) ? config("system.workspace") : \G::$sysSys;
|
||||
$this->sysSkin = defined("SYS_SKIN") ? SYS_SKIN : \G::$sysSkin;
|
||||
try {
|
||||
foreach ($this->arrayFieldDefinition as $key => $value) {
|
||||
@@ -851,7 +851,7 @@ class WebEntry
|
||||
try {
|
||||
if ((!isset($record['WE_LINK_GENERATION']) || $record['WE_LINK_GENERATION']==='DEFAULT') && $record["WE_METHOD"] == "WS") {
|
||||
$http = (\G::is_https())? "https://" : "http://";
|
||||
$url = $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $record["PRO_UID"];
|
||||
$url = $http . $_SERVER["HTTP_HOST"] . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $record["PRO_UID"];
|
||||
|
||||
$record["WE_DATA"] = $url . "/" . $record["WE_DATA"];
|
||||
}
|
||||
|
||||
@@ -1381,13 +1381,13 @@ class WebEntryEvent
|
||||
strpos($domain, 'https://') === 0;
|
||||
$url = ($hasProtocol ? '' : $http) .
|
||||
$domain .
|
||||
"/sys" . SYS_SYS . "/" .
|
||||
"/sys" . config("system.workspace") . "/" .
|
||||
$weLinkLanguage . "/" .
|
||||
$weLinkSkin . "/" . $prj_uid;
|
||||
|
||||
return $url . "/" . $weData;
|
||||
} else {
|
||||
$url = $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $prj_uid;
|
||||
$url = $http . $_SERVER["HTTP_HOST"] . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $prj_uid;
|
||||
|
||||
return $url . "/" . $weData;
|
||||
}
|
||||
|
||||
@@ -1053,14 +1053,24 @@ class System
|
||||
}
|
||||
$res['SKIN_CREATEDATE'] = (isset($res['SKIN_CREATEDATE'])) ? $res['SKIN_CREATEDATE'] : '';
|
||||
$res['SKIN_MODIFIEDDATE'] = (isset($res['SKIN_MODIFIEDDATE'])) ? $res['SKIN_MODIFIEDDATE'] : '';
|
||||
$res['SKIN_WORKSPACE'] = (isset($res['SKIN_WORKSPACE'])) ? (($res['SKIN_WORKSPACE'] != '') ? $res['SKIN_WORKSPACE'] : $global) : $global;
|
||||
|
||||
$res['SKIN_TYPE_GLOBAL'] = false;
|
||||
if (isset($res['SKIN_WORKSPACE'])) {
|
||||
if ($res['SKIN_WORKSPACE'] === '') {
|
||||
$res['SKIN_WORKSPACE'] = $global;
|
||||
$res['SKIN_TYPE_GLOBAL'] = true;
|
||||
}
|
||||
} else {
|
||||
$res['SKIN_WORKSPACE'] = $global;
|
||||
$res['SKIN_TYPE_GLOBAL'] = true;
|
||||
}
|
||||
|
||||
$swWS = true;
|
||||
if ($res['SKIN_WORKSPACE'] != $global) {
|
||||
$workspace = explode("|", $res['SKIN_WORKSPACE']);
|
||||
$swWS = false;
|
||||
foreach ($workspace as $key => $value) {
|
||||
if ($value == SYS_SYS) {
|
||||
if ($value == config("system.workspace")) {
|
||||
$swWS = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ abstract class Exporter
|
||||
$data = array();
|
||||
|
||||
$data["metadata"] = $this->getMetadata();
|
||||
$data["metadata"]["workspace"] = defined("SYS_SYS") ? SYS_SYS : "Unknown";
|
||||
$data["metadata"]["workspace"] = !empty(config("system.workspace")) ? config("system.workspace") : "Unknown";
|
||||
$data["metadata"]["name"] = $this->getProjectName();
|
||||
$data["metadata"]["uid"] = $this->getProjectUid();
|
||||
|
||||
|
||||
@@ -771,7 +771,7 @@ abstract class Importer
|
||||
$exporter = new \ProcessMaker\Exporter\XmlExporter($prj_uid);
|
||||
$getProjectName = $exporter->truncateName($exporter->getProjectName(), false);
|
||||
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx") + 1;
|
||||
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx");
|
||||
|
||||
|
||||
@@ -45,8 +45,7 @@ class PluginRegistry
|
||||
use PluginStructure;
|
||||
use Attributes;
|
||||
use Init;
|
||||
|
||||
const NAME_CACHE = SYS_SYS . __CLASS__;
|
||||
|
||||
/**
|
||||
* Instance of de object PluginRegistry
|
||||
* @var PluginRegistry $instance
|
||||
@@ -75,9 +74,9 @@ class PluginRegistry
|
||||
public static function loadSingleton()
|
||||
{
|
||||
if (self::$instance === null) {
|
||||
if (is_null($object = Cache::get(self::NAME_CACHE))) {
|
||||
if (is_null($object = Cache::get(config("system.workspace") . __CLASS__))) {
|
||||
$object = new PluginRegistry();
|
||||
Cache::put(self::NAME_CACHE, $object, config('app.cache_lifetime'));
|
||||
Cache::put(config("system.workspace") . __CLASS__, $object, config('app.cache_lifetime'));
|
||||
}
|
||||
self::$instance = $object;
|
||||
}
|
||||
@@ -204,7 +203,7 @@ class PluginRegistry
|
||||
$fieldPlugin = PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin);
|
||||
PluginsRegistry::update($fieldPlugin);
|
||||
}
|
||||
Cache::pull(self::NAME_CACHE);
|
||||
Cache::pull(config("system.workspace") . __CLASS__);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -138,7 +138,7 @@ class Bpmn extends Handler
|
||||
//Define the variables for the logging
|
||||
$info = array(
|
||||
'ip' => G::getIpAddress(),
|
||||
'workspace' => (defined("SYS_SYS"))? SYS_SYS : "Workspace undefined"
|
||||
'workspace' => (!empty(config("system.workspace")))? config("system.workspace") : "Undefined Workspace"
|
||||
);
|
||||
$this->setContextLog($info);
|
||||
}
|
||||
|
||||
@@ -1123,10 +1123,10 @@ class Workflow extends Handler
|
||||
$basePath = PATH_DYNAFORM;
|
||||
break;
|
||||
case "PUBLIC":
|
||||
$basePath = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP;
|
||||
$basePath = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "public" . PATH_SEP;
|
||||
break;
|
||||
case "TEMPLATES":
|
||||
$basePath = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "mailTemplates" . PATH_SEP;
|
||||
$basePath = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "mailTemplates" . PATH_SEP;
|
||||
break;
|
||||
default:
|
||||
$basePath = "";
|
||||
@@ -1213,7 +1213,7 @@ class Workflow extends Handler
|
||||
|
||||
//Get templates and public files
|
||||
$workspaceTargetDirs = array("TEMPLATES" => "mailTemplates", "PUBLIC" => "public");
|
||||
$workspaceDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP;
|
||||
$workspaceDir = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP;
|
||||
|
||||
foreach ($workspaceTargetDirs as $target => $workspaceTargetDir) {
|
||||
$templatesDir = $workspaceDir . $workspaceTargetDir . PATH_SEP . $processUid;
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
use \ProcessMaker\Util\DateTime;
|
||||
use \ProcessMaker\BusinessModel\Validator;
|
||||
|
||||
use AppDocument;
|
||||
use AppDelegation;
|
||||
use AppDelegationPeer;
|
||||
use Criteria;
|
||||
use Exception;
|
||||
use Luracast\Restler\RestException;
|
||||
use ProcessMaker\BusinessModel\Cases as BmCases;
|
||||
use ProcessMaker\BusinessModel\User as BmUser;
|
||||
use ProcessMaker\BusinessModel\ProcessSupervisor as BmProcessSupervisor;
|
||||
use ProcessMaker\Util\DateTime;
|
||||
use ProcessMaker\BusinessModel\Validator;
|
||||
use ProcessMaker\Services\Api;
|
||||
|
||||
|
||||
/**
|
||||
* Cases Api Controller
|
||||
@@ -42,7 +51,7 @@ class Cases extends Api
|
||||
$delIndex = $this->parameters[$arrayArgs['app_index']];
|
||||
$userUid = $this->getUserId();
|
||||
//Check if the user has the case
|
||||
$appDelegation = new \AppDelegation();
|
||||
$appDelegation = new AppDelegation();
|
||||
$aCurUser = $appDelegation->getCurrentUsers($applicationUid, $delIndex);
|
||||
if (!empty($aCurUser)) {
|
||||
foreach ($aCurUser as $key => $value) {
|
||||
@@ -52,32 +61,46 @@ class Cases extends Api
|
||||
}
|
||||
}
|
||||
//Check if the user has Permissions
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oCases = new BmCases();
|
||||
return $oCases->checkUserHasPermissionsOrSupervisor($userUid, $applicationUid, $dynaformUid);
|
||||
break;
|
||||
case 'doPutCaseVariables':
|
||||
$applicationUid = $this->parameters[$arrayArgs['app_uid']];
|
||||
$dynaformUid = $this->parameters[$arrayArgs['dyn_uid']];
|
||||
$delIndex = $this->parameters[$arrayArgs['del_index']];
|
||||
$userUid = $this->getUserId();
|
||||
|
||||
//Check if the user has the case currently
|
||||
$appDelegation = new AppDelegation();
|
||||
$currentUser = $appDelegation->getCurrentUsers($applicationUid, $delIndex);
|
||||
foreach ($currentUser as $key => $value) {
|
||||
if ($value === $userUid) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//Check if the user is a supervisor
|
||||
//Unlike GET, it is not enough to have the processPermission for update the variables
|
||||
$cases = new BmCases();
|
||||
$isSupervisor = $cases->isSupervisorFromForm($userUid, $applicationUid, $dynaformUid);
|
||||
return $isSupervisor;
|
||||
break;
|
||||
case 'doPostReassign':
|
||||
$arrayParameters = $this->parameters[0]['cases'];
|
||||
$usrUid = $this->getUserId();
|
||||
|
||||
//Check if the user is supervisor process
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
|
||||
$case = new BmCases();
|
||||
$user = new BmUser();
|
||||
$count = 0;
|
||||
|
||||
foreach ($arrayParameters as $value) {
|
||||
$arrayApplicationData = $case->getApplicationRecordByPk($value['APP_UID'], [], false);
|
||||
|
||||
if (!empty($arrayApplicationData)) {
|
||||
if (!$user->checkPermission($usrUid, 'PM_REASSIGNCASE')) {
|
||||
if ($user->checkPermission($usrUid, 'PM_REASSIGNCASE_SUPERVISOR')) {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$flagps = $supervisor->isUserProcessSupervisor($arrayApplicationData['PRO_UID'], $usrUid);
|
||||
if (!$flagps) {
|
||||
$count = $count + 1;
|
||||
}
|
||||
|
||||
}
|
||||
$canReassign = $user->userCanReassign($usrUid, $arrayApplicationData['PRO_UID']);
|
||||
if (!$canReassign) {
|
||||
//We count when the user is not supervisor to the process
|
||||
$count = $count + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -86,24 +109,33 @@ class Cases extends Api
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case 'doPutReassignCase':
|
||||
$appUid = $this->parameters[$arrayArgs['app_uid']];
|
||||
$usrUid = $this->getUserId();
|
||||
$case = new BmCases();
|
||||
$user = new BmUser();
|
||||
$arrayApplicationData = $case->getApplicationRecordByPk($appUid, [], false);
|
||||
|
||||
return $user->userCanReassign($usrUid, $arrayApplicationData['PRO_UID']);
|
||||
break;
|
||||
case "doGetCaseInfo" :
|
||||
$appUid = $this->parameters[$arrayArgs['app_uid']];
|
||||
$usrUid = $this->getUserId();
|
||||
//Check if the user is supervisor process
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$case = new BmCases();
|
||||
$user = new BmUser();
|
||||
$arrayApplicationData = $case->getApplicationRecordByPk($appUid, [], false);
|
||||
if (!empty($arrayApplicationData)) {
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria->addSelectColumn(\AppDelegationPeer::APP_UID);
|
||||
$criteria->add(\AppDelegationPeer::APP_UID, $appUid);
|
||||
$criteria->add(\AppDelegationPeer::USR_UID, $usrUid);
|
||||
$criteria = new Criteria("workflow");
|
||||
$criteria->addSelectColumn(AppDelegationPeer::APP_UID);
|
||||
$criteria->add(AppDelegationPeer::APP_UID, $appUid);
|
||||
$criteria->add(AppDelegationPeer::USR_UID, $usrUid);
|
||||
$criteria->setLimit(1);
|
||||
$rsCriteria = \AppDelegationPeer::doSelectRS($criteria);
|
||||
$rsCriteria = AppDelegationPeer::doSelectRS($criteria);
|
||||
if ($rsCriteria->next()) {
|
||||
return true;
|
||||
} else {
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$supervisor = new BmProcessSupervisor();
|
||||
$flagps = $supervisor->isUserProcessSupervisor($arrayApplicationData['PRO_UID'], $usrUid);
|
||||
return $flagps;
|
||||
}
|
||||
@@ -131,7 +163,7 @@ class Cases extends Api
|
||||
}
|
||||
|
||||
return false;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -147,9 +179,7 @@ class Cases extends Api
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @throws Exception
|
||||
*
|
||||
* @url GET
|
||||
*/
|
||||
@@ -174,11 +204,11 @@ class Cases extends Api
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oCases = new BmCases();
|
||||
$response = $oCases->getList($dataList);
|
||||
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -194,9 +224,7 @@ class Cases extends Api
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @throws Exception
|
||||
*
|
||||
* @url GET /paged
|
||||
*/
|
||||
@@ -221,10 +249,10 @@ class Cases extends Api
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oCases = new BmCases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -240,9 +268,7 @@ class Cases extends Api
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @throws Exception
|
||||
*
|
||||
* @url GET /draft
|
||||
*/
|
||||
@@ -267,10 +293,10 @@ class Cases extends Api
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oCases = new BmCases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -286,9 +312,7 @@ class Cases extends Api
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @throws Exception
|
||||
*
|
||||
* @url GET /draft/paged
|
||||
*/
|
||||
@@ -313,10 +337,10 @@ class Cases extends Api
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oCases = new BmCases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -332,9 +356,7 @@ class Cases extends Api
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @throws Exception
|
||||
*
|
||||
* @url GET /participated
|
||||
*/
|
||||
@@ -359,10 +381,10 @@ class Cases extends Api
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oCases = new BmCases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -378,9 +400,7 @@ class Cases extends Api
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @throws Exception
|
||||
*
|
||||
* @url GET /participated/paged
|
||||
*/
|
||||
@@ -405,10 +425,10 @@ class Cases extends Api
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oCases = new BmCases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -424,9 +444,7 @@ class Cases extends Api
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @throws Exception
|
||||
*
|
||||
* @url GET /unassigned
|
||||
*/
|
||||
@@ -451,10 +469,10 @@ class Cases extends Api
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oCases = new BmCases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -470,9 +488,7 @@ class Cases extends Api
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @throws Exception
|
||||
*
|
||||
* @url GET /unassigned/paged
|
||||
*/
|
||||
@@ -497,10 +513,10 @@ class Cases extends Api
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oCases = new BmCases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -516,9 +532,7 @@ class Cases extends Api
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @throws Exception
|
||||
*
|
||||
* @url GET /paused
|
||||
*/
|
||||
@@ -543,10 +557,10 @@ class Cases extends Api
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oCases = new BmCases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -562,9 +576,7 @@ class Cases extends Api
|
||||
* @param string $pro_uid {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @throws Exception
|
||||
*
|
||||
* @url GET /paused/paged
|
||||
*/
|
||||
@@ -589,10 +601,10 @@ class Cases extends Api
|
||||
$dataList['category'] = $cat_uid;
|
||||
$dataList['process'] = $pro_uid;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oCases = new BmCases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -612,9 +624,7 @@ class Cases extends Api
|
||||
* @param string $date_to {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @throws Exception
|
||||
*
|
||||
* @url GET /advanced-search
|
||||
*/
|
||||
@@ -647,10 +657,10 @@ class Cases extends Api
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oCases = new BmCases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -670,9 +680,7 @@ class Cases extends Api
|
||||
* @param string $date_to {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @throws Exception
|
||||
*
|
||||
* @url GET /advanced-search/paged
|
||||
*/
|
||||
@@ -705,10 +713,10 @@ class Cases extends Api
|
||||
$dataList['dateFrom'] = $date_from;
|
||||
$dataList['dateTo'] = $date_to;
|
||||
$dataList['search'] = $search;
|
||||
$oCases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$oCases = new BmCases();
|
||||
$response = $oCases->getList($dataList);
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -719,17 +727,19 @@ class Cases extends Api
|
||||
* @url GET /:app_uid
|
||||
*
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function doGetCaseInfo($app_uid)
|
||||
{
|
||||
try {
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$case = new BmCases();
|
||||
$case->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$caseInfo = $case->getCaseInfo($app_uid, $this->getUserId());
|
||||
$caseInfo = DateTime::convertUtcToIso8601($caseInfo, $this->arrayFieldIso8601);
|
||||
return $caseInfo;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -742,7 +752,7 @@ class Cases extends Api
|
||||
public function doGetTaskCase($app_uid)
|
||||
{
|
||||
try {
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$case = new BmCases();
|
||||
$case->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$arrayData = $case->getTaskCase($app_uid, $this->getUserId());
|
||||
@@ -750,7 +760,7 @@ class Cases extends Api
|
||||
$response = $arrayData;
|
||||
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -776,10 +786,10 @@ class Cases extends Api
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases = new BmCases();
|
||||
$oData = $cases->addCase($pro_uid, $tas_uid, $userUid, $variables);
|
||||
return $oData;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -809,10 +819,10 @@ class Cases extends Api
|
||||
public function doPostCaseImpersonate($pro_uid, $usr_uid, $tas_uid, $variables = null)
|
||||
{
|
||||
try {
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases = new BmCases();
|
||||
$oData = $cases->addCaseImpersonate($pro_uid, $usr_uid, $tas_uid, $variables);
|
||||
return $oData;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -830,15 +840,15 @@ class Cases extends Api
|
||||
* @throws RestException
|
||||
*
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_REASSIGNCASE,PM_REASSIGNCASE_SUPERVISOR}
|
||||
* @class AccessControl {@className \ProcessMaker\Services\Api\Cases}
|
||||
*/
|
||||
public function doPutReassignCase($app_uid, $usr_uid_source, $usr_uid_target, $del_index = null)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases = new BmCases();
|
||||
$cases->updateReassignCase($app_uid, $userUid, $del_index, $usr_uid_source, $usr_uid_target);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -860,9 +870,9 @@ class Cases extends Api
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases = new BmCases();
|
||||
$cases->updateRouteCase($app_uid, $userUid, $del_index);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -883,9 +893,9 @@ class Cases extends Api
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases = new BmCases();
|
||||
$cases->putCancelCase($cas_uid, $userUid);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -907,13 +917,13 @@ class Cases extends Api
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases = new BmCases();
|
||||
if ($unpaused_date == null) {
|
||||
$cases->putPauseCase($cas_uid, $userUid);
|
||||
} else {
|
||||
$cases->putPauseCase($cas_uid, $userUid, false, $unpaused_date);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -934,9 +944,9 @@ class Cases extends Api
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases = new BmCases();
|
||||
$cases->putUnpauseCase($cas_uid, $userUid);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -958,9 +968,9 @@ class Cases extends Api
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases = new BmCases();
|
||||
$cases->putExecuteTriggerCase($cas_uid, $tri_uid, $userUid);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -971,6 +981,8 @@ class Cases extends Api
|
||||
*
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_CASES}
|
||||
* @param string $cas_uid {@min 1}{@max 32}
|
||||
* @throws Exception
|
||||
*
|
||||
* @param string $cas_uid {@min 1}{@max 32}
|
||||
*/
|
||||
@@ -978,9 +990,9 @@ class Cases extends Api
|
||||
{
|
||||
try {
|
||||
$usr_uid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases = new BmCases();
|
||||
$cases->deleteCase($cas_uid, $usr_uid);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -1004,10 +1016,10 @@ class Cases extends Api
|
||||
{
|
||||
try {
|
||||
$usr_uid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases = new BmCases();
|
||||
$response = $cases->getCaseVariables($app_uid, $usr_uid, $dyn_uid, $pro_uid, $act_uid, $app_index);
|
||||
return DateTime::convertUtcToIso8601($response);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -1031,10 +1043,10 @@ class Cases extends Api
|
||||
{
|
||||
try {
|
||||
$usr_uid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases = new BmCases();
|
||||
$request_data = \ProcessMaker\Util\DateTime::convertDataToUtc($request_data);
|
||||
$cases->setCaseVariables($app_uid, $request_data, $dyn_uid, $usr_uid, $del_index);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -1052,9 +1064,7 @@ class Cases extends Api
|
||||
* @param string $date_to {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @throws Exception
|
||||
*
|
||||
* @url GET /:app_uid/notes
|
||||
*/
|
||||
@@ -1082,10 +1092,10 @@ class Cases extends Api
|
||||
$dataList['search'] = $search;
|
||||
|
||||
$usr_uid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases = new BmCases();
|
||||
$response = $cases->getCaseNotes($app_uid, $usr_uid, $dataList);
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -1102,9 +1112,7 @@ class Cases extends Api
|
||||
* @param string $date_to {@from path}
|
||||
* @param string $search {@from path}
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
* @throws Exception
|
||||
*
|
||||
* @url GET /:app_uid/notes/paged
|
||||
*/
|
||||
@@ -1130,28 +1138,28 @@ class Cases extends Api
|
||||
$dataList['search'] = $search;
|
||||
|
||||
$usr_uid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases = new BmCases();
|
||||
$response = $cases->getCaseNotes($app_uid, $usr_uid, $dataList);
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new case note for a given case. Note that only users who are
|
||||
* currently assigned to work on the case or have Process Permissions to
|
||||
* Create a new case note for a given case. Note that only users who are
|
||||
* currently assigned to work on the case or have Process Permissions to
|
||||
* access case notes may create a case note.
|
||||
*
|
||||
* @url POST /:app_uid/note
|
||||
*
|
||||
*
|
||||
* @param string $app_uid {@min 1}{@max 32}
|
||||
* @param string $note_content {@min 1}{@max 500}
|
||||
* @param int $send_mail {@choice 1,0}
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
* @throws RestException
|
||||
*
|
||||
* @throws RestException
|
||||
*
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_CASES}
|
||||
*/
|
||||
@@ -1159,10 +1167,10 @@ class Cases extends Api
|
||||
{
|
||||
try {
|
||||
$usr_uid = $this->getUserId();
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases = new BmCases();
|
||||
$send_mail = ($send_mail == 0) ? false : true;
|
||||
$cases->saveCaseNote($app_uid, $usr_uid, $note_content, $send_mail);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -1175,13 +1183,13 @@ class Cases extends Api
|
||||
public function doGetTasks($app_uid)
|
||||
{
|
||||
try {
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$case = new BmCases();
|
||||
$case->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$response = $case->getTasks($app_uid);
|
||||
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -1204,9 +1212,9 @@ class Cases extends Api
|
||||
public function doPutExecuteTriggers($app_uid, $del_index, $obj_type, $obj_uid)
|
||||
{
|
||||
try {
|
||||
$cases = new \ProcessMaker\BusinessModel\Cases();
|
||||
$cases = new BmCases();
|
||||
$cases->putExecuteTriggers($app_uid, $del_index, $obj_type, $obj_uid);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -1221,13 +1229,13 @@ class Cases extends Api
|
||||
public function doGetSteps($app_uid, $del_index)
|
||||
{
|
||||
try {
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$case = new BmCases();
|
||||
$case->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$response = $case->getSteps($app_uid, $del_index);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -1239,6 +1247,7 @@ class Cases extends Api
|
||||
*
|
||||
* @param string $type_view {@from path}
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*
|
||||
*/
|
||||
public function doGetCasesListStarCase(
|
||||
@@ -1246,12 +1255,12 @@ class Cases extends Api
|
||||
) {
|
||||
try {
|
||||
$usr_uid = $this->getUserId();
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$case = new BmCases();
|
||||
|
||||
$response = $case->getCasesListStarCase($usr_uid, $type_view);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -1263,6 +1272,7 @@ class Cases extends Api
|
||||
*
|
||||
* @param string $type_view {@from path}
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*
|
||||
*/
|
||||
public function doGetCasesListBookmarkStarCase(
|
||||
@@ -1270,12 +1280,12 @@ class Cases extends Api
|
||||
) {
|
||||
try {
|
||||
$usr_uid = $this->getUserId();
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$case = new BmCases();
|
||||
|
||||
$response = $case->getCasesListBookmarkStarCase($usr_uid, $type_view);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -1283,14 +1293,14 @@ class Cases extends Api
|
||||
|
||||
/**
|
||||
* Mark a task process as a bookmark
|
||||
*
|
||||
*
|
||||
* @url POST /bookmark/:tas_uid
|
||||
*
|
||||
*
|
||||
* @param string $tas_uid {@min 32}{@max 32}
|
||||
*
|
||||
*
|
||||
* @return void
|
||||
* @throws RestException
|
||||
*
|
||||
* @throws RestException
|
||||
*
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_CASES}
|
||||
*/
|
||||
@@ -1298,9 +1308,9 @@ class Cases extends Api
|
||||
{
|
||||
try {
|
||||
$userLoggedUid = $this->getUserId();
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$user = new BmUser();
|
||||
$user->updateBookmark($userLoggedUid, $tas_uid, 'INSERT');
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -1310,15 +1320,16 @@ class Cases extends Api
|
||||
* @url DELETE /bookmark/:tas_uid
|
||||
*
|
||||
* @param string $tas_uid {@min 32}{@max 32}
|
||||
* @throws Exception
|
||||
*
|
||||
*/
|
||||
public function doDeleteBookmarkStartCase($tas_uid)
|
||||
{
|
||||
try {
|
||||
$userLoggedUid = $this->getUserId();
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$user = new BmUser();
|
||||
$user->updateBookmark($userLoggedUid, $tas_uid, 'DELETE');
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -1331,15 +1342,16 @@ class Cases extends Api
|
||||
* @class AccessControl {@className \ProcessMaker\Services\Api\Cases}
|
||||
*
|
||||
* @param array $request_data
|
||||
* @throws Exception
|
||||
*
|
||||
*/
|
||||
public function doPostReassign($request_data)
|
||||
{
|
||||
try {
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$case = new BmCases();
|
||||
$response = $case->doPostReassign($request_data);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1832,11 +1832,9 @@ class Light extends Api
|
||||
try {
|
||||
//Check if the user is a supervisor or have permissions
|
||||
$usr_uid = $this->getUserId();
|
||||
$cases = new BusinessModelCases();
|
||||
$hasAccess = $cases->checkUserHasPermissionsOrSupervisor($usr_uid, $app_uid, $dyn_uid);
|
||||
|
||||
//When the user is a supervisor del_index is 0
|
||||
if ($del_index <= 0 && !$hasAccess) {
|
||||
if ($del_index < 0) {
|
||||
throw (new Exception(G::LoadTranslation('ID_INVALID_VALUE_EXPECTING_POSITIVE_INTEGER',
|
||||
array('del_index')), Api::STAT_APP_EXCEPTION));
|
||||
}
|
||||
@@ -1844,6 +1842,7 @@ class Light extends Api
|
||||
throw (new Exception(G::LoadTranslation('ID_CAN_NOT_BE_NULL', array('del_index')),
|
||||
Api::STAT_APP_EXCEPTION));
|
||||
}
|
||||
$cases = new BusinessModelCases();
|
||||
if ($del_index > 0) {
|
||||
if ($cases->caseAlreadyRouted($app_uid, $del_index, $usr_uid)) {
|
||||
throw (new Exception(G::LoadTranslation('ID_CASE_ALREADY_DERIVATED'), Api::STAT_APP_EXCEPTION));
|
||||
|
||||
@@ -178,7 +178,7 @@ class Project extends Api
|
||||
$objects = \G::json_decode($objects);
|
||||
$granularExporter = new GranularExporter($prj_uid);
|
||||
$outputFilename = $granularExporter->export($objects);
|
||||
$outputFilename = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'files' . PATH_SEP . 'output' .
|
||||
$outputFilename = PATH_DATA . 'sites' . PATH_SEP . config("system.workspace") . PATH_SEP . 'files' . PATH_SEP . 'output' .
|
||||
PATH_SEP . $outputFilename;
|
||||
$httpStream = new HttpStream();
|
||||
$fileExtension = pathinfo($outputFilename, PATHINFO_EXTENSION);
|
||||
@@ -199,7 +199,7 @@ class Project extends Api
|
||||
$exporter = new \ProcessMaker\Exporter\XmlExporter($prj_uid);
|
||||
$getProjectName = $exporter->truncateName($exporter->getProjectName(), false);
|
||||
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx") + 1;
|
||||
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx");
|
||||
|
||||
|
||||
@@ -59,45 +59,21 @@ class ProcessPermissions extends Api
|
||||
|
||||
/**
|
||||
* Creates a new Process Permission for a project.
|
||||
*
|
||||
*
|
||||
* @url POST /:prj_uid/process-permission/
|
||||
* @status 201
|
||||
*
|
||||
*
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param array $request_data
|
||||
* @param string $usr_uid {@from body} {@min 1} {@max 32}
|
||||
* @param string $op_user_relation {@from body} {@choice 1,2}
|
||||
* @param string $op_case_status {@from body} {@choice ALL,DRAFT,TO_DO,PAUSED,COMPLETED}
|
||||
* @param string $op_participate {@from body} {@choice 0,1}
|
||||
* @param string $op_obj_type {@from body} {@choice ANY,DYNAFORM,ATTACHMENT,INPUT,OUTPUT,CASES_NOTES,MSGS_HISTORY,SUMMARY_FORM}
|
||||
* @param string $op_action {@from body} {@choice VIEW,BLOCK,DELETE,RESEND}
|
||||
* @param string $tas_uid {@from body}
|
||||
* @param string $op_task_source {@from body}
|
||||
* @param string $dynaforms {@from body}
|
||||
* @param string $inputs {@from body}
|
||||
* @param string $outputs {@from body}
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*
|
||||
*
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_FACTORY}
|
||||
*/
|
||||
public function doPostProcessPermission(
|
||||
$prj_uid,
|
||||
$request_data,
|
||||
$usr_uid,
|
||||
$op_user_relation,
|
||||
$op_case_status,
|
||||
$op_participate,
|
||||
$op_obj_type,
|
||||
$op_action,
|
||||
$tas_uid = '',
|
||||
$op_task_source = '',
|
||||
$dynaforms = '',
|
||||
$inputs = '',
|
||||
$outputs = ''
|
||||
) {
|
||||
public function doPostProcessPermission($prj_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$hiddenFields = array('task_target', 'group_user', 'task_source',
|
||||
'object_type', 'object', 'participated', 'action'
|
||||
|
||||
@@ -144,8 +144,8 @@ class Server implements iAuthenticate
|
||||
$host = $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : '');
|
||||
$host = $http .'://'. $host;
|
||||
|
||||
$applicationsLink = sprintf('%s/%s/oauth2/apps', $host, SYS_SYS);
|
||||
$authorizationLink = sprintf('%s/%s/oauth2/authorize?response_type=code&client_id=[the-client-id]&scope=*', $host, SYS_SYS);
|
||||
$applicationsLink = sprintf('%s/%s/oauth2/apps', $host, config("system.workspace"));
|
||||
$authorizationLink = sprintf('%s/%s/oauth2/authorize?response_type=code&client_id=[the-client-id]&scope=*', $host, config("system.workspace"));
|
||||
|
||||
$view = new \Maveriks\Pattern\Mvc\SmartyView(PATH_CORE . "templates/oauth2/index.html");
|
||||
$view->assign('host', $host);
|
||||
@@ -180,7 +180,7 @@ class Server implements iAuthenticate
|
||||
$host = $http . '://' . $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : '');
|
||||
$redirect = urlencode($host.'/'.self::$workspace.$_SERVER['REQUEST_URI']);
|
||||
|
||||
$loginLink = sprintf('%s/sys%s/%s/%s/login/login?u=%s', $host, SYS_SYS, SYS_LANG, SYS_SKIN, $redirect);
|
||||
$loginLink = sprintf('%s/sys%s/%s/%s/login/login?u=%s', $host, config("system.workspace"), SYS_LANG, SYS_SKIN, $redirect);
|
||||
header('location: ' . $loginLink);
|
||||
die;
|
||||
}
|
||||
@@ -214,7 +214,7 @@ class Server implements iAuthenticate
|
||||
$view = new \Maveriks\Pattern\Mvc\SmartyView(PATH_CORE . "templates/oauth2/authorize.html");
|
||||
$view->assign('user', $user);
|
||||
$view->assign('client', $client);
|
||||
$view->assign('postUri', '/' . SYS_SYS . '/oauth2/authorize?' . $_SERVER['QUERY_STRING']);
|
||||
$view->assign('postUri', '/' . config("system.workspace") . '/oauth2/authorize?' . $_SERVER['QUERY_STRING']);
|
||||
$view->render();
|
||||
exit();
|
||||
}
|
||||
@@ -364,7 +364,7 @@ class Server implements iAuthenticate
|
||||
$userTimeZone = $user->getUsrTimeZone();
|
||||
|
||||
if (trim($userTimeZone) == '') {
|
||||
$arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS);
|
||||
$arraySystemConfiguration = System::getSystemConfiguration('', '', config("system.workspace"));
|
||||
|
||||
$userTimeZone = $arraySystemConfiguration['time_zone'];
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ class FixReferencePath
|
||||
*/
|
||||
public function regeneratePropelClasses($repTabName, $className, $fields, $guid)
|
||||
{
|
||||
$sourcePath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
|
||||
$sourcePath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP;
|
||||
|
||||
@unlink($sourcePath . $className . '.php');
|
||||
@unlink($sourcePath . $className . 'Peer.php');
|
||||
|
||||
@@ -27,7 +27,7 @@ class System
|
||||
public static function getTimeZone()
|
||||
{
|
||||
try {
|
||||
$arraySystemConfiguration = PmSystem::getSystemConfiguration('', '', SYS_SYS);
|
||||
$arraySystemConfiguration = PmSystem::getSystemConfiguration('', '', config("system.workspace"));
|
||||
|
||||
//Return
|
||||
return $arraySystemConfiguration['time_zone'];
|
||||
|
||||
@@ -255,8 +255,8 @@ function getVarsGrid($proUid, $dynUid)
|
||||
|
||||
$dynaformFields = array();
|
||||
|
||||
if (is_file(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') && filesize(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') > 0) {
|
||||
$dyn = new dynaFormHandler(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml');
|
||||
if (is_file(PATH_DATA . '/sites/' . config("system.workspace") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') && filesize(PATH_DATA . '/sites/' . config("system.workspace") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') > 0) {
|
||||
$dyn = new dynaFormHandler(PATH_DATA . '/sites/' . config("system.workspace") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml');
|
||||
$dynaformFields[] = $dyn->getFields();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user