@@ -695,9 +695,14 @@ class Cases
|
||||
$response = [];
|
||||
$subApplication = new SubApplication();
|
||||
$data = $subApplication->loadByAppUidParent($applicationUid);
|
||||
foreach ($data as $item) {
|
||||
$response[] = $this->getCaseInfo($item['APP_UID'], $userUid);
|
||||
if (!empty($data)) {
|
||||
foreach ($data as $item) {
|
||||
$response[] = $this->getCaseInfo($item['APP_UID'], $userUid);
|
||||
}
|
||||
} else {
|
||||
throw new Exception(G::LoadTranslation("ID_CASE_DOES_NOT_EXIST", [$applicationUid]));
|
||||
}
|
||||
|
||||
return $response;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
@@ -1972,6 +1977,13 @@ class Cases
|
||||
Validator::isArray($app_data, '$app_data');
|
||||
Validator::isString($usr_uid, '$usr_uid');
|
||||
Validator::usrUid($usr_uid, '$usr_uid');
|
||||
// Validate the system variables
|
||||
$systemVars = G::getSystemConstants();
|
||||
foreach ($systemVars as $key => $var) {
|
||||
if (array_key_exists($key, $app_data)) {
|
||||
throw new Exception(G::LoadTranslation("ID_CAN_NOT_CHANGE"));
|
||||
}
|
||||
}
|
||||
|
||||
$arrayResult = $this->getStatusInfo($app_uid);
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ use G;
|
||||
use ObjectPermissionPeer;
|
||||
use ProcessMaker\BusinessModel\Cases AS BusinessModelCases;
|
||||
use ProcessMaker\BusinessModel\ProcessSupervisor;
|
||||
use ProcessMaker\Model\Application;
|
||||
use ProcessMaker\Model\Delegation;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use ProcessMaker\Validation\ValidationUploadedFiles;
|
||||
use ProcessUserPeer;
|
||||
@@ -241,6 +243,7 @@ class InputDocument
|
||||
|
||||
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_UID);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::DOC_VERSION);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_COMMENT);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::DOC_UID);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::USR_UID);
|
||||
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_TYPE);
|
||||
@@ -280,13 +283,16 @@ class InputDocument
|
||||
public function getAppDocumentDataFromRecord(array $record)
|
||||
{
|
||||
try {
|
||||
$newArray = array();
|
||||
$newArray = [];
|
||||
if (isset($record["APP_DOC_UID"])) {
|
||||
$newArray["app_doc_uid"] = $record["APP_DOC_UID"];
|
||||
}
|
||||
if (isset($record["APP_DOC_FILENAME"])) {
|
||||
$newArray["app_doc_filename"] = $record["APP_DOC_FILENAME"];
|
||||
}
|
||||
if (isset($record["APP_DOC_COMMENT"])) {
|
||||
$newArray["app_doc_comment"] = $record["APP_DOC_COMMENT"];
|
||||
}
|
||||
if (isset($record["DOC_UID"])) {
|
||||
$newArray["doc_uid"] = $record["DOC_UID"];
|
||||
}
|
||||
@@ -464,8 +470,6 @@ class InputDocument
|
||||
public function getCasesInputDocument($appUid, $userUid, $inputDocumentUid)
|
||||
{
|
||||
try {
|
||||
$appUid = $applicationUid;
|
||||
|
||||
$case = new Cases();
|
||||
$fields = $case->loadCase($appUid);
|
||||
$proUid = $fields['PRO_UID'];
|
||||
@@ -767,7 +771,7 @@ class InputDocument
|
||||
/**
|
||||
* Get data of Cases InputDocument
|
||||
*
|
||||
* @param string $applicationUid
|
||||
* @param string $appUid
|
||||
* @param string $taskUid
|
||||
* @param string $appDocComment
|
||||
* @param string $inputDocumentUid
|
||||
@@ -776,7 +780,7 @@ class InputDocument
|
||||
* @return array Return an array with data of an InputDocument
|
||||
* @throws Exception
|
||||
*/
|
||||
public function addCasesInputDocument($applicationUid, $taskUid, $appDocComment, $inputDocumentUid, $userUid, $runningWorkflow = true)
|
||||
public function addCasesInputDocument($appUid, $taskUid, $appDocComment, $inputDocumentUid, $userUid, $runningWorkflow = true)
|
||||
{
|
||||
try {
|
||||
if ((isset( $_FILES['form'] )) && ($_FILES['form']['error'] != 0)) {
|
||||
@@ -816,64 +820,49 @@ class InputDocument
|
||||
$appDocUid = G::generateUniqueID();
|
||||
$docVersion = '';
|
||||
$appDocType = 'INPUT';
|
||||
$delIndex = AppDelegation::getCurrentIndex($appUid);
|
||||
$case = new Cases();
|
||||
$delIndex = AppDelegation::getCurrentIndex($applicationUid);
|
||||
|
||||
if ($runningWorkflow) {
|
||||
$case->thisIsTheCurrentUser($applicationUid, $delIndex, $userUid, 'REDIRECT', 'casesListExtJs');
|
||||
$case->thisIsTheCurrentUser($appUid, $delIndex, $userUid, 'REDIRECT', 'casesListExtJs');
|
||||
} else {
|
||||
$criteria = new Criteria('workflow');
|
||||
|
||||
$criteria->add(AppDelegationPeer::APP_UID, $applicationUid);
|
||||
$criteria->add(AppDelegationPeer::DEL_INDEX, $delIndex);
|
||||
$criteria->add(AppDelegationPeer::USR_UID, $userUid);
|
||||
|
||||
$rsCriteria = ProcessUserPeer::doSelectRS($criteria);
|
||||
|
||||
if (!$rsCriteria->next()) {
|
||||
$case2 = new BusinessModelCases();
|
||||
|
||||
$arrayApplicationData = $case2->getApplicationRecordByPk($applicationUid, [], false);
|
||||
|
||||
$msg = '';
|
||||
|
||||
$appInfo = Application::getCase($appUid);
|
||||
$proUid = $appInfo['PRO_UID'];
|
||||
$appNumber = $appInfo['APP_NUMBER'];
|
||||
$msg = '';
|
||||
// Check the current user
|
||||
$currentUser = Delegation::getCurrentUser($appNumber, $delIndex);
|
||||
if ($currentUser !== $userUid) {
|
||||
// Review if is a supervisor
|
||||
$supervisor = new ProcessSupervisor();
|
||||
$flagps = $supervisor->isUserProcessSupervisor($arrayApplicationData['PRO_UID'], $userUid);
|
||||
|
||||
if ($flagps == false) {
|
||||
$msg = G::LoadTranslation('ID_USER_NOT_IT_BELONGS_CASE_OR_NOT_SUPERVISOR');
|
||||
}
|
||||
|
||||
if ($msg == '') {
|
||||
$isSupervisor = $supervisor->isUserProcessSupervisor($proUid, $userUid);
|
||||
if ($isSupervisor) {
|
||||
$criteria = new Criteria('workflow');
|
||||
|
||||
$criteria->add(StepSupervisorPeer::PRO_UID, $arrayApplicationData['PRO_UID'], Criteria::EQUAL);
|
||||
$criteria->add(StepSupervisorPeer::PRO_UID, $proUid, Criteria::EQUAL);
|
||||
$criteria->add(StepSupervisorPeer::STEP_TYPE_OBJ, 'INPUT_DOCUMENT', Criteria::EQUAL);
|
||||
$criteria->add(StepSupervisorPeer::STEP_UID_OBJ, $inputDocumentUid, Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = StepSupervisorPeer::doSelectRS($criteria);
|
||||
|
||||
if (!$rsCriteria->next()) {
|
||||
$msg = G::LoadTranslation('ID_USER_IS_SUPERVISOR_DOES_NOT_ASSOCIATED_INPUT_DOCUMENT');
|
||||
}
|
||||
} else {
|
||||
$msg = G::LoadTranslation('ID_USER_NOT_IT_BELONGS_CASE_OR_NOT_SUPERVISOR');
|
||||
}
|
||||
}
|
||||
if (!empty($msg)) {
|
||||
if ($runningWorkflow) {
|
||||
G::SendMessageText($msg, 'ERROR');
|
||||
$backUrlObj = explode('sys' . config("system.workspace"), $_SERVER['HTTP_REFERER']);
|
||||
|
||||
if ($msg != '') {
|
||||
if ($runningWorkflow) {
|
||||
G::SendMessageText($msg, 'ERROR');
|
||||
$backUrlObj = explode('sys' . config("system.workspace"), $_SERVER['HTTP_REFERER']);
|
||||
|
||||
G::header('location: ' . '/sys' . config("system.workspace") . $backUrlObj[1]);
|
||||
exit(0);
|
||||
} else {
|
||||
throw new Exception($msg);
|
||||
}
|
||||
G::header('location: ' . '/sys' . config("system.workspace") . $backUrlObj[1]);
|
||||
exit(0);
|
||||
} else {
|
||||
throw new Exception($msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Load the fields
|
||||
$arrayField = $case->loadCase($applicationUid);
|
||||
$arrayField = $case->loadCase($appUid);
|
||||
$arrayField["APP_DATA"] = array_merge($arrayField["APP_DATA"], G::getSystemConstants());
|
||||
//Validate Process Uid and Input Document Process Uid
|
||||
$inputDocumentInstance = new \InputDocument();
|
||||
@@ -898,7 +887,7 @@ class InputDocument
|
||||
$appDocType,
|
||||
$appDocComment,
|
||||
'',
|
||||
$applicationUid,
|
||||
$appUid,
|
||||
$delIndex,
|
||||
$taskUid,
|
||||
$userUid,
|
||||
@@ -908,7 +897,7 @@ class InputDocument
|
||||
$_FILES["form"]["tmp_name"]);
|
||||
}
|
||||
//Trigger - Execute after - Start
|
||||
$arrayField["APP_DATA"] = $case->executeTriggers ($taskUid,
|
||||
$arrayField["APP_DATA"] = $case->executeTriggers($taskUid,
|
||||
"INPUT_DOCUMENT",
|
||||
$inputDocumentUid,
|
||||
"AFTER",
|
||||
@@ -921,8 +910,8 @@ class InputDocument
|
||||
$arrayData["APP_DATA"] = $arrayField["APP_DATA"];
|
||||
$arrayData["DEL_INDEX"] = $delIndex;
|
||||
$arrayData["TAS_UID"] = $taskUid;
|
||||
$case->updateCase($applicationUid, $arrayData);
|
||||
return($this->getCasesInputDocument($applicationUid, $userUid, $appDocUid));
|
||||
$case->updateCase($appUid, $arrayData);
|
||||
return($this->getCasesInputDocument($appUid, $userUid, $appDocUid));
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
@@ -102,8 +102,10 @@ class Search extends AbstractCases
|
||||
}
|
||||
// Filter by task
|
||||
if ($this->getTaskId()) {
|
||||
// Join with delegation
|
||||
$query->joinDelegation();
|
||||
if (!$this->getUserId()) {
|
||||
// Join with delegation if was not defined before
|
||||
$query->joinDelegation();
|
||||
}
|
||||
// Add the filter
|
||||
$query->task($this->getTaskId());
|
||||
// Get only the open threads related to the task
|
||||
|
||||
@@ -3,9 +3,17 @@
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use AdditionalTables;
|
||||
use CaseTrackerObject;
|
||||
use Criteria;
|
||||
use Dynaform as ModelDynaform;
|
||||
use DynaformHandler;
|
||||
use DynaformPeer;
|
||||
use Exception;
|
||||
use G;
|
||||
use ObjectPermission;
|
||||
use ResultSet;
|
||||
use Step;
|
||||
use StepSupervisor;
|
||||
use PmDynaform;
|
||||
|
||||
class DynaForm
|
||||
@@ -139,35 +147,34 @@ class DynaForm
|
||||
*/
|
||||
public function dynaFormDepends($dynUid, $proUid)
|
||||
{
|
||||
$oCriteria = new \Criteria();
|
||||
$oCriteria->addSelectColumn(\DynaformPeer::DYN_TYPE);
|
||||
$oCriteria->add(\DynaformPeer::DYN_UID, $dynUid);
|
||||
$oCriteria->add(\DynaformPeer::PRO_UID, $proUid);
|
||||
$oDataset = \DynaformPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oCriteria = new Criteria();
|
||||
$oCriteria->addSelectColumn(DynaformPeer::DYN_TYPE);
|
||||
$oCriteria->add(DynaformPeer::DYN_UID, $dynUid);
|
||||
$oCriteria->add(DynaformPeer::PRO_UID, $proUid);
|
||||
$oDataset = DynaformPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$dataDyna = $oDataset->getRow();
|
||||
|
||||
if ($dataDyna['DYN_TYPE'] == 'grid') {
|
||||
$formsDepend = array();
|
||||
$formsDepend = [];
|
||||
|
||||
|
||||
$oCriteria = new \Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(\DynaformPeer::DYN_UID);
|
||||
$oCriteria->addSelectColumn(\DynaformPeer::DYN_TITLE);
|
||||
$oCriteria->add(\DynaformPeer::PRO_UID, $proUid);
|
||||
$oCriteria->add(\DynaformPeer::DYN_TYPE, "xmlform");
|
||||
$oDataset = \DynaformPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn(DynaformPeer::DYN_UID);
|
||||
$oCriteria->addSelectColumn(DynaformPeer::DYN_TITLE);
|
||||
$oCriteria->add(DynaformPeer::PRO_UID, $proUid);
|
||||
$oCriteria->add(DynaformPeer::DYN_TYPE, "xmlform");
|
||||
$oDataset = DynaformPeer::doSelectRS($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($oDataset->next()) {
|
||||
$dataForms = $oDataset->getRow();
|
||||
$dynHandler = new DynaformHandler(PATH_DYNAFORM . $proUid . PATH_SEP . $dataForms["DYN_UID"] . ".xml");
|
||||
$dynFields = $dynHandler->getFields();
|
||||
foreach ($dynFields as $field) {
|
||||
$sType = \Step::getAttribute($field, 'type');
|
||||
$sType = Step::getAttribute($field, 'type');
|
||||
if ($sType == 'grid') {
|
||||
$sxmlgrid = \Step::getAttribute($field, 'xmlgrid');
|
||||
$sxmlgrid = Step::getAttribute($field, 'xmlgrid');
|
||||
$aGridInfo = explode("/", $sxmlgrid);
|
||||
if ($aGridInfo[0] == $proUid && $aGridInfo[1] == $dynUid) {
|
||||
$formsDepend[] = $dataForms["DYN_TITLE"];
|
||||
@@ -183,9 +190,9 @@ class DynaForm
|
||||
}
|
||||
} else {
|
||||
$flagDepend = false;
|
||||
$stepsDepends = \Step::verifyDynaformAssigStep($dynUid, $proUid);
|
||||
$stepsDepends = Step::verifyDynaformAssigStep($dynUid, $proUid);
|
||||
|
||||
$messageSteps = '(0) Depends in steps';
|
||||
$messageSteps = G::LoadTranslation("ID_DYNAFORM_DEPENDS_STEPS", [0]);
|
||||
if (!empty($stepsDepends)) {
|
||||
$flagDepend = true;
|
||||
$countSteps = count($stepsDepends);
|
||||
@@ -193,41 +200,41 @@ class DynaForm
|
||||
foreach ($stepsDepends as $value) {
|
||||
$messTemp .= ", the task '" . $value['CON_VALUE'] . "' position " . $value['STEP_POSITION'];
|
||||
}
|
||||
$messageSteps = "($countSteps) Depends in steps in" . $messTemp;
|
||||
$messageSteps = G::LoadTranslation("ID_DYNAFORM_DEPENDS_STEPS", [$countSteps]) . ' in ' . $messTemp;
|
||||
}
|
||||
|
||||
$stepSupervisorsDepends = \StepSupervisor::verifyDynaformAssigStepSupervisor($dynUid, $proUid);
|
||||
$messageStepsSupervisors = '(0) Depends in steps supervisor';
|
||||
$stepSupervisorsDepends = StepSupervisor::verifyDynaformAssigStepSupervisor($dynUid, $proUid);
|
||||
$messageStepsSupervisors = G::LoadTranslation("ID_DYNAFORM_DEPENDS_STEPS_SUPERVISOR", [0]);
|
||||
if (!empty($stepSupervisorsDepends)) {
|
||||
$flagDepend = true;
|
||||
$countSteps = count($stepSupervisorsDepends);
|
||||
$messageStepsSupervisors = "($countSteps) Depends in steps supervisor";
|
||||
$messageStepsSupervisors = G::LoadTranslation("ID_DYNAFORM_DEPENDS_STEPS_SUPERVISOR", [$countSteps]);
|
||||
}
|
||||
|
||||
$objectPermissionDepends = \ObjectPermission::verifyDynaformAssigObjectPermission($dynUid, $proUid);
|
||||
$messageObjectPermission = '(0) Depends in permissions';
|
||||
$objectPermissionDepends = ObjectPermission::verifyDynaformAssigObjectPermission($dynUid, $proUid);
|
||||
$messageObjectPermission = G::LoadTranslation("ID_DYNAFORM_DEPENDS_PERMISSIONS", [0]);
|
||||
if (!empty($objectPermissionDepends)) {
|
||||
$flagDepend = true;
|
||||
$countSteps = count($objectPermissionDepends);
|
||||
$messageObjectPermission = "($countSteps) Depends in permissions";
|
||||
$messageObjectPermission = G::LoadTranslation("ID_DYNAFORM_DEPENDS_PERMISSIONS", [$countSteps]);
|
||||
}
|
||||
|
||||
$caseTrackerDepends = \CaseTrackerObject::verifyDynaformAssigCaseTracker($dynUid, $proUid);
|
||||
$messageCaseTracker = '(0) Depends in case traker';
|
||||
$caseTrackerDepends = CaseTrackerObject::verifyDynaformAssigCaseTracker($dynUid, $proUid);
|
||||
$messageCaseTracker = G::LoadTranslation("ID_DYNAFORM_DEPENDS_CASE_TRACKER", [0]);
|
||||
if (!empty($caseTrackerDepends)) {
|
||||
$flagDepend = true;
|
||||
$countSteps = count($caseTrackerDepends);
|
||||
$messageCaseTracker = "($countSteps) Depends in case traker";
|
||||
$messageCaseTracker = G::LoadTranslation("ID_DYNAFORM_DEPENDS_CASE_TRACKER", [$countSteps]);
|
||||
}
|
||||
|
||||
$dynaformDepends = \Dynaform::verifyDynaformAssignDynaform($dynUid, $proUid);
|
||||
$messageDynaform = '(0) Depends in case traker';
|
||||
$dynaformDepends = ModelDynaform::verifyDynaformAssignDynaform($dynUid, $proUid);
|
||||
$messageDynaform = G::LoadTranslation("ID_DYNAFORM_DEPENDS_DYNAFORMS", [0]);
|
||||
if (!empty($dynaformDepends)) {
|
||||
$flagDepend = true;
|
||||
$countSteps = count($dynaformDepends);
|
||||
$messageDynaform = "($countSteps) Depends in dynaform";
|
||||
$messageDynaform = G::LoadTranslation("ID_DYNAFORM_DEPENDS_DYNAFORMS", [$countSteps]);
|
||||
}
|
||||
|
||||
$message = '';
|
||||
if ($flagDepend) {
|
||||
$message = "You can not delete the dynaform '$dynUid', because it has the following dependencies: \n\n";
|
||||
$message .= $messageSteps . ".\n" . $messageStepsSupervisors . ".\n";
|
||||
@@ -235,7 +242,7 @@ class DynaForm
|
||||
$message .= $messageDynaform;
|
||||
return $message;
|
||||
}
|
||||
return '';
|
||||
return $message;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -453,14 +460,11 @@ class DynaForm
|
||||
|
||||
//Load DynaForm
|
||||
$dynaForm = new \Dynaform();
|
||||
|
||||
$arrayDynaFormData = $dynaForm->Load($dynaFormUid);
|
||||
|
||||
$processUid = $arrayDynaFormData["PRO_UID"];
|
||||
|
||||
//Verify data
|
||||
$process = new \ProcessMaker\BusinessModel\Process();
|
||||
|
||||
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, false);
|
||||
|
||||
if (isset($arrayData["DYN_TITLE"])) {
|
||||
@@ -471,8 +475,9 @@ class DynaForm
|
||||
|
||||
//Update
|
||||
$arrayData["DYN_UID"] = $dynaFormUid;
|
||||
|
||||
$result = $dynaForm->update($arrayData);
|
||||
//Add Audit Log
|
||||
G::auditLog("UpdateDynaform", "Dynaform Title: " . $arrayData['DYN_TITLE'] . ", Type: " . $arrayData['DYN_TYPE'] . ", Description: " . $arrayData['DYN_DESCRIPTION'] . ", Uid: " . $arrayData["DYN_UID"]);
|
||||
|
||||
//Return
|
||||
unset($arrayData["DYN_UID"]);
|
||||
@@ -482,7 +487,7 @@ class DynaForm
|
||||
}
|
||||
|
||||
return $arrayData;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1275,6 +1275,8 @@ class ProcessSupervisor
|
||||
$finPos = $prStepPos-1;
|
||||
}
|
||||
$range = range($iniPos, $finPos);
|
||||
$stepChangePos = [];
|
||||
$stepChangeIds = [];
|
||||
foreach ($aSteps as $dataStep) {
|
||||
if ($dataStep['obj_type'] == 'DYNAFORM') {
|
||||
if ((in_array($dataStep['pud_position'], $range)) && ($dataStep['pud_uid'] != $step_uid)) {
|
||||
|
||||
@@ -210,7 +210,7 @@ class User
|
||||
|
||||
$this->throwExceptionIfNotItsAssignedUserToRole($roleUid, $userUid, $this->arrayFieldNameForException["userUid"]);
|
||||
|
||||
if ($userUid == "00000000000000000000000000000001") {
|
||||
if (RBAC::isAdminUserUid($userUid)) {
|
||||
throw new Exception(G::LoadTranslation("ID_ADMINISTRATOR_ROLE_CANT_CHANGED"));
|
||||
}
|
||||
|
||||
|
||||
@@ -396,17 +396,15 @@ class User
|
||||
* Verify if exists the Name of a User
|
||||
*
|
||||
* @param string $userName Name
|
||||
* @param string $fieldNameForException Field name for the exception
|
||||
* @param string $userUidToExclude Unique id of User to exclude
|
||||
*
|
||||
* @throws Exception if exists the title of a User
|
||||
*/
|
||||
public function throwExceptionIfExistsName($userName, $fieldNameForException, $userUidToExclude = "")
|
||||
public function throwExceptionIfExistsName($userName, $userUidToExclude = "")
|
||||
{
|
||||
try {
|
||||
if ($this->existsName($userName, $userUidToExclude)) {
|
||||
throw new Exception(G::LoadTranslation("ID_USER_NAME_ALREADY_EXISTS",
|
||||
array($fieldNameForException, $userName)));
|
||||
throw new Exception(G::LoadTranslation("ID_USER_NAME_ALREADY_EXISTS", [$userName]));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
@@ -446,7 +444,7 @@ class User
|
||||
{
|
||||
try {
|
||||
//Set variables
|
||||
$arrayUserData = ($userUid == "") ? array() : $this->getUser($userUid, true);
|
||||
$arrayUserData = ($userUid == "") ? [] : $this->getUser($userUid, true);
|
||||
$flagInsert = ($userUid == "") ? true : false;
|
||||
|
||||
$arrayFinalData = array_merge($arrayUserData, $arrayData);
|
||||
@@ -459,8 +457,7 @@ class User
|
||||
|
||||
//Verify data
|
||||
if (isset($arrayData["USR_USERNAME"])) {
|
||||
$this->throwExceptionIfExistsName($arrayData["USR_USERNAME"],
|
||||
$this->arrayFieldNameForException["usrUsername"], $userUid);
|
||||
$this->throwExceptionIfExistsName($arrayData["USR_USERNAME"], $userUid);
|
||||
}
|
||||
|
||||
if (isset($arrayData["USR_EMAIL"])) {
|
||||
@@ -762,8 +759,6 @@ class User
|
||||
public function create(array $arrayData)
|
||||
{
|
||||
try {
|
||||
|
||||
|
||||
//Verify data
|
||||
$validator = new Validator();
|
||||
|
||||
@@ -1292,27 +1287,29 @@ class User
|
||||
try {
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsUser($usrUid, $this->arrayFieldNameForException["usrUid"]);
|
||||
|
||||
// Check user admin
|
||||
if (RBAC::isAdminUserUid($usrUid)) {
|
||||
throw new Exception(G::LoadTranslation("ID_MSG_CANNOT_DELETE_USER", [$usrUid]));
|
||||
}
|
||||
// Check user guest
|
||||
if (RBAC::isGuestUserUid($usrUid)) {
|
||||
throw new Exception(G::LoadTranslation("ID_MSG_CANNOT_DELETE_USER", [$usrUid]));
|
||||
}
|
||||
// Check if the user has cases
|
||||
$oProcessMap = new ClassesCases();
|
||||
$USR_UID = $usrUid;
|
||||
$total = 0;
|
||||
$history = 0;
|
||||
$c = $oProcessMap->getCriteriaUsersCases('TO_DO', $USR_UID);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('TO_DO', $usrUid);
|
||||
$total += ApplicationPeer::doCount($c);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('DRAFT', $USR_UID);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('DRAFT', $usrUid);
|
||||
$total += ApplicationPeer::doCount($c);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('COMPLETED', $USR_UID);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('COMPLETED', $usrUid);
|
||||
$history += ApplicationPeer::doCount($c);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $USR_UID);
|
||||
$c = $oProcessMap->getCriteriaUsersCases('CANCELLED', $usrUid);
|
||||
$history += ApplicationPeer::doCount($c);
|
||||
|
||||
//check user guest
|
||||
if (RBAC::isGuestUserUid($usrUid)) {
|
||||
throw new Exception(G::LoadTranslation("ID_MSG_CANNOT_DELETE_USER", array($USR_UID)));
|
||||
}
|
||||
|
||||
if ($total > 0) {
|
||||
throw new Exception(G::LoadTranslation("ID_USER_CAN_NOT_BE_DELETED", array($USR_UID)));
|
||||
throw new Exception(G::LoadTranslation("ID_USER_CAN_NOT_BE_DELETED", [$usrUid]));
|
||||
} else {
|
||||
$UID = $usrUid;
|
||||
$oTasks = new Tasks();
|
||||
@@ -1321,20 +1318,20 @@ class User
|
||||
$oGroups->removeUserOfAllGroups($UID);
|
||||
$this->changeUserStatus($UID, 'CLOSED');
|
||||
$_GET['USR_USERNAME'] = '';
|
||||
$this->updateUser(array('USR_UID' => $UID, 'USR_USERNAME' => $_GET['USR_USERNAME']), '');
|
||||
$this->updateUser(['USR_UID' => $UID, 'USR_USERNAME' => $_GET['USR_USERNAME']], '');
|
||||
require_once(PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Users.php");
|
||||
$oUser = new Users();
|
||||
$aFields = $oUser->load($UID);
|
||||
$aFields['USR_STATUS'] = 'CLOSED';
|
||||
$aFields['USR_USERNAME'] = '';
|
||||
$oUser->update($aFields);
|
||||
//Delete Dashboard
|
||||
// Delete Dashboard
|
||||
require_once(PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "DashletInstance.php");
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(DashletInstancePeer::DAS_INS_OWNER_UID, $UID);
|
||||
$criteria->add(DashletInstancePeer::DAS_INS_OWNER_TYPE, 'USER');
|
||||
DashletInstancePeer::doDelete($criteria);
|
||||
//Destroy session after delete user
|
||||
// Destroy session after delete user
|
||||
RBAC::destroySessionUser($usrUid);
|
||||
(new OauthClients())->removeByUser($usrUid);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ use Cases as ClassesCases;
|
||||
use Exception;
|
||||
use G;
|
||||
use PmDynaform;
|
||||
use ProcessMaker\Model\AdditionalTables as AT;
|
||||
use ProcessMaker\Model\Fields;
|
||||
use ProcessMaker\Model\ProcessVariables;
|
||||
use ProcessMaker\Util\Common;
|
||||
|
||||
@@ -570,18 +572,19 @@ class Variable
|
||||
public function throwExceptionIfVariableIsAssociatedAditionalTable($variableUid)
|
||||
{
|
||||
try {
|
||||
$criteria = new \Criteria('workflow');
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_UID);
|
||||
$criteria->addJoin(\ProcessVariablesPeer::PRJ_UID, \AdditionalTablesPeer::PRO_UID, \Criteria::INNER_JOIN);
|
||||
$arrayCondition = [];
|
||||
$arrayCondition[] = array(\AdditionalTablesPeer::ADD_TAB_UID, \FieldsPeer::ADD_TAB_UID, \Criteria::EQUAL);
|
||||
$arrayCondition[] = array(\ProcessVariablesPeer::VAR_NAME, \FieldsPeer::FLD_NAME, \Criteria::EQUAL);
|
||||
$criteria->addJoinMC($arrayCondition, \Criteria::INNER_JOIN);
|
||||
$criteria->add(\ProcessVariablesPeer::VAR_UID, $variableUid, \Criteria::EQUAL);
|
||||
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
if ($rsCriteria->next()) {
|
||||
throw new Exception(G::LoadTranslation('ID_VARIABLE_ASSOCIATED_WITH_REPORT_TABLE', array($variableUid)));
|
||||
// Get variable name
|
||||
$varInfo = ProcessVariables::getVariable($variableUid);
|
||||
$varName = $varInfo['VAR_NAME'];
|
||||
$proUid = $varInfo['PRJ_UID'];
|
||||
// Get the tables related to the process
|
||||
$tables = AT::getTables($proUid);
|
||||
if (!empty($tables)) {
|
||||
foreach ($tables as $value) {
|
||||
$exist = Fields::searchVariable($value['ADD_TAB_UID'], $varName);
|
||||
if ($exist) {
|
||||
throw new Exception(G::LoadTranslation('ID_VARIABLE_ASSOCIATED_WITH_REPORT_TABLE', [$varName]));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
|
||||
@@ -9,6 +9,7 @@ use Illuminate\Support\Facades\DB;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\Model\Application;
|
||||
use Publisher;
|
||||
use RBAC;
|
||||
use ResultSet;
|
||||
use WebEntryPeer;
|
||||
|
||||
@@ -1101,7 +1102,7 @@ class WebEntry
|
||||
*/
|
||||
public function isWebEntryOne($weUid)
|
||||
{
|
||||
if (!empty($_SESSION['USER_LOGGED']) && empty($_SESSION['__WEBENTRYCONTINUE__'])) {
|
||||
if ($this->verifyCurrentSession()) {
|
||||
global $G_PUBLISH;
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/checkContinueOrCloseSession', '', [], SYS_URI . 'login/checkContinueOrCloseSession');
|
||||
@@ -1116,6 +1117,28 @@ class WebEntry
|
||||
&& $webEntry->getWeCallback() === 'PROCESSMAKER';
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the current sessión exist for display webentry message confirmation.
|
||||
* @return bool
|
||||
*/
|
||||
private function verifyCurrentSession(): bool
|
||||
{
|
||||
//verify normal flow
|
||||
$rule1 = !empty($_SESSION['USER_LOGGED']) && empty($_SESSION['__WEBENTRYCONTINUE__']);
|
||||
|
||||
//verify guest user
|
||||
$rule2 = !empty($_SESSION['USER_LOGGED']);
|
||||
if ($rule2) {
|
||||
//verify is guest user uid.
|
||||
$rule2 = !RBAC::isGuestUserUid($_SESSION['USER_LOGGED']);
|
||||
}
|
||||
|
||||
//verify saml session
|
||||
$rule3 = !(!empty($_SESSION['samlNameId']) && !empty($_SESSION['samlSessionIndex']));
|
||||
|
||||
return $rule1 && $rule2 && $rule3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if a Task is and Web Entry auxiliar task.
|
||||
*
|
||||
|
||||
@@ -31,62 +31,63 @@ class System
|
||||
private static $debug = null;
|
||||
private static $instance;
|
||||
private static $defaultConfig = [
|
||||
'at_risk_delegation_max_time' => '0.2',
|
||||
'code_scanner_scope' => 'import_plugin,enable_plugin,import_process,trigger',
|
||||
'debug' => 0,
|
||||
'debug_sql' => 0,
|
||||
'debug_time' => 0,
|
||||
'debug_calendar' => 0,
|
||||
'wsdl_cache' => 1,
|
||||
'time_zone' => 'America/New_York',
|
||||
'expiration_year' => '1',
|
||||
'memcached' => 0,
|
||||
'memcached_server' => '',
|
||||
'default_skin' => 'neoclassic',
|
||||
'default_lang' => 'en',
|
||||
'delay' => '0',
|
||||
'disable_php_upload_execution' => 0,
|
||||
'disable_download_documents_session_validation' => 0,
|
||||
'disable_advanced_search_case_title_fulltext' => 0,
|
||||
'disable_task_manager_routing_async' => '0',
|
||||
'display_errors' => 'On',
|
||||
'enable_blacklist' => 0,
|
||||
'enable_httponly_flag' => 0,
|
||||
'error_reporting' => '',
|
||||
'expiration_year' => '1',
|
||||
'ext_ajax_timeout' => 600000,
|
||||
'files_white_list' => '',
|
||||
'google_map_api_key' => '',
|
||||
'google_map_signature' => '',
|
||||
'highlight_home_folder_enable' => 0,
|
||||
'highlight_home_folder_refresh_time' => 10,
|
||||
'highlight_home_folder_scope' => 'unassigned', // For now only this list is supported
|
||||
'ie_cookie_lifetime' => 1,
|
||||
'leave_case_warning' => 0,
|
||||
'load_headers_ie' => 0,
|
||||
'logging_level' => 'INFO',
|
||||
'logs_max_files' => 60,
|
||||
'logs_location' => '',
|
||||
'memcached' => 0,
|
||||
'memcached_server' => '',
|
||||
'mobile_offline_tables_download_interval' => 24,
|
||||
'number_log_file' => 5,
|
||||
'on_one_server_enable' => 0,
|
||||
'pmftotalcalculation_floating_point_number' => 10,
|
||||
'proxy_host' => '',
|
||||
'proxy_port' => '',
|
||||
'proxy_user' => '',
|
||||
'proxy_pass' => '',
|
||||
'size_log_file' => 5000000,
|
||||
'number_log_file' => 5,
|
||||
'ie_cookie_lifetime' => 1,
|
||||
'safari_cookie_lifetime' => 1,
|
||||
'error_reporting' => "",
|
||||
'display_errors' => 'On',
|
||||
'enable_blacklist' => 0,
|
||||
'code_scanner_scope' => 'import_plugin,enable_plugin,import_process,trigger',
|
||||
'system_utc_time_zone' => 0,
|
||||
'server_protocol' => '',
|
||||
'leave_case_warning' => 0,
|
||||
'server_hostname_requests_frontend' => '',
|
||||
'load_headers_ie' => 0,
|
||||
'redirect_to_mobile' => 0,
|
||||
'disable_php_upload_execution' => 0,
|
||||
'disable_download_documents_session_validation' => 0,
|
||||
'logs_max_files' => 60,
|
||||
'logs_location' => '',
|
||||
'logging_level' => 'INFO',
|
||||
'smtp_timeout' => 20,
|
||||
'google_map_api_key' => '',
|
||||
'google_map_signature' => '',
|
||||
'upload_attempts_limit_per_user' => '60,1',
|
||||
'files_white_list' => '',
|
||||
'delay' => '0',
|
||||
'tries' => '10',
|
||||
'retry_after' => '90',
|
||||
'mobile_offline_tables_download_interval' => 24,
|
||||
'highlight_home_folder_enable' => 0,
|
||||
'highlight_home_folder_refresh_time' => 10,
|
||||
'highlight_home_folder_scope' => 'unassigned', // For now only this list is supported
|
||||
'disable_advanced_search_case_title_fulltext' => 0,
|
||||
'pmftotalcalculation_floating_point_number' => 10,
|
||||
'report_table_batch_regeneration' => 1000,
|
||||
'report_table_floating_number' => 4,
|
||||
'report_table_double_number' => 4,
|
||||
'ext_ajax_timeout' => 600000,
|
||||
'disable_task_manager_routing_async' => '0',
|
||||
'on_one_server_enable' => 0,
|
||||
'at_risk_delegation_max_time' => '0.2',
|
||||
'samesite_cookie_setting' => ''
|
||||
'report_table_floating_number' => 4,
|
||||
'retry_after' => '90',
|
||||
'samesite_cookie_setting' => '',
|
||||
'safari_cookie_lifetime' => 1,
|
||||
'server_protocol' => '',
|
||||
'server_hostname_requests_frontend' => '',
|
||||
'size_log_file' => 5000000,
|
||||
'smtp_timeout' => 20,
|
||||
'system_utc_time_zone' => 0,
|
||||
'time_zone' => 'America/New_York',
|
||||
'tries' => '10',
|
||||
'upload_attempts_limit_per_user' => '60,1',
|
||||
'wsdl_cache' => 1,
|
||||
];
|
||||
|
||||
public static $cookieDefaultOptions = [
|
||||
@@ -94,7 +95,6 @@ class System
|
||||
'path' => '/',
|
||||
'domain' => '',
|
||||
'secure' => false,
|
||||
'httponly' => true,
|
||||
'samesite' => ''
|
||||
];
|
||||
|
||||
@@ -1819,6 +1819,14 @@ class System
|
||||
// Set the "samesite" option according to the system configuration
|
||||
$cookieOptions['samesite'] = $systemConfiguration['samesite_cookie_setting'];
|
||||
|
||||
// Set the "httponly" option according to the system configuration
|
||||
$httpOnly = $systemConfiguration['enable_httponly_flag'];
|
||||
if ($httpOnly) {
|
||||
$cookieOptions['httponly'] = true;
|
||||
} else {
|
||||
$cookieOptions['httponly'] = false;
|
||||
}
|
||||
|
||||
// Overrides the cookie options with the values sent to the method
|
||||
$cookieOptions = array_merge($cookieOptions, $options);
|
||||
|
||||
|
||||
@@ -32,6 +32,34 @@ class AdditionalTables extends Model
|
||||
return $query->where('ADD_TAB_OFFLINE', '=', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to get the tables related to the process
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param string $proUid
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeProcess($query, string $proUid)
|
||||
{
|
||||
return $query->where('PRO_UID', $proUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tables related to the process
|
||||
*
|
||||
* @param string $proUid
|
||||
* @return array
|
||||
*/
|
||||
public static function getTables(string $proUid)
|
||||
{
|
||||
$query = AdditionalTables::query()->select();
|
||||
$query->process($proUid);
|
||||
$result = $query->get()->values()->toArray();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the structure of offline tables
|
||||
*
|
||||
|
||||
@@ -32,6 +32,39 @@ class Fields extends Model
|
||||
return $query->where('ADD_TAB_UID', '=', $tabUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to get the field name
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param string $name
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeField($query, $name)
|
||||
{
|
||||
return $query->where('FLD_NAME', $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to get the field name or label name
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param string $field
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeFieldOrLabel($query, $field)
|
||||
{
|
||||
$query->where(function ($query) use ($field) {
|
||||
$query->field($field);
|
||||
$fieldLabel = $field . '_label';
|
||||
$query->orWhere(function ($query) use ($fieldLabel) {
|
||||
$query->field($fieldLabel);
|
||||
});
|
||||
});
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the offline tables
|
||||
*
|
||||
@@ -52,4 +85,22 @@ class Fields extends Model
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Search a field related to the table
|
||||
*
|
||||
* @param string $tabUid
|
||||
* @param string $field
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function searchVariable(string $tabUid, string $field)
|
||||
{
|
||||
$query = Fields::query();
|
||||
$query->table($tabUid);
|
||||
$query->fieldOrLabel($field);
|
||||
$result = $query->get()->values()->toArray();
|
||||
|
||||
return !empty($result);
|
||||
}
|
||||
}
|
||||
@@ -87,6 +87,23 @@ class ProcessVariables extends Model
|
||||
return $query->where('VAR_FIELD_TYPE_ID', $typeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the variable information
|
||||
*
|
||||
* @param string $varUid
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getVariable(string $varUid)
|
||||
{
|
||||
$query = ProcessVariables::query()->select();
|
||||
$query->where('VAR_UID', $varUid)->limit(1);
|
||||
$result = $query->get()->values()->toArray();
|
||||
$result = head($result);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the variables list
|
||||
*
|
||||
|
||||
@@ -66,7 +66,7 @@ class Cases extends Api
|
||||
$arrayArgs = $this->restler->apiMethodInfo->arguments;
|
||||
switch ($methodName) {
|
||||
case 'doGetCaseVariables':
|
||||
$applicationUid = $this->parameters[$arrayArgs['app_uid']];
|
||||
$applicationUid = $this->parameters[$arrayArgs['appUid']];
|
||||
$dynaformUid = $this->parameters[$arrayArgs['dyn_uid']];
|
||||
$delIndex = $this->parameters[$arrayArgs['app_index']];
|
||||
$userUid = $this->getUserId();
|
||||
@@ -89,7 +89,7 @@ class Cases extends Api
|
||||
return $cases->checkUserHasPermissionsOrSupervisor($userUid, $applicationUid, $dynaformUid);
|
||||
break;
|
||||
case 'doPutCaseVariables':
|
||||
$applicationUid = $this->parameters[$arrayArgs['app_uid']];
|
||||
$applicationUid = $this->parameters[$arrayArgs['appUid']];
|
||||
$dynaformUid = $this->parameters[$arrayArgs['dyn_uid']];
|
||||
$delIndex = $this->parameters[$arrayArgs['del_index']];
|
||||
$userUid = $this->getUserId();
|
||||
@@ -143,15 +143,15 @@ class Cases extends Api
|
||||
return $user->userCanReassign($usrUid, $arrayApplicationData['PRO_UID']);
|
||||
break;
|
||||
case 'doGetCaseInfo':
|
||||
$appUid = $this->parameters[$arrayArgs['app_uid']];
|
||||
$appUid = $this->parameters[$arrayArgs['appUid']];
|
||||
$usrUid = $this->getUserId();
|
||||
|
||||
$case = new BmCases();
|
||||
$arrayApplicationData = $case->getApplicationRecordByPk($appUid, [], false);
|
||||
if (!empty($arrayApplicationData)) {
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->addSelectColumn(AppDelegationPeer::appUid);
|
||||
$criteria->add(AppDelegationPeer::appUid, $appUid);
|
||||
$criteria->addSelectColumn(AppDelegationPeer::APP_UID);
|
||||
$criteria->add(AppDelegationPeer::APP_UID, $appUid);
|
||||
$criteria->add(AppDelegationPeer::USR_UID, $usrUid);
|
||||
$criteria->setLimit(1);
|
||||
$rsCriteria = AppDelegationPeer::doSelectRS($criteria);
|
||||
|
||||
@@ -6,6 +6,7 @@ use Luracast\Restler\RestException;
|
||||
use ProcessMaker\BusinessModel\Cases\InputDocument as CasesInputDocument;
|
||||
use ProcessMaker\BusinessModel\Cases as BussinessModelCases;
|
||||
use ProcessMaker\Services\Api;
|
||||
use ProcessMaker\Util\DateTime;
|
||||
|
||||
/**
|
||||
* Cases\InputDocument Api Controller
|
||||
@@ -14,6 +15,10 @@ use ProcessMaker\Services\Api;
|
||||
*/
|
||||
class InputDocument extends Api
|
||||
{
|
||||
private $arrayFieldIso8601 = [
|
||||
'app_doc_create_date',
|
||||
'app_doc_create_user',
|
||||
];
|
||||
/**
|
||||
* @url GET /:app_uid/input-documents
|
||||
*
|
||||
@@ -55,7 +60,7 @@ class InputDocument extends Api
|
||||
//Return
|
||||
return $response;
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,11 +74,11 @@ class InputDocument extends Api
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$inputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();
|
||||
$inputDocument = new CasesInputDocument();
|
||||
$response = $inputDocument->getCasesInputDocument($app_uid, $userUid, $inp_doc_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,9 +93,9 @@ class InputDocument extends Api
|
||||
public function doDownloadInputDocument($app_uid, $app_doc_uid, $v = 0)
|
||||
{
|
||||
try {
|
||||
$inputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();
|
||||
$inputDocument = new CasesInputDocument();
|
||||
$inputDocument->downloadInputDocument($app_uid, $app_doc_uid, $v);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -107,12 +112,12 @@ class InputDocument extends Api
|
||||
public function doDeleteInputDocument($app_uid, $del_index, $app_doc_uid)
|
||||
{
|
||||
try {
|
||||
$inputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();
|
||||
$inputDocument = new CasesInputDocument();
|
||||
|
||||
$inputDocument->throwExceptionIfHaventPermissionToDelete($app_uid, $del_index, $this->getUserId(), $app_doc_uid);
|
||||
$inputDocument->throwExceptionIfInputDocumentNotExistsInSteps($app_uid, $del_index, $app_doc_uid);
|
||||
$inputDocument->removeInputDocument($app_doc_uid);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -141,11 +146,11 @@ class InputDocument extends Api
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
|
||||
$inputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();
|
||||
$inputDocument = new CasesInputDocument();
|
||||
$response = $inputDocument->addCasesInputDocument($app_uid, $tas_uid, $app_doc_comment, $inp_doc_uid, $userUid, false);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +167,7 @@ class InputDocument extends Api
|
||||
try {
|
||||
$inputDocument = new CasesInputDocument();
|
||||
$response = $inputDocument->getAllVersionByDocUid($app_uid, $app_doc_uid);
|
||||
return $response;
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
|
||||
@@ -342,6 +342,7 @@ class Home extends Api
|
||||
* @param int $category
|
||||
* @param int $process
|
||||
* @param int $task
|
||||
* @param int $sendBy
|
||||
* @param int $limit
|
||||
* @param int $offset
|
||||
* @param string $caseTitle
|
||||
@@ -349,7 +350,6 @@ class Home extends Api
|
||||
* @param string $delegateTo
|
||||
* @param string $filterCases
|
||||
* @param string $sort
|
||||
* @param string $sendBy
|
||||
* @param array $request_data
|
||||
* @return array
|
||||
* @throws RestException
|
||||
@@ -362,6 +362,7 @@ class Home extends Api
|
||||
int $category = 0,
|
||||
int $process = 0,
|
||||
int $task = 0,
|
||||
int $sendBy = 0,
|
||||
int $limit = 15,
|
||||
int $offset = 0,
|
||||
string $caseTitle = '',
|
||||
@@ -369,7 +370,6 @@ class Home extends Api
|
||||
string $delegateTo = '',
|
||||
string $filterCases = '',
|
||||
string $sort = 'APP_NUMBER,DESC',
|
||||
string $sendBy = '',
|
||||
array $request_data = []
|
||||
)
|
||||
{
|
||||
@@ -404,6 +404,7 @@ class Home extends Api
|
||||
* @param int $category
|
||||
* @param int $process
|
||||
* @param int $task
|
||||
* @param int $sendBy
|
||||
* @param int $limit
|
||||
* @param int $offset
|
||||
* @param string $caseTitle
|
||||
@@ -411,7 +412,6 @@ class Home extends Api
|
||||
* @param string $delegateTo
|
||||
* @param string $filterCases
|
||||
* @param string $sort
|
||||
* @param string $sendBy
|
||||
* @param array $request_data
|
||||
* @return array
|
||||
* @throws RestException
|
||||
@@ -424,6 +424,7 @@ class Home extends Api
|
||||
int $category = 0,
|
||||
int $process = 0,
|
||||
int $task = 0,
|
||||
int $sendBy = 0,
|
||||
int $limit = 15,
|
||||
int $offset = 0,
|
||||
string $caseTitle = '',
|
||||
@@ -431,7 +432,6 @@ class Home extends Api
|
||||
string $delegateTo = '',
|
||||
string $filterCases = '',
|
||||
string $sort = 'APP_NUMBER,DESC',
|
||||
string $sendBy = '',
|
||||
array $request_data = []
|
||||
)
|
||||
{
|
||||
@@ -466,6 +466,7 @@ class Home extends Api
|
||||
* @param int $category
|
||||
* @param int $process
|
||||
* @param int $task
|
||||
* @param int $sendBy
|
||||
* @param int $limit
|
||||
* @param int $offset
|
||||
* @param string $caseTitle
|
||||
@@ -473,7 +474,6 @@ class Home extends Api
|
||||
* @param string $delegateTo
|
||||
* @param string $filterCases
|
||||
* @param string $sort
|
||||
* @param string $sendBy
|
||||
* @param array $request_data
|
||||
* @return array
|
||||
* @throws RestException
|
||||
@@ -486,6 +486,7 @@ class Home extends Api
|
||||
int $category = 0,
|
||||
int $process = 0,
|
||||
int $task = 0,
|
||||
int $sendBy = 0,
|
||||
int $limit = 15,
|
||||
int $offset = 0,
|
||||
string $caseTitle = '',
|
||||
@@ -493,7 +494,6 @@ class Home extends Api
|
||||
string $delegateTo = '',
|
||||
string $filterCases = '',
|
||||
string $sort = 'APP_NUMBER,DESC',
|
||||
string $sendBy = '',
|
||||
array $request_data = []
|
||||
)
|
||||
{
|
||||
@@ -695,10 +695,10 @@ class Home extends Api
|
||||
* @param int $process
|
||||
* @param int $task
|
||||
* @param int $user
|
||||
* @param int $userCompleted
|
||||
* @param int $userStarted
|
||||
* @param int $limit
|
||||
* @param int $offset
|
||||
* @param int $completedBy
|
||||
* @param int $startedBy
|
||||
* @param string $caseTitle
|
||||
* @param string $caseStatuses
|
||||
* @param string $filterCases
|
||||
@@ -721,10 +721,10 @@ class Home extends Api
|
||||
int $process = 0,
|
||||
int $task = 0,
|
||||
int $user = 0,
|
||||
int $userCompleted = 0,
|
||||
int $userStarted = 0,
|
||||
int $limit = 15,
|
||||
int $offset = 0,
|
||||
int $completedBy = 0,
|
||||
int $startedBy = 0,
|
||||
string $caseTitle = '',
|
||||
string $caseStatuses = '',
|
||||
string $filterCases = '',
|
||||
@@ -744,8 +744,8 @@ class Home extends Api
|
||||
$properties['process'] = $process;
|
||||
$properties['task'] = $task;
|
||||
$properties['user'] = $user;
|
||||
$properties['userCompleted'] = $userCompleted;
|
||||
$properties['userStarted'] = $userStarted;
|
||||
$properties['userCompleted'] = $completedBy;
|
||||
$properties['userStarted'] = $startedBy;
|
||||
$properties['caseStatuses'] = explode(',', $caseStatuses);
|
||||
$properties['filterCases'] = $filterCases;
|
||||
$properties['startCaseFrom'] = $startCaseFrom;
|
||||
|
||||
@@ -204,7 +204,7 @@ class Project extends Api
|
||||
\G::auditLog('ExportProcess','Export process "' . $granularExporter->getProjectName() . '"');
|
||||
|
||||
$httpStream->loadFromFile($outputFilename);
|
||||
$httpStream->setHeader("Content-Type", "application/xml; charset=UTF-8");
|
||||
$httpStream->setHeader("Content-Type", "application/$fileExtension");
|
||||
$httpStream->send();
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ class Project extends Api
|
||||
\G::auditLog('ExportProcess','Export process "' . $exporter->getProjectName() . '"');
|
||||
|
||||
$httpStream->loadFromFile($outputFilename);
|
||||
$httpStream->setHeader("Content-Type", "application/xml; charset=UTF-8");
|
||||
$httpStream->setHeader("Content-Type", "application/$fileExtension");
|
||||
$httpStream->send();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
use Exception;
|
||||
use Luracast\Restler\RestException;
|
||||
use ProcessMaker\BusinessModel\User as BmUser;
|
||||
use ProcessMaker\Services\Api;
|
||||
use ProcessMaker\Util\DateTime;
|
||||
|
||||
/**
|
||||
* User Api Controller
|
||||
@@ -21,21 +24,21 @@ class User extends Api
|
||||
* @class AccessControl {@permission PM_USERS,PM_FACTORY}
|
||||
* @url GET
|
||||
*/
|
||||
public function index($filter = null, $lfilter = null, $rfilter = null, $start = null, $limit = null, $status = null)
|
||||
public function index($filter = null, $lfilter = null, $rfilter = null, $start = null, $limit = null, $status = null, $sort = null, $dir = null)
|
||||
{
|
||||
try {
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$user = new BmUser();
|
||||
$user->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$arrayFilterData = array(
|
||||
$arrayFilterData = [
|
||||
"filter" => (!is_null($filter))? $filter : ((!is_null($lfilter))? $lfilter : ((!is_null($rfilter))? $rfilter : null)),
|
||||
"filterOption" => (!is_null($filter))? "" : ((!is_null($lfilter))? "LEFT" : ((!is_null($rfilter))? "RIGHT" : ""))
|
||||
);
|
||||
];
|
||||
|
||||
$response = $user->getUsers($arrayFilterData, null, null, $start, $limit, false, true, $status);
|
||||
$response = $user->getUsers($arrayFilterData, $sort, $dir, $start, $limit, false, true, $status);
|
||||
|
||||
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response['data'], $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
return DateTime::convertUtcToIso8601($response['data'], $this->arrayFieldIso8601);
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -50,13 +53,12 @@ class User extends Api
|
||||
public function doGetUser($usr_uid)
|
||||
{
|
||||
try {
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$user = new BmUser();
|
||||
$user->setFormatFieldNameInUppercase(false);
|
||||
|
||||
$response = $user->getUser($usr_uid);
|
||||
|
||||
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -73,12 +75,13 @@ class User extends Api
|
||||
public function doPostUser($request_data)
|
||||
{
|
||||
try {
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$user = new BmUser();
|
||||
$arrayData = $user->create($request_data);
|
||||
$response = $arrayData;
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,10 +102,10 @@ class User extends Api
|
||||
{
|
||||
try {
|
||||
$userLoggedUid = $this->getUserId();
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$user = new BmUser();
|
||||
$arrayData = $user->update($usr_uid, $request_data, $userLoggedUid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,10 +119,10 @@ class User extends Api
|
||||
public function doDeleteUser($usr_uid)
|
||||
{
|
||||
try {
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$user = new BmUser();
|
||||
$user->delete($usr_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,10 +136,9 @@ class User extends Api
|
||||
public function doPostUserImageUpload($usr_uid)
|
||||
{
|
||||
try {
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$user = new BmUser();
|
||||
$user->uploadImage($usr_uid);
|
||||
} catch (\Exception $e) {
|
||||
//response
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user