HOR-3986
This commit is contained in:
@@ -1,12 +1,4 @@
|
||||
<?php
|
||||
/**
|
||||
* ObjectPermission.php
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
|
||||
//require_once 'classes/model/om/BaseObjectPermission.php';
|
||||
|
||||
/**
|
||||
* Skeleton subclass for representing a row from the 'OBJECT_PERMISSION' table.
|
||||
*
|
||||
@@ -18,6 +10,9 @@
|
||||
*
|
||||
* @package workflow.engine.classes.model
|
||||
*/
|
||||
|
||||
use ProcessMaker\BusinessModel\Cases\InputDocument;
|
||||
|
||||
class ObjectPermission extends BaseObjectPermission
|
||||
{
|
||||
public function load ($UID)
|
||||
@@ -383,9 +378,14 @@ class ObjectPermission extends BaseObjectPermission
|
||||
if ($opObjUid != '' && $opObjUid != '0') {
|
||||
$oCriteria->add(AppDocumentPeer::DOC_UID, $opObjUid);
|
||||
}
|
||||
|
||||
$supervisorDocuments = [];
|
||||
switch ($obType) {
|
||||
case 'INPUT':
|
||||
$oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, 'INPUT');
|
||||
//We will to get the supervisor's documents with index = 100000
|
||||
$inputDocument = new InputDocument();
|
||||
$supervisorDocuments = $inputDocument->getSupervisorDocuments($proUid, $appUid);
|
||||
break;
|
||||
case 'ATTACHED':
|
||||
$oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, 'ATTACHED');
|
||||
@@ -405,6 +405,14 @@ class ObjectPermission extends BaseObjectPermission
|
||||
array_push($result, $aRow['APP_DOC_UID']);
|
||||
}
|
||||
}
|
||||
|
||||
//We will to add the supervisor's documents in the result
|
||||
foreach ($supervisorDocuments as $key => $value) {
|
||||
if (!in_array($value['APP_DOC_UID'], $result)) {
|
||||
array_push($result, $value['APP_DOC_UID']);
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@@ -1140,4 +1140,42 @@ class InputDocument
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function get all the supervisor's documents
|
||||
* When the DEL_INDEX = 100000
|
||||
*
|
||||
* @param string $proUid, uid related to the process
|
||||
* @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($proUid, $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->add(ApplicationPeer::PRO_UID, $proUid);
|
||||
$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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user