Merge remote-tracking branch 'pm/3.1' into HOR-1500
This commit is contained in:
@@ -281,6 +281,127 @@ class OutputDocument
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Ouput Document generated
|
||||
*
|
||||
* @param string $appDocumentUid Unique id of Documents in an Application
|
||||
* @param string $applicationUid Unique id of Case
|
||||
* @param array $arrayVariableNameForException Variable name for exception
|
||||
* @param bool $throwException Flag to throw the exception if the main parameters are invalid or do not exist
|
||||
* (TRUE: throw the exception; FALSE: returns FALSE)
|
||||
*
|
||||
* @return array Returns an array with Ouput Document generated to record, ThrowTheException/FALSE otherwise
|
||||
*/
|
||||
public function getOuputDocumentRecordByPk($appDocumentUid, $applicationUid, array $arrayVariableNameForException, $throwException = true)
|
||||
{
|
||||
$criteria = new \Criteria('workflow');
|
||||
|
||||
$criteria->add(\AppDocumentPeer::APP_DOC_UID, $appDocumentUid, \Criteria::EQUAL);
|
||||
$criteria->add(\AppDocumentPeer::APP_UID, $applicationUid, \Criteria::EQUAL);
|
||||
$criteria->add(\AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT', \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \AppDocumentPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if (!$rsCriteria->next()) {
|
||||
if ($throwException) {
|
||||
throw new \Exception(\G::LoadTranslation('ID_CASE_OUTPUT_DOCUMENT_DOES_NOT_EXIST', [$arrayVariableNameForException['$appDocumentUid'], $appDocumentUid]));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$record = $rsCriteria->getRow();
|
||||
|
||||
//Return
|
||||
return $record;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stream file (OutputDocument)
|
||||
*
|
||||
* @param string $appDocumentUid Unique id of Documents in an Application
|
||||
* @param string $applicationUid Unique id of Case
|
||||
* @param string $extension Extension (pdf, doc)
|
||||
*
|
||||
* @return string Returns a string (string of bytes)
|
||||
*/
|
||||
public function streamFile($appDocumentUid, $applicationUid, $extension)
|
||||
{
|
||||
//Verify data and Set variables
|
||||
$arrayAppDocumentData = $this->getOuputDocumentRecordByPk($appDocumentUid, $applicationUid, ['$appDocumentUid' => '$appDocumentUid']);
|
||||
|
||||
$appDocument = new \AppDocument();
|
||||
|
||||
$appDocument->Fields = $appDocument->load(
|
||||
$appDocumentUid,
|
||||
$appDocument->getLastDocVersion($appDocumentUid, $applicationUid)
|
||||
);
|
||||
|
||||
$outputDocument = \OutputDocumentPeer::retrieveByPK($arrayAppDocumentData['DOC_UID']);
|
||||
$outdocDocGenerate = $outputDocument->getOutDocGenerate();
|
||||
|
||||
$ext = '';
|
||||
|
||||
if (!is_null($extension)) {
|
||||
if (!preg_match('/^(?:PDF|DOC)$/', strtoupper($extension))) {
|
||||
throw new \Exception(\G::LoadTranslation('ID_OUTPUT_DOCUMENT_INVALID_EXTENSION'));
|
||||
}
|
||||
|
||||
if ($outdocDocGenerate != 'BOTH' && strtoupper($extension) != $outdocDocGenerate) {
|
||||
throw new \Exception(\G::LoadTranslation('ID_OUTPUT_DOCUMENT_CONFIG_NOT_SUPPORT_EXTENSION'));
|
||||
}
|
||||
|
||||
$ext = $extension;
|
||||
} else {
|
||||
$ext = ($outdocDocGenerate != 'BOTH')? strtolower($outdocDocGenerate) : 'pdf';
|
||||
}
|
||||
|
||||
//Stream file (OutputDocument)
|
||||
$appDocUid = $appDocument->getAppDocUid();
|
||||
$docUid = $appDocument->Fields['DOC_UID'];
|
||||
|
||||
$outputDocument = new \OutputDocument();
|
||||
|
||||
$outputDocument->Fields = $outputDocument->getByUid($docUid);
|
||||
|
||||
$download = $outputDocument->Fields['OUT_DOC_OPEN_TYPE'];
|
||||
|
||||
$pathInfo = pathinfo($appDocument->getAppDocFilename());
|
||||
|
||||
$extensionDoc = $ext;
|
||||
|
||||
$versionDoc = '_' . $arrayAppDocumentData['DOC_VERSION'];
|
||||
|
||||
$realPath = PATH_DOCUMENT . \G::getPathFromUID($appDocument->Fields['APP_UID']) . '/outdocs/' . $appDocUid . $versionDoc . '.' . $extensionDoc;
|
||||
$realPath1 = PATH_DOCUMENT . \G::getPathFromUID($appDocument->Fields['APP_UID']) . '/outdocs/' . $pathInfo['basename'] . $versionDoc . '.' . $extensionDoc;
|
||||
$realPath2 = PATH_DOCUMENT . \G::getPathFromUID($appDocument->Fields['APP_UID']) . '/outdocs/' . $pathInfo['basename'] . '.' . $extensionDoc;
|
||||
|
||||
$flagFileExists = false;
|
||||
|
||||
if (file_exists($realPath)) {
|
||||
$flagFileExists = true;
|
||||
} else {
|
||||
if (file_exists($realPath1)) {
|
||||
$flagFileExists = true;
|
||||
$realPath = $realPath1;
|
||||
} else {
|
||||
if (file_exists($realPath2)) {
|
||||
$flagFileExists = true;
|
||||
$realPath = $realPath2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($flagFileExists) {
|
||||
$nameFile = $pathInfo['basename'] . $versionDoc . '.' . $extensionDoc;
|
||||
|
||||
\G::streamFile($realPath, true, $nameFile); //download
|
||||
} else {
|
||||
throw new \Exception(\G::LoadTranslation('ID_NOT_EXISTS_FILE'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete OutputDocument
|
||||
*
|
||||
@@ -820,5 +941,69 @@ class OutputDocument
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check of user has permission of process
|
||||
*
|
||||
* @param string $applicationUid Unique id of Case
|
||||
* @param string $delIndex Delegation index
|
||||
* @param string $userUid Unique id of User
|
||||
* @param string $appDocumentUid Unique id of Documents in an Application
|
||||
* @param string $action
|
||||
*
|
||||
* @return bool Return
|
||||
*/
|
||||
public function checkProcessPermission($applicationUid, $delIndex, $userUid, $appDocumentUid, $action = 'VIEW')
|
||||
{
|
||||
$delIndex = (!is_null($delIndex))? $delIndex : 0;
|
||||
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$arrayApplicationData = $case->getApplicationRecordByPk($applicationUid, [], false);
|
||||
|
||||
$processUid = $arrayApplicationData['PRO_UID'];
|
||||
|
||||
$case = new \Cases();
|
||||
$arrayAllObjectsFrom = $case->getAllObjectsFrom($processUid, $applicationUid, null, $userUid, $action, $delIndex);
|
||||
|
||||
if (array_key_exists('OUTPUT_DOCUMENTS', $arrayAllObjectsFrom) && !empty($arrayAllObjectsFrom['OUTPUT_DOCUMENTS'])) {
|
||||
foreach($arrayAllObjectsFrom['OUTPUT_DOCUMENTS'] as $value) {
|
||||
if ($value == $appDocumentUid) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Return
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check of user
|
||||
*
|
||||
* @param string $applicationUid Unique id of Case
|
||||
* @param string $appDocumentUid Unique id of Documents in an Application
|
||||
* @param string $userUid Unique id of User
|
||||
*
|
||||
* @return bool Return
|
||||
*/
|
||||
public function checkUser($applicationUid, $appDocumentUid, $userUid)
|
||||
{
|
||||
$criteria = new \Criteria('workflow');
|
||||
|
||||
$criteria->addSelectColumn(\AppDocumentPeer::DOC_UID);
|
||||
|
||||
$criteria->add(\AppDocumentPeer::APP_UID, $applicationUid, \Criteria::EQUAL);
|
||||
$criteria->add(\AppDocumentPeer::APP_DOC_UID, $appDocumentUid, \Criteria::EQUAL);
|
||||
$criteria->add(\AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT', \Criteria::EQUAL);
|
||||
$criteria->add(\AppDocumentPeer::USR_UID, $userUid, \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \AppDocumentPeer::doSelectRS($criteria);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//Return
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1106,4 +1106,20 @@ class Consolidated
|
||||
|
||||
$oCase->updateCase($appUid, $aData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $usrUid
|
||||
* @return int
|
||||
*/
|
||||
public function getCountList($usrUid)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->add(\CaseConsolidatedCorePeer::CON_STATUS, 'ACTIVE');
|
||||
$criteria->addJoin(\CaseConsolidatedCorePeer::TAS_UID, \AppCacheViewPeer::TAS_UID, Criteria::LEFT_JOIN);
|
||||
$criteria->add(\AppCacheViewPeer::USR_UID, $usrUid);
|
||||
$criteria->add(\AppCacheViewPeer::DEL_THREAD_STATUS, 'OPEN');
|
||||
$criteria->add(\AppCacheViewPeer::APP_STATUS, 'TO_DO');
|
||||
$total = \CaseConsolidatedCorePeer::doCount($criteria);
|
||||
return (int)$total;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,74 @@ use \UsersPeer;
|
||||
*/
|
||||
class Lists {
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $mapList;
|
||||
/**
|
||||
* @var \ListInbox
|
||||
*/
|
||||
private $ListInbox;
|
||||
/**
|
||||
* @var \ListInbox
|
||||
*/
|
||||
private $ListDraft;
|
||||
/**
|
||||
* @var \ListCanceled
|
||||
*/
|
||||
private $ListCanceled;
|
||||
/**
|
||||
* @var \ListParticipatedLast
|
||||
*/
|
||||
private $ListParticipated;
|
||||
/**
|
||||
* @var \ListPaused
|
||||
*/
|
||||
private $ListPaused;
|
||||
/**
|
||||
* @var \ListCompleted
|
||||
*/
|
||||
private $ListCompleted;
|
||||
/**
|
||||
* @var Consolidated
|
||||
*/
|
||||
private $ListConsolidated;
|
||||
/**
|
||||
* @var \ListUnassigned
|
||||
*/
|
||||
private $ListSelfService;
|
||||
|
||||
/**
|
||||
* Lists constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->mapList = array(
|
||||
'ListInbox' => 'CASES_INBOX',
|
||||
'ListDraft' => 'CASES_DRAFT',
|
||||
'ListCanceled' => 'CASES_CANCELLED',
|
||||
'ListParticipated' => 'CASES_SENT',
|
||||
'ListPaused' => 'CASES_PAUSED',
|
||||
'ListCompleted' => 'CASES_COMPLETED',
|
||||
/*----------------------------------********---------------------------------*/
|
||||
'ListConsolidated' => 'CONSOLIDATED_CASES',
|
||||
/*----------------------------------********---------------------------------*/
|
||||
'ListSelfService' => 'CASES_SELFSERVICE'
|
||||
);
|
||||
|
||||
$this->ListInbox = new \ListInbox();
|
||||
$this->ListDraft = new \ListInbox();
|
||||
$this->ListCanceled = new \ListCanceled();
|
||||
$this->ListParticipated = new \ListParticipatedLast();
|
||||
$this->ListPaused = new \ListPaused();
|
||||
$this->ListCompleted = new \ListCompleted();
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$this->ListConsolidated = new Consolidated();
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$this->ListSelfService = new \ListUnassigned();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get list for Cases
|
||||
*
|
||||
@@ -190,56 +258,34 @@ class Lists {
|
||||
|
||||
/**
|
||||
* Get counters for lists
|
||||
*
|
||||
* @access public
|
||||
* @param array $userId, User Uid
|
||||
* @param $userId
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function getCounters($userId)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_INBOX);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_DRAFT);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_CANCELLED);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_PARTICIPATED);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_PAUSED);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_COMPLETED);
|
||||
$criteria->add( UsersPeer::USR_UID, $userId, Criteria::EQUAL );
|
||||
$dataset = UsersPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
$aRow = $dataset->getRow();
|
||||
|
||||
$oAppCache = new \AppCacheView();
|
||||
$totalUnassigned = $oAppCache->getListCounters('selfservice', $userId, false);
|
||||
|
||||
$response = array(
|
||||
array('count' => $aRow['USR_TOTAL_INBOX'], 'item' => 'CASES_INBOX'),
|
||||
array('count' => $aRow['USR_TOTAL_DRAFT'], 'item' => 'CASES_DRAFT'),
|
||||
array('count' => $aRow['USR_TOTAL_CANCELLED'], 'item' => 'CASES_CANCELLED'),
|
||||
array('count' => $aRow['USR_TOTAL_PARTICIPATED'], 'item' => 'CASES_SENT'),
|
||||
array('count' => $aRow['USR_TOTAL_PAUSED'], 'item' => 'CASES_PAUSED'),
|
||||
array('count' => $aRow['USR_TOTAL_COMPLETED'], 'item' => 'CASES_COMPLETED'),
|
||||
array('count' => $totalUnassigned, 'item' => 'CASES_SELFSERVICE')
|
||||
);
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$licensedFeatures = & \PMLicensedFeatures::getSingleton();
|
||||
if ($licensedFeatures->verifyfeature('7TTeDBQeWRoZTZKYjh4eFpYUlRDUUEyVERPU3FxellWank=')) {
|
||||
$criteria = new Criteria();
|
||||
$criteria->add(\CaseConsolidatedCorePeer::CON_STATUS, 'ACTIVE');
|
||||
$criteria->addJoin(\CaseConsolidatedCorePeer::TAS_UID, \AppCacheViewPeer::TAS_UID, Criteria::LEFT_JOIN);
|
||||
$criteria->add(\AppCacheViewPeer::USR_UID, $userId);
|
||||
$criteria->add(\AppCacheViewPeer::DEL_THREAD_STATUS, 'OPEN');
|
||||
$criteria->add(\AppCacheViewPeer::APP_STATUS, 'TO_DO');
|
||||
$total = \CaseConsolidatedCorePeer::doCount( $criteria );
|
||||
$response[] = array('count' => $total, 'item' => 'CONSOLIDATED_CASES');
|
||||
$list = $this->mapList;
|
||||
$response = array();
|
||||
foreach ($list as $listObject => $item) {
|
||||
switch ($listObject) {
|
||||
case 'ListInbox':
|
||||
$total = $this->$listObject->getCountList($userId, 'TO_DO');
|
||||
array_push($response, (array('count' => $total, 'item' => $item)));
|
||||
break;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
case 'ListConsolidated':
|
||||
$licensedFeatures = &\PMLicensedFeatures::getSingleton();
|
||||
if ($licensedFeatures->verifyfeature('7TTeDBQeWRoZTZKYjh4eFpYUlRDUUEyVERPU3FxellWank=')) {
|
||||
$total = $this->$listObject->getCountList($userId);
|
||||
array_push($response, (array('count' => $total, 'item' => $item)));
|
||||
}
|
||||
break;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
default:
|
||||
$totalInbox = $this->$listObject->getCountList($userId);
|
||||
array_push($response, (array('count' => $totalInbox, 'item' => $item)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -201,6 +201,26 @@ class ScriptTask
|
||||
if ($obj->getActTaskType() != "SCRIPTTASK") {
|
||||
throw new \Exception(\G::LoadTranslation("ID_SCRIPT_TASK_TYPE_ACTIVITY_NOT_IS_SCRIPTTASK", array($this->arrayFieldNameForException["actUid"], $arrayData["ACT_UID"])));
|
||||
}
|
||||
|
||||
//Activity - Already registered
|
||||
$criteria = new \Criteria('workflow');
|
||||
$criteria->addSelectColumn(\ScriptTaskPeer::SCRTAS_UID);
|
||||
|
||||
if ($scriptTaskUid != '') {
|
||||
$criteria->add(\ScriptTaskPeer::SCRTAS_UID, $scriptTaskUid, \Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
$criteria->add(\ScriptTaskPeer::PRJ_UID, $projectUid, \Criteria::EQUAL);
|
||||
$criteria->add(\ScriptTaskPeer::ACT_UID, $arrayFinalData['ACT_UID'], \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \ScriptTaskPeer::doSelectRS($criteria);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
throw new \Exception(\G::LoadTranslation(
|
||||
'ID_SCRIPT_TASK_ACTIVITY_ALREADY_REGISTERED',
|
||||
[$this->arrayFieldNameForException['actUid'], $arrayFinalData['ACT_UID']]
|
||||
));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
@@ -452,13 +452,6 @@ class User
|
||||
$arrayResult[$this->getFieldNameByFormatFieldName('USR_COST_BY_HOUR')] = $record['USR_COST_BY_HOUR'];
|
||||
$arrayResult[$this->getFieldNameByFormatFieldName('USR_UNIT_COST')] = $record['USR_UNIT_COST'];
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_INBOX')] = $record['USR_TOTAL_INBOX'];
|
||||
$arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_DRAFT')] = $record['USR_TOTAL_DRAFT'];
|
||||
$arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_CANCELLED')] = $record['USR_TOTAL_CANCELLED'];
|
||||
$arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_PARTICIPATED')] = $record['USR_TOTAL_PARTICIPATED'];
|
||||
$arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_PAUSED')] = $record['USR_TOTAL_PAUSED'];
|
||||
$arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_COMPLETED')] = $record['USR_TOTAL_COMPLETED'];
|
||||
$arrayResult[$this->getFieldNameByFormatFieldName('USR_TOTAL_UNASSIGNED')] = $record['USR_TOTAL_UNASSIGNED'];
|
||||
$arrayResult[$this->getFieldNameByFormatFieldName('USR_PHOTO_PATH')] = $pathPhotoUser;
|
||||
|
||||
if (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) {
|
||||
@@ -512,13 +505,6 @@ class User
|
||||
$criteria->addSelectColumn(\UsersPeer::USR_COST_BY_HOUR);
|
||||
$criteria->addSelectColumn(\UsersPeer::USR_UNIT_COST);
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$criteria->addSelectColumn(\UsersPeer::USR_TOTAL_INBOX);
|
||||
$criteria->addSelectColumn(\UsersPeer::USR_TOTAL_DRAFT);
|
||||
$criteria->addSelectColumn(\UsersPeer::USR_TOTAL_CANCELLED);
|
||||
$criteria->addSelectColumn(\UsersPeer::USR_TOTAL_PARTICIPATED);
|
||||
$criteria->addSelectColumn(\UsersPeer::USR_TOTAL_PAUSED);
|
||||
$criteria->addSelectColumn(\UsersPeer::USR_TOTAL_COMPLETED);
|
||||
$criteria->addSelectColumn(\UsersPeer::USR_TOTAL_UNASSIGNED);
|
||||
$criteria->addSelectColumn(\UsersPeer::USR_TIME_ZONE);
|
||||
|
||||
//Return
|
||||
|
||||
@@ -209,7 +209,6 @@ abstract class Importer
|
||||
}
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$name = $this->currentProcessTitle;
|
||||
$generateUid = false;
|
||||
break;
|
||||
case self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW:
|
||||
|
||||
@@ -11,6 +11,53 @@ use \Luracast\Restler\RestException;
|
||||
*/
|
||||
class OutputDocument extends Api
|
||||
{
|
||||
public function __isAllowed()
|
||||
{
|
||||
try {
|
||||
$methodName = $this->restler->apiMethodInfo->methodName;
|
||||
$arrayArgs = $this->restler->apiMethodInfo->arguments;
|
||||
|
||||
switch ($methodName) {
|
||||
case 'doGetOutputDocumentFile':
|
||||
$applicationUid = $this->parameters[$arrayArgs['app_uid']];
|
||||
$appDocumentUid = $this->parameters[$arrayArgs['app_doc_uid']];
|
||||
$userUid = $this->getUserId();
|
||||
|
||||
//Check whether the process supervisor
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$arrayApplicationData = $case->getApplicationRecordByPk($applicationUid, [], false);
|
||||
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$flagps = $supervisor->isUserProcessSupervisor($arrayApplicationData['PRO_UID'], $userUid);
|
||||
|
||||
if ($flagps) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//Verify if you have permissions of the process
|
||||
$outputDocument = new \ProcessMaker\BusinessModel\Cases\OutputDocument();
|
||||
$flagpp = $outputDocument->checkProcessPermission($applicationUid, null, $userUid, $appDocumentUid, 'VIEW');
|
||||
|
||||
if ($flagpp) {
|
||||
return true;
|
||||
}
|
||||
|
||||
//Check whether the user has created the output document
|
||||
$flaguser = $outputDocument->checkUser($applicationUid, $appDocumentUid, $userUid);
|
||||
|
||||
if ($flaguser) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//Return
|
||||
return false;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:app_uid/output-documents
|
||||
*
|
||||
@@ -46,6 +93,28 @@ class OutputDocument extends Api
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:app_uid/output-document/:app_doc_uid/file
|
||||
*
|
||||
* @access protected
|
||||
* @class AccessControl {@className \ProcessMaker\Services\Api\Cases\OutputDocument}
|
||||
*
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
* @param string $app_doc_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetOutputDocumentFile($app_uid, $app_doc_uid, $extension = null)
|
||||
{
|
||||
try {
|
||||
$caseOutdoc = new \ProcessMaker\BusinessModel\Cases\OutputDocument();
|
||||
$response = $caseOutdoc->streamFile($app_doc_uid, $app_uid, $extension);
|
||||
|
||||
//Return
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:app_uid/output-document/:app_doc_uid
|
||||
*
|
||||
|
||||
@@ -144,8 +144,9 @@ class Consolidated extends Api
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url POST /derivate/:app_uid/:app_number/:del_index/:field_grid/:field_grid_val
|
||||
* @url POST /derivate/:app_uid/:app_number/:del_index/:field_grid/
|
||||
*/
|
||||
public function doPostDerivate($app_uid, $app_number, $del_index, $field_grid, $field_grid_val)
|
||||
public function doPostDerivate($app_uid, $app_number, $del_index, $field_grid, $field_grid_val = '')
|
||||
{
|
||||
try {
|
||||
$usr_uid = $this->getUserId();
|
||||
|
||||
@@ -636,9 +636,11 @@ class Light extends Api
|
||||
{
|
||||
$response = array();
|
||||
foreach ($data as $field => $d) {
|
||||
$field = preg_quote($field);
|
||||
if (is_array($d)) {
|
||||
$newData = array();
|
||||
foreach ($d as $field => $value) {
|
||||
$field = preg_quote($field);
|
||||
if (
|
||||
preg_match(
|
||||
'/\|(' . $field . ')\|/i',
|
||||
@@ -1011,7 +1013,7 @@ class Light extends Api
|
||||
*
|
||||
* @param string $tas_uid {@min 32}{@max 32}
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
* @param string $del_index
|
||||
* @param int $del_index
|
||||
*/
|
||||
public function doGetPrepareInformation($tas_uid, $app_uid, $del_index = null)
|
||||
{
|
||||
@@ -1030,7 +1032,7 @@ class Light extends Api
|
||||
* @url PUT /cases/:app_uid/route-case
|
||||
*
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
* @param string $del_index {@from body}
|
||||
* @param int $del_index {@from body}
|
||||
* @param array $tasks {@from body}
|
||||
*/
|
||||
public function doPutRouteCase($app_uid, $del_index = null, $tasks = array())
|
||||
@@ -1591,7 +1593,7 @@ class Light extends Api
|
||||
* @access public
|
||||
* @url GET /config
|
||||
*
|
||||
* @param string $fileLimit {@from path}
|
||||
* @param boolean $fileLimit {@from path}
|
||||
*/
|
||||
public function getConfiguration($fileLimit = false)
|
||||
{
|
||||
@@ -1612,8 +1614,8 @@ class Light extends Api
|
||||
*
|
||||
* @url GET /config-user
|
||||
*
|
||||
* @param string $fileLimit {@from path}
|
||||
* @param string $tz {@from path}
|
||||
* @param boolean $fileLimit {@from path}
|
||||
* @param boolean $tz {@from path}
|
||||
*/
|
||||
public function getConfigurationUser($fileLimit = false, $tz = false)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user