HOR-4921
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Cases;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
use ProcessMaker\BusinessModel\Cases\InputDocument AS CasesInputDocument;
|
||||
use Exception;
|
||||
use Luracast\Restler\RestException;
|
||||
use ProcessMaker\BusinessModel\Cases\InputDocument as CasesInputDocument;
|
||||
use ProcessMaker\BusinessModel\Cases as BussinessModelCases;
|
||||
use ProcessMaker\Services\Api;
|
||||
|
||||
/**
|
||||
* Cases\InputDocument Api Controller
|
||||
@@ -16,23 +17,44 @@ class InputDocument extends Api
|
||||
/**
|
||||
* @url GET /:app_uid/input-documents
|
||||
*
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
*
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*/
|
||||
public function doGetInputDocuments($app_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
$inputDocument = new \ProcessMaker\BusinessModel\Cases\InputDocument();
|
||||
//We will to get list of documents that the user can be access
|
||||
$bmCases = new BussinessModelCases();
|
||||
$arrayApplicationData = $bmCases->getApplicationRecordByPk($app_uid, [], false);
|
||||
$userAuthorization = $bmCases->userAuthorization(
|
||||
$userUid,
|
||||
$arrayApplicationData['PRO_UID'],
|
||||
$app_uid,
|
||||
[],
|
||||
['INPUT_DOCUMENTS' => 'VIEW', 'ATTACHMENTS' => 'VIEW'],
|
||||
true
|
||||
);
|
||||
$documentsCanAccess = array_merge(
|
||||
$userAuthorization['objectPermissions']['INPUT_DOCUMENTS'],
|
||||
$userAuthorization['objectPermissions']['ATTACHMENTS']
|
||||
);
|
||||
|
||||
$response = $inputDocument->getCasesInputDocuments($app_uid, $userUid);
|
||||
//We will to get documents information that the user uploaded and/or that the user has permission
|
||||
$inputDocument = new CasesInputDocument();
|
||||
//@todo we need to review the function getCasesInputDocuments with the ticket HOR-4755
|
||||
$response = $inputDocument->getCasesInputDocuments($app_uid, $userUid, $documentsCanAccess);
|
||||
|
||||
if (empty($response)) {
|
||||
//If the user is a supervisor we will to get the documents can be access
|
||||
if (empty($response) && $userAuthorization['supervisor']) {
|
||||
$response = $inputDocument->getCasesInputDocumentsBySupervisor($app_uid, $userUid);
|
||||
}
|
||||
|
||||
//Return
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,28 +2,31 @@
|
||||
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use AppDelegation;
|
||||
use Bootstrap;
|
||||
use Cases as ClassesCases;
|
||||
use Criteria;
|
||||
use Exception;
|
||||
use G;
|
||||
use Luracast\Restler\RestException;
|
||||
use PmDynaform;
|
||||
use Process as ModelProcess;
|
||||
use ProcessMaker\BusinessModel\Cases as BusinessModelCases;
|
||||
use ProcessMaker\BusinessModel\DynaForm as BusinessModelDynaForm;
|
||||
use ProcessMaker\BusinessModel\Light as BusinessModelLight;
|
||||
use ProcessMaker\BusinessModel\Lists;
|
||||
use ProcessMaker\BusinessModel\Process;
|
||||
use ProcessMaker\BusinessModel\ProcessMap;
|
||||
use ProcessMaker\BusinessModel\Task;
|
||||
use ProcessMaker\BusinessModel\Validator;
|
||||
use ProcessMaker\Project\Adapter;
|
||||
use ProcessMaker\Services\Api;
|
||||
use Luracast\Restler\RestException;
|
||||
use ProcessMaker\BusinessModel\Validator;
|
||||
use ProcessMaker\Services\Api\Project\Activity\Step;
|
||||
use ProcessMaker\Util\DateTime;
|
||||
use PmDynaform;
|
||||
use Exception;
|
||||
use ProcessMaker\BusinessModel\Light as BusinessModelLight;
|
||||
use RBAC;
|
||||
use ProcessMaker\BusinessModel\Cases as BusinessModelCases;
|
||||
use Cases as ClassesCases;
|
||||
use AppDelegation;
|
||||
use ProcessMaker\BusinessModel\Lists;
|
||||
use ProcessMaker\BusinessModel\Task;
|
||||
use ProcessMaker\BusinessModel\ProcessMap;
|
||||
use ProcessMaker\BusinessModel\Process;
|
||||
use Criteria;
|
||||
use StepPeer;
|
||||
use stdclass;
|
||||
use ProcessMaker\BusinessModel\DynaForm as BusinessModelDynaForm;
|
||||
use StepPeer;
|
||||
|
||||
/**
|
||||
*
|
||||
* Process Api Controller
|
||||
@@ -921,41 +924,57 @@ class Light extends Api
|
||||
}
|
||||
|
||||
/**
|
||||
* Get steps related to the task
|
||||
* If the process is classic we does not return any step, this is not supported by Mobile
|
||||
*
|
||||
* @url GET /project/:prj_uid/activity/:act_uid/steps
|
||||
*
|
||||
* @param string $act_uid {@min 32}{@max 32}
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function doGetActivitySteps($act_uid, $prj_uid)
|
||||
{
|
||||
try {
|
||||
$task = new Task();
|
||||
$task->setFormatFieldNameInUppercase(false);
|
||||
$task->setArrayParamException(array("taskUid" => "act_uid", "stepUid" => "step_uid"));
|
||||
$response = [];
|
||||
$process = new ModelProcess();
|
||||
$isBpmn = $process->isBpmnProcess($prj_uid);
|
||||
if ($isBpmn) {
|
||||
$task = new Task();
|
||||
$dynaForm = new BusinessModelDynaForm();
|
||||
$mobile = new BusinessModelLight();
|
||||
$step = new Step();
|
||||
|
||||
$activitySteps = $task->getSteps($act_uid);
|
||||
$_SESSION['PROCESS'] = $prj_uid;
|
||||
$dynaForm = new BusinessModelDynaForm();
|
||||
$dynaForm->setFormatFieldNameInUppercase(false);
|
||||
$oMobile = new BusinessModelLight();
|
||||
$step = new \ProcessMaker\Services\Api\Project\Activity\Step();
|
||||
$response = array();
|
||||
for ($i = 0; $i < count($activitySteps); $i++) {
|
||||
if ($activitySteps[$i]['step_type_obj'] == "DYNAFORM") {
|
||||
$dataForm = $dynaForm->getDynaForm($activitySteps[$i]['step_uid_obj']);
|
||||
$result = $this->parserDataDynaForm($dataForm);
|
||||
$result["formUpdateDate"] = DateTime::convertUtcToIso8601($result["formUpdateDate"]);
|
||||
$result['index'] = $i;
|
||||
$result['stepId'] = $activitySteps[$i]["step_uid"];
|
||||
$result['stepUidObj'] = $activitySteps[$i]["step_uid_obj"];
|
||||
$result['stepMode'] = $activitySteps[$i]['step_mode'];
|
||||
$result['stepCondition'] = $activitySteps[$i]['step_condition'];
|
||||
$result['stepPosition'] = $activitySteps[$i]['step_position'];
|
||||
$trigger = $oMobile->statusTriggers($step->doGetActivityStepTriggers($activitySteps[$i]["step_uid"],
|
||||
$act_uid, $prj_uid));
|
||||
$result["triggers"] = $trigger;
|
||||
unset($result["formContent"]);
|
||||
$response[] = $result;
|
||||
$task->setFormatFieldNameInUppercase(false);
|
||||
$task->setArrayParamException(["taskUid" => "act_uid", "stepUid" => "step_uid"]);
|
||||
$activitySteps = $task->getSteps($act_uid);
|
||||
$_SESSION['PROCESS'] = $prj_uid;
|
||||
$dynaForm->setFormatFieldNameInUppercase(false);
|
||||
|
||||
for ($i = 0; $i < count($activitySteps); $i++) {
|
||||
if ($activitySteps[$i]['step_type_obj'] == "DYNAFORM") {
|
||||
$dataForm = $dynaForm->getDynaForm($activitySteps[$i]['step_uid_obj']);
|
||||
$result = $this->parserDataDynaForm($dataForm);
|
||||
$result["formUpdateDate"] = DateTime::convertUtcToIso8601($result["formUpdateDate"]);
|
||||
$result['index'] = $i;
|
||||
$result['stepId'] = $activitySteps[$i]["step_uid"];
|
||||
$result['stepUidObj'] = $activitySteps[$i]["step_uid_obj"];
|
||||
$result['stepMode'] = $activitySteps[$i]['step_mode'];
|
||||
$result['stepCondition'] = $activitySteps[$i]['step_condition'];
|
||||
$result['stepPosition'] = $activitySteps[$i]['step_position'];
|
||||
$trigger = $mobile->statusTriggers(
|
||||
$step->doGetActivityStepTriggers(
|
||||
$activitySteps[$i]["step_uid"],
|
||||
$act_uid,
|
||||
$prj_uid
|
||||
)
|
||||
);
|
||||
$result["triggers"] = $trigger;
|
||||
unset($result["formContent"]);
|
||||
$response[] = $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
use Exception;
|
||||
use Luracast\Restler\RestException;
|
||||
use ProcessMaker\BusinessModel\Table as BusinessModelTable;
|
||||
use ProcessMaker\Services\Api;
|
||||
|
||||
/**
|
||||
* Pmtable Api Controller
|
||||
@@ -149,6 +151,7 @@ class Pmtable extends Api
|
||||
*
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_SETUP_PM_TABLES}
|
||||
* @throws RestException
|
||||
*/
|
||||
public function doPutPmTable(
|
||||
$pmt_uid,
|
||||
@@ -156,9 +159,9 @@ class Pmtable extends Api
|
||||
) {
|
||||
try {
|
||||
$request_data['pmt_uid'] = $pmt_uid;
|
||||
$oReportTable = new \ProcessMaker\BusinessModel\Table();
|
||||
$response = $oReportTable->updateTable($request_data);
|
||||
} catch (\Exception $e) {
|
||||
$pmTable = new BusinessModelTable();
|
||||
$response = $pmTable->updateTable($request_data);
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user