Resolve conflict
This commit is contained in:
@@ -519,6 +519,7 @@ class WebApplication
|
|||||||
define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']);
|
define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']);
|
||||||
define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']);
|
define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']);
|
||||||
define('SYS_SKIN', $arraySystemConfiguration['default_skin']);
|
define('SYS_SKIN', $arraySystemConfiguration['default_skin']);
|
||||||
|
define('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION', $arraySystemConfiguration['disable_download_documents_session_validation']);
|
||||||
|
|
||||||
require_once(PATH_DB . SYS_SYS . "/db.php");
|
require_once(PATH_DB . SYS_SYS . "/db.php");
|
||||||
|
|
||||||
|
|||||||
@@ -5717,13 +5717,13 @@ class Cases
|
|||||||
*/
|
*/
|
||||||
public function getAllObjectsFrom($proUid, $appUid, $tasUid = '', $usrUid = '', $action = '', $delIndex = 0)
|
public function getAllObjectsFrom($proUid, $appUid, $tasUid = '', $usrUid = '', $action = '', $delIndex = 0)
|
||||||
{
|
{
|
||||||
$aCase = $this->loadCase($appUid);
|
$caseData = $this->loadCase($appUid);
|
||||||
|
|
||||||
if ($delIndex != 0) {
|
if ($delIndex != 0) {
|
||||||
$appDelay = new AppDelay();
|
$appDelay = new AppDelay();
|
||||||
|
|
||||||
if ($appDelay->isPaused($appUid, $delIndex)) {
|
if ($appDelay->isPaused($appUid, $delIndex)) {
|
||||||
$aCase["APP_STATUS"] = "PAUSED";
|
$caseData["APP_STATUS"] = "PAUSED";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5742,8 +5742,8 @@ class Cases
|
|||||||
);
|
);
|
||||||
|
|
||||||
$oObjectPermission = new ObjectPermission();
|
$oObjectPermission = new ObjectPermission();
|
||||||
$userPermissions = $oObjectPermission->verifyObjectPermissionPerUser($usrUid, $proUid, $tasUid, $action, $aCase);
|
$userPermissions = $oObjectPermission->verifyObjectPermissionPerUser($usrUid, $proUid, $tasUid, $action, $caseData);
|
||||||
$groupPermissions = $oObjectPermission->verifyObjectPermissionPerGroup($usrUid, $proUid, $tasUid, $action, $aCase);
|
$groupPermissions = $oObjectPermission->verifyObjectPermissionPerGroup($usrUid, $proUid, $tasUid, $action, $caseData);
|
||||||
$permissions = array_merge($userPermissions, $groupPermissions);
|
$permissions = array_merge($userPermissions, $groupPermissions);
|
||||||
|
|
||||||
foreach ($permissions as $row) {
|
foreach ($permissions as $row) {
|
||||||
@@ -5783,7 +5783,7 @@ class Cases
|
|||||||
$appUid,
|
$appUid,
|
||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
$opObjUid,
|
$opObjUid,
|
||||||
$aCase['APP_STATUS']
|
$caseData['APP_STATUS']
|
||||||
);
|
);
|
||||||
//For Ouputs
|
//For Ouputs
|
||||||
$result['OUTPUT'] = $oObjectPermission->objectPermissionByOutputInput(
|
$result['OUTPUT'] = $oObjectPermission->objectPermissionByOutputInput(
|
||||||
@@ -5792,7 +5792,7 @@ class Cases
|
|||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
'OUTPUT',
|
'OUTPUT',
|
||||||
$opObjUid,
|
$opObjUid,
|
||||||
$aCase['APP_STATUS']
|
$caseData['APP_STATUS']
|
||||||
);
|
);
|
||||||
//For Inputs
|
//For Inputs
|
||||||
$result['INPUT'] = $oObjectPermission->objectPermissionByOutputInput(
|
$result['INPUT'] = $oObjectPermission->objectPermissionByOutputInput(
|
||||||
@@ -5801,7 +5801,7 @@ class Cases
|
|||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
'INPUT',
|
'INPUT',
|
||||||
$opObjUid,
|
$opObjUid,
|
||||||
$aCase['APP_STATUS']
|
$caseData['APP_STATUS']
|
||||||
);
|
);
|
||||||
//For Attachment
|
//For Attachment
|
||||||
$result['ATTACHMENT'] = $oObjectPermission->objectPermissionByOutputInput(
|
$result['ATTACHMENT'] = $oObjectPermission->objectPermissionByOutputInput(
|
||||||
@@ -5810,7 +5810,7 @@ class Cases
|
|||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
'ATTACHED',
|
'ATTACHED',
|
||||||
$opObjUid,
|
$opObjUid,
|
||||||
$aCase['APP_STATUS']
|
$caseData['APP_STATUS']
|
||||||
);
|
);
|
||||||
|
|
||||||
$result['CASES_NOTES'] = 1;
|
$result['CASES_NOTES'] = 1;
|
||||||
@@ -5826,7 +5826,7 @@ class Cases
|
|||||||
$action,
|
$action,
|
||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
$opUserRelation,
|
$opUserRelation,
|
||||||
$aCase['APP_STATUS'],
|
$caseData['APP_STATUS'],
|
||||||
$opParticipated
|
$opParticipated
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@@ -5835,7 +5835,7 @@ class Cases
|
|||||||
$appUid,
|
$appUid,
|
||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
$opObjUid,
|
$opObjUid,
|
||||||
$aCase['APP_STATUS']
|
$caseData['APP_STATUS']
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'INPUT':
|
case 'INPUT':
|
||||||
@@ -5845,7 +5845,7 @@ class Cases
|
|||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
'INPUT',
|
'INPUT',
|
||||||
$opObjUid,
|
$opObjUid,
|
||||||
$aCase['APP_STATUS']
|
$caseData['APP_STATUS']
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'ATTACHMENT':
|
case 'ATTACHMENT':
|
||||||
@@ -5855,7 +5855,7 @@ class Cases
|
|||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
'ATTACHED',
|
'ATTACHED',
|
||||||
$opObjUid,
|
$opObjUid,
|
||||||
$aCase['APP_STATUS']
|
$caseData['APP_STATUS']
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'OUTPUT':
|
case 'OUTPUT':
|
||||||
@@ -5865,7 +5865,7 @@ class Cases
|
|||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
'OUTPUT',
|
'OUTPUT',
|
||||||
$opObjUid,
|
$opObjUid,
|
||||||
$aCase['APP_STATUS']
|
$caseData['APP_STATUS']
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case 'CASES_NOTES':
|
case 'CASES_NOTES':
|
||||||
@@ -5884,7 +5884,7 @@ class Cases
|
|||||||
$action,
|
$action,
|
||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
$opUserRelation,
|
$opUserRelation,
|
||||||
$aCase['APP_STATUS'],
|
$caseData['APP_STATUS'],
|
||||||
$opParticipated
|
$opParticipated
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -157,10 +157,11 @@ class ObjectPermission extends BaseObjectPermission
|
|||||||
* @param string $proUid the uid of the process
|
* @param string $proUid the uid of the process
|
||||||
* @param string $tasUid the uid of the task
|
* @param string $tasUid the uid of the task
|
||||||
* @param string $action for the object permissions VIEW, BLOCK, RESEND
|
* @param string $action for the object permissions VIEW, BLOCK, RESEND
|
||||||
|
* @param array $caseData for review the case status DRAFT, TODO, COMPLETED, PAUSED
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function verifyObjectPermissionPerUser ($usrUid, $proUid, $tasUid = '', $action = '', $caseInfo = array())
|
public function verifyObjectPermissionPerUser ($usrUid, $proUid, $tasUid = '', $action = '', $caseData = array())
|
||||||
{
|
{
|
||||||
$userPermissions = array();
|
$userPermissions = array();
|
||||||
$oCriteria = new Criteria('workflow');
|
$oCriteria = new Criteria('workflow');
|
||||||
@@ -188,7 +189,7 @@ class ObjectPermission extends BaseObjectPermission
|
|||||||
$row = $rs->getRow();
|
$row = $rs->getRow();
|
||||||
|
|
||||||
if ($row["OP_CASE_STATUS"] == "ALL" || $row["OP_CASE_STATUS"] == "" || $row["OP_CASE_STATUS"] == "0" ||
|
if ($row["OP_CASE_STATUS"] == "ALL" || $row["OP_CASE_STATUS"] == "" || $row["OP_CASE_STATUS"] == "0" ||
|
||||||
$row["OP_CASE_STATUS"] == $caseInfo["APP_STATUS"]
|
$row["OP_CASE_STATUS"] == $caseData["APP_STATUS"]
|
||||||
) {
|
) {
|
||||||
array_push($userPermissions, $row);
|
array_push($userPermissions, $row);
|
||||||
}
|
}
|
||||||
@@ -203,10 +204,11 @@ class ObjectPermission extends BaseObjectPermission
|
|||||||
* @param string $proUid the uid of the process
|
* @param string $proUid the uid of the process
|
||||||
* @param string $tasUid the uid of the task
|
* @param string $tasUid the uid of the task
|
||||||
* @param string $action for the object permissions VIEW, BLOCK, RESEND
|
* @param string $action for the object permissions VIEW, BLOCK, RESEND
|
||||||
|
* @param array $caseData for review the case status DRAFT, TODO, COMPLETED, PAUSED
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function verifyObjectPermissionPerGroup ($usrUid, $proUid, $tasUid = '', $action = '')
|
public function verifyObjectPermissionPerGroup ($usrUid, $proUid, $tasUid = '', $action = '', $caseData = array())
|
||||||
{
|
{
|
||||||
$gr = new Groups();
|
$gr = new Groups();
|
||||||
$records = $gr->getActiveGroupsForAnUser($usrUid);
|
$records = $gr->getActiveGroupsForAnUser($usrUid);
|
||||||
@@ -231,7 +233,7 @@ class ObjectPermission extends BaseObjectPermission
|
|||||||
$row = $rs->getRow();
|
$row = $rs->getRow();
|
||||||
|
|
||||||
if ($row["OP_CASE_STATUS"] == "ALL" || $row["OP_CASE_STATUS"] == "" || $row["OP_CASE_STATUS"] == "0" ||
|
if ($row["OP_CASE_STATUS"] == "ALL" || $row["OP_CASE_STATUS"] == "" || $row["OP_CASE_STATUS"] == "0" ||
|
||||||
$row["OP_CASE_STATUS"] == $aCase["APP_STATUS"]
|
$row["OP_CASE_STATUS"] == $caseData["APP_STATUS"]
|
||||||
) {
|
) {
|
||||||
array_push($groupPermissions, $row);
|
array_push($groupPermissions, $row);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,25 +2,48 @@
|
|||||||
namespace ProcessMaker\BusinessModel\Cases;
|
namespace ProcessMaker\BusinessModel\Cases;
|
||||||
|
|
||||||
use ProcessMaker\Plugins\PluginRegistry;
|
use ProcessMaker\Plugins\PluginRegistry;
|
||||||
|
use AppDocument;
|
||||||
|
use AppDocumentPeer;
|
||||||
|
use Exception;
|
||||||
|
use Criteria;
|
||||||
|
use ResultSet;
|
||||||
|
use G;
|
||||||
|
use ObjectPermissionPeer;
|
||||||
|
use StepPeer;
|
||||||
|
use StepSupervisorPeer;
|
||||||
|
use AppDelegation;
|
||||||
|
use AppDelegationPeer;
|
||||||
|
use Users;
|
||||||
|
use Configurations;
|
||||||
|
use Bootstrap;
|
||||||
|
use WsBase;
|
||||||
|
use ApplicationPeer;
|
||||||
|
use ProcessMaker\BusinessModel\ProcessSupervisor;
|
||||||
|
use ProcessMaker\BusinessModel\Cases AS BusinessModelCases;
|
||||||
|
use Cases;
|
||||||
|
use ProcessUserPeer;
|
||||||
|
use AppFolder;
|
||||||
|
|
||||||
|
|
||||||
class InputDocument
|
class InputDocument
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Verify exists app_doc_uid in table APP_DOCUMENT
|
* Verify exists app_doc_uid in table APP_DOCUMENT
|
||||||
*
|
*
|
||||||
* @param string $applicationUid
|
* @param string $appDocumentUid
|
||||||
*
|
*
|
||||||
* return void Throw exception
|
* @return void Throw exception
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function throwExceptionIfNotExistsAppDocument($appDocumentUid)
|
private function throwExceptionIfNotExistsAppDocument($appDocumentUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$appDocument = \AppDocumentPeer::retrieveByPK($appDocumentUid, 1);
|
$appDocument = AppDocumentPeer::retrieveByPK($appDocumentUid, 1);
|
||||||
|
|
||||||
if (is_null($appDocument)) {
|
if (is_null($appDocument)) {
|
||||||
throw new \Exception(\G::LoadTranslation("ID_CASES_INPUT_DOES_NOT_EXIST", array($appDocumentUid)));
|
throw new Exception(G::LoadTranslation("ID_CASES_INPUT_DOES_NOT_EXIST", array($appDocumentUid)));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,15 +54,16 @@ class InputDocument
|
|||||||
* @param string $applicationUid Unique id of Case
|
* @param string $applicationUid Unique id of Case
|
||||||
* @param string $delIndex Delegataion index
|
* @param string $delIndex Delegataion index
|
||||||
* @param string $userUid Unique id of User
|
* @param string $userUid Unique id of User
|
||||||
* @param string $inputDocumentUid
|
* @param string $appDocumentUid
|
||||||
*
|
*
|
||||||
* return void Throw exception the user does not have permission to delete
|
* @return void Throw exception the user does not have permission to delete
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function throwExceptionIfHaventPermissionToDelete($applicationUid, $delIndex, $userUid, $appDocumentUid)
|
public function throwExceptionIfHaventPermissionToDelete($applicationUid, $delIndex, $userUid, $appDocumentUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//Verify data inbox
|
//Verify data inbox
|
||||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
$case = new BusinessModelCases();
|
||||||
$arrayResult = $case->getStatusInfo($applicationUid, $delIndex, $userUid);
|
$arrayResult = $case->getStatusInfo($applicationUid, $delIndex, $userUid);
|
||||||
|
|
||||||
$flagInbox = 1;
|
$flagInbox = 1;
|
||||||
@@ -49,11 +73,11 @@ class InputDocument
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Verify data Supervisor
|
//Verify data Supervisor
|
||||||
$application = \ApplicationPeer::retrieveByPK($applicationUid);
|
$application = ApplicationPeer::retrieveByPK($applicationUid);
|
||||||
|
|
||||||
$flagSupervisor = 0;
|
$flagSupervisor = 0;
|
||||||
|
|
||||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
$supervisor = new ProcessSupervisor();
|
||||||
$processSupervisor= $supervisor->getProcessSupervisors($application->getProUid(), "ASSIGNED");
|
$processSupervisor= $supervisor->getProcessSupervisors($application->getProUid(), "ASSIGNED");
|
||||||
|
|
||||||
$arraySupervisor = $processSupervisor["data"];
|
$arraySupervisor = $processSupervisor["data"];
|
||||||
@@ -66,7 +90,7 @@ class InputDocument
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($flagInbox == 0 && $flagSupervisor == 0) {
|
if ($flagInbox == 0 && $flagSupervisor == 0) {
|
||||||
throw new \Exception(\G::LoadTranslation("ID_USER_NOT_HAVE_PERMISSION_DELETE_INPUT_DOCUMENT", array($userUid)));
|
throw new Exception(G::LoadTranslation("ID_USER_NOT_HAVE_PERMISSION_DELETE_INPUT_DOCUMENT", array($userUid)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//verfiry exists $appDocumentUid
|
//verfiry exists $appDocumentUid
|
||||||
@@ -75,16 +99,16 @@ class InputDocument
|
|||||||
//Verify data permission
|
//Verify data permission
|
||||||
$flagPermission = 0;
|
$flagPermission = 0;
|
||||||
|
|
||||||
$criteria = new \Criteria("workflow");
|
$criteria = new Criteria("workflow");
|
||||||
|
|
||||||
$criteria->addSelectColumn(\AppDocumentPeer::DOC_UID);
|
$criteria->addSelectColumn(AppDocumentPeer::DOC_UID);
|
||||||
|
|
||||||
$criteria->add(\AppDocumentPeer::APP_DOC_UID, $appDocumentUid, \Criteria::EQUAL);
|
$criteria->add(AppDocumentPeer::APP_DOC_UID, $appDocumentUid, Criteria::EQUAL);
|
||||||
$criteria->add(\AppDocumentPeer::APP_UID, $applicationUid, \Criteria::EQUAL);
|
$criteria->add(AppDocumentPeer::APP_UID, $applicationUid, Criteria::EQUAL);
|
||||||
$criteria->add(\AppDocumentPeer::APP_DOC_TYPE, "INPUT", \Criteria::EQUAL);
|
$criteria->add(AppDocumentPeer::APP_DOC_TYPE, "INPUT", Criteria::EQUAL);
|
||||||
|
|
||||||
$rsCriteria = \AppDocumentPeer::doSelectRS($criteria);
|
$rsCriteria = AppDocumentPeer::doSelectRS($criteria);
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
if ($rsCriteria->next()) {
|
if ($rsCriteria->next()) {
|
||||||
$row = $rsCriteria->getRow();
|
$row = $rsCriteria->getRow();
|
||||||
@@ -92,27 +116,27 @@ class InputDocument
|
|||||||
$inputDocumentUid = $row["DOC_UID"];
|
$inputDocumentUid = $row["DOC_UID"];
|
||||||
|
|
||||||
//Criteria
|
//Criteria
|
||||||
$criteria2 = new \Criteria("workflow");
|
$criteria2 = new Criteria("workflow");
|
||||||
|
|
||||||
$criteria2->addSelectColumn(\ObjectPermissionPeer::OP_UID);
|
$criteria2->addSelectColumn(ObjectPermissionPeer::OP_UID);
|
||||||
|
|
||||||
$criteria2->add(\ObjectPermissionPeer::PRO_UID, $application->getProUid(), \Criteria::EQUAL);
|
$criteria2->add(ObjectPermissionPeer::PRO_UID, $application->getProUid(), Criteria::EQUAL);
|
||||||
$criteria2->add(\ObjectPermissionPeer::OP_OBJ_TYPE, "INPUT", \Criteria::EQUAL);
|
$criteria2->add(ObjectPermissionPeer::OP_OBJ_TYPE, "INPUT", Criteria::EQUAL);
|
||||||
$criteria2->add(
|
$criteria2->add(
|
||||||
$criteria2->getNewCriterion(\ObjectPermissionPeer::OP_OBJ_UID, $inputDocumentUid, \Criteria::EQUAL)->addOr(
|
$criteria2->getNewCriterion(ObjectPermissionPeer::OP_OBJ_UID, $inputDocumentUid, Criteria::EQUAL)->addOr(
|
||||||
$criteria2->getNewCriterion(\ObjectPermissionPeer::OP_OBJ_UID, "0", \Criteria::EQUAL))->addOr(
|
$criteria2->getNewCriterion(ObjectPermissionPeer::OP_OBJ_UID, "0", Criteria::EQUAL))->addOr(
|
||||||
$criteria2->getNewCriterion(\ObjectPermissionPeer::OP_OBJ_UID, "", \Criteria::EQUAL))
|
$criteria2->getNewCriterion(ObjectPermissionPeer::OP_OBJ_UID, "", Criteria::EQUAL))
|
||||||
);
|
);
|
||||||
$criteria2->add(\ObjectPermissionPeer::OP_ACTION, "DELETE", \Criteria::EQUAL);
|
$criteria2->add(ObjectPermissionPeer::OP_ACTION, "DELETE", Criteria::EQUAL);
|
||||||
|
|
||||||
//User
|
//User
|
||||||
$criteriaU = clone $criteria2;
|
$criteriaU = clone $criteria2;
|
||||||
|
|
||||||
$criteriaU->add(\ObjectPermissionPeer::OP_USER_RELATION, 1, \Criteria::EQUAL);
|
$criteriaU->add(ObjectPermissionPeer::OP_USER_RELATION, 1, Criteria::EQUAL);
|
||||||
$criteriaU->add(\ObjectPermissionPeer::USR_UID, $userUid, \Criteria::EQUAL);
|
$criteriaU->add(ObjectPermissionPeer::USR_UID, $userUid, Criteria::EQUAL);
|
||||||
|
|
||||||
$rsCriteriaU = \ObjectPermissionPeer::doSelectRS($criteriaU);
|
$rsCriteriaU = ObjectPermissionPeer::doSelectRS($criteriaU);
|
||||||
$rsCriteriaU->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rsCriteriaU->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
if ($rsCriteriaU->next()) {
|
if ($rsCriteriaU->next()) {
|
||||||
$flagPermission = 1;
|
$flagPermission = 1;
|
||||||
@@ -122,13 +146,13 @@ class InputDocument
|
|||||||
if ($flagPermission == 0) {
|
if ($flagPermission == 0) {
|
||||||
$criteriaG = clone $criteria2;
|
$criteriaG = clone $criteria2;
|
||||||
|
|
||||||
$criteriaG->add(\ObjectPermissionPeer::OP_USER_RELATION, 2, \Criteria::EQUAL);
|
$criteriaG->add(ObjectPermissionPeer::OP_USER_RELATION, 2, Criteria::EQUAL);
|
||||||
|
|
||||||
$criteriaG->addJoin(\ObjectPermissionPeer::USR_UID, \GroupUserPeer::GRP_UID, \Criteria::LEFT_JOIN);
|
$criteriaG->addJoin(ObjectPermissionPeer::USR_UID, GroupUserPeer::GRP_UID, Criteria::LEFT_JOIN);
|
||||||
$criteriaG->add(\GroupUserPeer::USR_UID, $userUid, \Criteria::EQUAL);
|
$criteriaG->add(GroupUserPeer::USR_UID, $userUid, Criteria::EQUAL);
|
||||||
|
|
||||||
$rsCriteriaG = \ObjectPermissionPeer::doSelectRS($criteriaG);
|
$rsCriteriaG = ObjectPermissionPeer::doSelectRS($criteriaG);
|
||||||
$rsCriteriaG->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rsCriteriaG->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
if ($rsCriteriaG->next()) {
|
if ($rsCriteriaG->next()) {
|
||||||
$flagPermission = 1;
|
$flagPermission = 1;
|
||||||
@@ -137,9 +161,9 @@ class InputDocument
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($flagPermission == 0) {
|
if ($flagPermission == 0) {
|
||||||
throw new \Exception(\G::LoadTranslation("ID_USER_NOT_HAVE_PERMISSION_DELETE_INPUT_DOCUMENT", array($userUid)));
|
throw new Exception(G::LoadTranslation("ID_USER_NOT_HAVE_PERMISSION_DELETE_INPUT_DOCUMENT", array($userUid)));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -151,53 +175,54 @@ class InputDocument
|
|||||||
* @param string $delIndex Delegataion index
|
* @param string $delIndex Delegataion index
|
||||||
* @param string $appDocumentUid
|
* @param string $appDocumentUid
|
||||||
*
|
*
|
||||||
* return void Throw exception if not exists input Document in Steps
|
* @return void Throw exception if not exists input Document in Steps
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function throwExceptionIfInputDocumentNotExistsInSteps($applicacionUid, $delIndex, $appDocumentUid)
|
public function throwExceptionIfInputDocumentNotExistsInSteps($applicationUid, $delIndex, $appDocumentUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//Verify Case
|
//Verify Case
|
||||||
$appDelegation = \AppDelegationPeer::retrieveByPK($applicacionUid, $delIndex);
|
$appDelegation = AppDelegationPeer::retrieveByPK($applicationUid, $delIndex);
|
||||||
|
|
||||||
if (is_null($appDelegation)) {
|
if (is_null($appDelegation)) {
|
||||||
throw new \Exception(\G::LoadTranslation("ID_CASE_DEL_INDEX_DOES_NOT_EXIST", array("app_uid", $applicacionUid, "del_index", $delIndex)));
|
throw new Exception(G::LoadTranslation("ID_CASE_DEL_INDEX_DOES_NOT_EXIST", array("app_uid", $applicationUid, "del_index", $delIndex)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$taskUid = $appDelegation->getTasUid();
|
$taskUid = $appDelegation->getTasUid();
|
||||||
|
|
||||||
//Verify Steps
|
//Verify Steps
|
||||||
$criteria = new \Criteria("workflow");
|
$criteria = new Criteria("workflow");
|
||||||
|
|
||||||
$criteria->addSelectColumn(\AppDocumentPeer::DOC_UID);
|
$criteria->addSelectColumn(AppDocumentPeer::DOC_UID);
|
||||||
|
|
||||||
$criteria->add(\AppDocumentPeer::APP_DOC_UID, $appDocumentUid, \Criteria::EQUAL);
|
$criteria->add(AppDocumentPeer::APP_DOC_UID, $appDocumentUid, Criteria::EQUAL);
|
||||||
$criteria->add(\AppDocumentPeer::APP_UID, $applicacionUid, \Criteria::EQUAL);
|
$criteria->add(AppDocumentPeer::APP_UID, $applicationUid, Criteria::EQUAL);
|
||||||
$criteria->add(\AppDocumentPeer::APP_DOC_TYPE, "INPUT", \Criteria::EQUAL);
|
$criteria->add(AppDocumentPeer::APP_DOC_TYPE, "INPUT", Criteria::EQUAL);
|
||||||
|
|
||||||
$rsCriteria = \AppDocumentPeer::doSelectRS($criteria);
|
$rsCriteria = AppDocumentPeer::doSelectRS($criteria);
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
if ($rsCriteria->next()) {
|
if ($rsCriteria->next()) {
|
||||||
$row = $rsCriteria->getRow();
|
$row = $rsCriteria->getRow();
|
||||||
|
|
||||||
$inputDocumentUid = $row["DOC_UID"];
|
$inputDocumentUid = $row["DOC_UID"];
|
||||||
|
|
||||||
$criteria = new \Criteria("workflow");
|
$criteria = new Criteria("workflow");
|
||||||
|
|
||||||
$criteria->addSelectColumn(\StepPeer::STEP_UID);
|
$criteria->addSelectColumn(StepPeer::STEP_UID);
|
||||||
|
|
||||||
$criteria->add(\StepPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
|
$criteria->add(StepPeer::TAS_UID, $taskUid, Criteria::EQUAL);
|
||||||
$criteria->add(\StepPeer::STEP_TYPE_OBJ, "INPUT_DOCUMENT", \Criteria::EQUAL);
|
$criteria->add(StepPeer::STEP_TYPE_OBJ, "INPUT_DOCUMENT", Criteria::EQUAL);
|
||||||
$criteria->add(\StepPeer::STEP_UID_OBJ, $inputDocumentUid, \Criteria::EQUAL);
|
$criteria->add(StepPeer::STEP_UID_OBJ, $inputDocumentUid, Criteria::EQUAL);
|
||||||
|
|
||||||
$rsCriteria = \StepPeer::doSelectRS($criteria);
|
$rsCriteria = StepPeer::doSelectRS($criteria);
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
if (!$rsCriteria->next()) {
|
if (!$rsCriteria->next()) {
|
||||||
throw new \Exception(\G::LoadTranslation("ID_CASES_INPUT_DOCUMENT_DOES_NOT_EXIST", array($appDocumentUid)));
|
throw new Exception(G::LoadTranslation("ID_CASES_INPUT_DOCUMENT_DOES_NOT_EXIST", array($appDocumentUid)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -205,39 +230,40 @@ class InputDocument
|
|||||||
/**
|
/**
|
||||||
* Get criteria for AppDocument
|
* Get criteria for AppDocument
|
||||||
*
|
*
|
||||||
* return object
|
* @return object
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getAppDocumentCriteriaByData($applicationUid)
|
public function getAppDocumentCriteriaByData($applicationUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$criteria = new \Criteria("workflow");
|
$criteria = new Criteria("workflow");
|
||||||
|
|
||||||
$criteria->addSelectColumn(\AppDocumentPeer::APP_DOC_UID);
|
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_UID);
|
||||||
$criteria->addSelectColumn(\AppDocumentPeer::DOC_VERSION);
|
$criteria->addSelectColumn(AppDocumentPeer::DOC_VERSION);
|
||||||
$criteria->addSelectColumn(\AppDocumentPeer::DOC_UID);
|
$criteria->addSelectColumn(AppDocumentPeer::DOC_UID);
|
||||||
$criteria->addSelectColumn(\AppDocumentPeer::USR_UID);
|
$criteria->addSelectColumn(AppDocumentPeer::USR_UID);
|
||||||
$criteria->addSelectColumn(\AppDocumentPeer::APP_DOC_TYPE);
|
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_TYPE);
|
||||||
$criteria->addSelectColumn(\AppDocumentPeer::APP_DOC_CREATE_DATE);
|
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_CREATE_DATE);
|
||||||
$criteria->addSelectColumn(\AppDocumentPeer::APP_DOC_INDEX);
|
$criteria->addSelectColumn(AppDocumentPeer::APP_DOC_INDEX);
|
||||||
|
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT MAX(APPDOC.DOC_VERSION)
|
SELECT MAX(APPDOC.DOC_VERSION)
|
||||||
FROM " . \AppDocumentPeer::TABLE_NAME . " AS APPDOC
|
FROM " . AppDocumentPeer::TABLE_NAME . " AS APPDOC
|
||||||
WHERE APPDOC.APP_DOC_UID = " . \AppDocumentPeer::APP_DOC_UID . "
|
WHERE APPDOC.APP_DOC_UID = " . AppDocumentPeer::APP_DOC_UID . "
|
||||||
";
|
";
|
||||||
|
|
||||||
$criteria->add(
|
$criteria->add(
|
||||||
$criteria->getNewCriterion(\AppDocumentPeer::APP_UID, $applicationUid, \Criteria::EQUAL)->addAnd(
|
$criteria->getNewCriterion(AppDocumentPeer::APP_UID, $applicationUid, Criteria::EQUAL)->addAnd(
|
||||||
$criteria->getNewCriterion(\AppDocumentPeer::APP_DOC_TYPE, array("INPUT", "ATTACHED"), \Criteria::IN))->addAnd(
|
$criteria->getNewCriterion(AppDocumentPeer::APP_DOC_TYPE, array("INPUT", "ATTACHED"), Criteria::IN))->addAnd(
|
||||||
$criteria->getNewCriterion(\AppDocumentPeer::APP_DOC_STATUS, array("ACTIVE"), \Criteria::IN))->addAnd(
|
$criteria->getNewCriterion(AppDocumentPeer::APP_DOC_STATUS, array("ACTIVE"), Criteria::IN))->addAnd(
|
||||||
$criteria->getNewCriterion(\AppDocumentPeer::DOC_VERSION, \AppDocumentPeer::DOC_VERSION . " IN ($sql)", \Criteria::CUSTOM))
|
$criteria->getNewCriterion(AppDocumentPeer::DOC_VERSION, AppDocumentPeer::DOC_VERSION . " IN ($sql)", Criteria::CUSTOM))
|
||||||
);
|
);
|
||||||
|
|
||||||
$criteria->addAscendingOrderByColumn(\AppDocumentPeer::APP_DOC_INDEX);
|
$criteria->addAscendingOrderByColumn(AppDocumentPeer::APP_DOC_INDEX);
|
||||||
|
|
||||||
//Return
|
//Return
|
||||||
return $criteria;
|
return $criteria;
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -247,23 +273,43 @@ class InputDocument
|
|||||||
*
|
*
|
||||||
* @param array $record Record
|
* @param array $record Record
|
||||||
*
|
*
|
||||||
* return array Return an array with data AppDocument
|
* @return array Return an array with data AppDocument
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getAppDocumentDataFromRecord(array $record)
|
public function getAppDocumentDataFromRecord(array $record)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return array(
|
$newArray = array();
|
||||||
"app_doc_uid" => $record["APP_DOC_UID"],
|
if (isset($record["APP_DOC_UID"])) {
|
||||||
"app_doc_filename" => $record["APP_DOC_FILENAME"],
|
$newArray["app_doc_uid"] = $record["APP_DOC_UID"];
|
||||||
"doc_uid" => $record["DOC_UID"],
|
}
|
||||||
"app_doc_version" => $record["DOC_VERSION"],
|
if (isset($record["APP_DOC_FILENAME"])) {
|
||||||
"app_doc_create_date" => $record["APP_DOC_CREATE_DATE"],
|
$newArray["app_doc_filename"] = $record["APP_DOC_FILENAME"];
|
||||||
"app_doc_create_user" => $record["APP_DOC_CREATE_USER"],
|
}
|
||||||
"app_doc_type" => $record["APP_DOC_TYPE"],
|
if (isset($record["DOC_UID"])) {
|
||||||
"app_doc_index" => (int)($record["APP_DOC_INDEX"]),
|
$newArray["doc_uid"] = $record["DOC_UID"];
|
||||||
"app_doc_link" => $record["APP_DOC_LINK"]
|
}
|
||||||
);
|
if (isset($record["DOC_VERSION"])) {
|
||||||
} catch (\Exception $e) {
|
$newArray["app_doc_version"] = $record["DOC_VERSION"];
|
||||||
|
}
|
||||||
|
if (isset($record["APP_DOC_CREATE_DATE"])) {
|
||||||
|
$newArray["app_doc_create_date"] = $record["APP_DOC_CREATE_DATE"];
|
||||||
|
}
|
||||||
|
if (isset($record["APP_DOC_CREATE_USER"])) {
|
||||||
|
$newArray["app_doc_create_user"] = $record["APP_DOC_CREATE_USER"];
|
||||||
|
}
|
||||||
|
if (isset($record["APP_DOC_TYPE"])) {
|
||||||
|
$newArray["app_doc_type"] = $record["APP_DOC_TYPE"];
|
||||||
|
}
|
||||||
|
if (isset($record["APP_DOC_INDEX"])) {
|
||||||
|
$newArray["app_doc_index"] = $record["APP_DOC_INDEX"];
|
||||||
|
}
|
||||||
|
if (isset($record["APP_DOC_LINK"])) {
|
||||||
|
$newArray["app_doc_link"] = $record["APP_DOC_LINK"];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $newArray;
|
||||||
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -274,17 +320,18 @@ class InputDocument
|
|||||||
* @param string $applicationUid Unique id of Case
|
* @param string $applicationUid Unique id of Case
|
||||||
* @param string $userUid Unique id of User
|
* @param string $userUid Unique id of User
|
||||||
*
|
*
|
||||||
* return array Return data of input documents
|
* @return array Return data of input documents
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getCasesInputDocumentsBySupervisor($applicationUid, $userUid)
|
public function getCasesInputDocumentsBySupervisor($applicationUid, $userUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//Verify data Supervisor
|
//Verify data Supervisor
|
||||||
$application = \ApplicationPeer::retrieveByPK($applicationUid);
|
$application = ApplicationPeer::retrieveByPK($applicationUid);
|
||||||
|
|
||||||
$flagSupervisor = 0;
|
$flagSupervisor = 0;
|
||||||
|
|
||||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
$supervisor = new ProcessSupervisor();
|
||||||
$processSupervisor = $supervisor->getProcessSupervisors($application->getProUid(), "ASSIGNED");
|
$processSupervisor = $supervisor->getProcessSupervisors($application->getProUid(), "ASSIGNED");
|
||||||
$arraySupervisor = $processSupervisor["data"];
|
$arraySupervisor = $processSupervisor["data"];
|
||||||
|
|
||||||
@@ -295,9 +342,9 @@ class InputDocument
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = new \Users();
|
$user = new Users();
|
||||||
$appDocument = new \AppDocument();
|
$appDocument = new AppDocument();
|
||||||
$configuraction = new \Configurations();
|
$configuraction = new Configurations();
|
||||||
|
|
||||||
$confEnvSetting = $configuraction->getFormats();
|
$confEnvSetting = $configuraction->getFormats();
|
||||||
|
|
||||||
@@ -306,8 +353,8 @@ class InputDocument
|
|||||||
//Query
|
//Query
|
||||||
$criteria = $this->getAppDocumentCriteriaByData($applicationUid);
|
$criteria = $this->getAppDocumentCriteriaByData($applicationUid);
|
||||||
|
|
||||||
$rsCriteria = \AppDocumentPeer::doSelectRS($criteria);
|
$rsCriteria = AppDocumentPeer::doSelectRS($criteria);
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
while ($rsCriteria->next()) {
|
while ($rsCriteria->next()) {
|
||||||
$row = $rsCriteria->getRow();
|
$row = $rsCriteria->getRow();
|
||||||
@@ -324,12 +371,12 @@ class InputDocument
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($arrayInputDocument) && $flagSupervisor == 0) {
|
if (!empty($arrayInputDocument) && $flagSupervisor == 0) {
|
||||||
throw new \Exception(\G::LoadTranslation("ID_USER_IS_NOT_SUPERVISOR"));
|
throw new Exception(G::LoadTranslation("ID_USER_IS_NOT_SUPERVISOR"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Return
|
//Return
|
||||||
return $arrayInputDocument;
|
return $arrayInputDocument;
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -340,13 +387,14 @@ class InputDocument
|
|||||||
* @param string $applicationUid
|
* @param string $applicationUid
|
||||||
* @param string $userUid
|
* @param string $userUid
|
||||||
*
|
*
|
||||||
* return array Return an array with data of an InputDocument
|
* @return array Return an array with data of an InputDocument
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getCasesInputDocuments($applicationUid, $userUid)
|
public function getCasesInputDocuments($applicationUid, $userUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//Verify data inbox
|
//Verify data inbox
|
||||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
$case = new BusinessModelCases();
|
||||||
$arrayResult = $case->getStatusInfo($applicationUid, 0, $userUid);
|
$arrayResult = $case->getStatusInfo($applicationUid, 0, $userUid);
|
||||||
|
|
||||||
$flagInbox = true;
|
$flagInbox = true;
|
||||||
@@ -355,9 +403,9 @@ class InputDocument
|
|||||||
$flagInbox = false;
|
$flagInbox = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = new \Users();
|
$user = new Users();
|
||||||
$appDocument = new \AppDocument();
|
$appDocument = new AppDocument();
|
||||||
$configuraction = new \Configurations();
|
$configuraction = new Configurations();
|
||||||
|
|
||||||
$confEnvSetting = $configuraction->getFormats();
|
$confEnvSetting = $configuraction->getFormats();
|
||||||
|
|
||||||
@@ -367,11 +415,11 @@ class InputDocument
|
|||||||
$criteria = $this->getAppDocumentCriteriaByData($applicationUid);
|
$criteria = $this->getAppDocumentCriteriaByData($applicationUid);
|
||||||
|
|
||||||
if (!$flagInbox) {
|
if (!$flagInbox) {
|
||||||
$criteria->add(\AppDocumentPeer::USR_UID, $userUid, \Criteria::EQUAL);
|
$criteria->add(AppDocumentPeer::USR_UID, $userUid, Criteria::EQUAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rsCriteria = \AppDocumentPeer::doSelectRS($criteria);
|
$rsCriteria = AppDocumentPeer::doSelectRS($criteria);
|
||||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
while ($rsCriteria->next()) {
|
while ($rsCriteria->next()) {
|
||||||
$row = $rsCriteria->getRow();
|
$row = $rsCriteria->getRow();
|
||||||
@@ -393,7 +441,7 @@ class InputDocument
|
|||||||
|
|
||||||
//Return
|
//Return
|
||||||
return $arrayInputDocument;
|
return $arrayInputDocument;
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -405,7 +453,8 @@ class InputDocument
|
|||||||
* @param string $userUid
|
* @param string $userUid
|
||||||
* @param string $inputDocumentUid
|
* @param string $inputDocumentUid
|
||||||
*
|
*
|
||||||
* return array Return an array with data of an InputDocument
|
* @return array Return an array with data of an InputDocument
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getCasesInputDocument($applicationUid, $userUid, $inputDocumentUid)
|
public function getCasesInputDocument($applicationUid, $userUid, $inputDocumentUid)
|
||||||
{
|
{
|
||||||
@@ -413,11 +462,11 @@ class InputDocument
|
|||||||
$sApplicationUID = $applicationUid;
|
$sApplicationUID = $applicationUid;
|
||||||
$sUserUID = $userUid;
|
$sUserUID = $userUid;
|
||||||
|
|
||||||
$oCase = new \Cases();
|
$oCase = new Cases();
|
||||||
$fields = $oCase->loadCase( $sApplicationUID );
|
$fields = $oCase->loadCase( $sApplicationUID );
|
||||||
$sProcessUID = $fields['PRO_UID'];
|
$sProcessUID = $fields['PRO_UID'];
|
||||||
$sTaskUID = '';
|
$sTaskUID = '';
|
||||||
$oCaseRest = new \ProcessMaker\BusinessModel\Cases();
|
$oCaseRest = new BusinessModelCases();
|
||||||
$oCaseRest->getAllUploadedDocumentsCriteria( $sProcessUID, $sApplicationUID, $sTaskUID, $sUserUID );
|
$oCaseRest->getAllUploadedDocumentsCriteria( $sProcessUID, $sApplicationUID, $sTaskUID, $sUserUID );
|
||||||
$result = array ();
|
$result = array ();
|
||||||
global $_DBArray;
|
global $_DBArray;
|
||||||
@@ -439,7 +488,7 @@ class InputDocument
|
|||||||
if ($docrow["app_doc_uid"] == $inputDocumentUid) {
|
if ($docrow["app_doc_uid"] == $inputDocumentUid) {
|
||||||
$flagInputDocument = true;
|
$flagInputDocument = true;
|
||||||
|
|
||||||
$appDocument = \AppDocumentPeer::retrieveByPK($inputDocumentUid, $row["DOC_VERSION"]);
|
$appDocument = AppDocumentPeer::retrieveByPK($inputDocumentUid, $row["DOC_VERSION"]);
|
||||||
|
|
||||||
if (is_null($appDocument)) {
|
if (is_null($appDocument)) {
|
||||||
$flagInputDocument = false;
|
$flagInputDocument = false;
|
||||||
@@ -452,12 +501,12 @@ class InputDocument
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$flagInputDocument) {
|
if (!$flagInputDocument) {
|
||||||
throw new \Exception(\G::LoadTranslation("ID_CASES_INPUT_DOES_NOT_EXIST", array($inputDocumentUid)));
|
throw new Exception(G::LoadTranslation("ID_CASES_INPUT_DOES_NOT_EXIST", array($inputDocumentUid)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$oResponse = json_decode(json_encode($result), false);
|
$oResponse = json_decode(json_encode($result), false);
|
||||||
return $oResponse;
|
return $oResponse;
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -468,12 +517,12 @@ class InputDocument
|
|||||||
* @param $app_uid
|
* @param $app_uid
|
||||||
* @param $app_doc_uid
|
* @param $app_doc_uid
|
||||||
* @param $version
|
* @param $version
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function downloadInputDocument($app_uid, $app_doc_uid, $version)
|
public function downloadInputDocument($app_uid, $app_doc_uid, $version)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oAppDocument = new \AppDocument();
|
$oAppDocument = new AppDocument();
|
||||||
if ($version == 0) {
|
if ($version == 0) {
|
||||||
$docVersion = $oAppDocument->getLastAppDocVersion($app_doc_uid);
|
$docVersion = $oAppDocument->getLastAppDocVersion($app_doc_uid);
|
||||||
} else {
|
} else {
|
||||||
@@ -484,8 +533,8 @@ class InputDocument
|
|||||||
$iDocVersion = $oAppDocument->getDocVersion();
|
$iDocVersion = $oAppDocument->getDocVersion();
|
||||||
$info = pathinfo($oAppDocument->getAppDocFilename());
|
$info = pathinfo($oAppDocument->getAppDocFilename());
|
||||||
|
|
||||||
$app_uid = \G::getPathFromUID($oAppDocument->Fields['APP_UID']);
|
$app_uid = G::getPathFromUID($oAppDocument->Fields['APP_UID']);
|
||||||
$file = \G::getPathFromFileUID($oAppDocument->Fields['APP_UID'], $sAppDocUid);
|
$file = G::getPathFromFileUID($oAppDocument->Fields['APP_UID'], $sAppDocUid);
|
||||||
|
|
||||||
$ext = (isset($info['extension']) ? $info['extension'] : '');
|
$ext = (isset($info['extension']) ? $info['extension'] : '');
|
||||||
$realPath = PATH_DOCUMENT . $app_uid . '/' . $file[0] . $file[1] . '_' . $iDocVersion . '.' . $ext;
|
$realPath = PATH_DOCUMENT . $app_uid . '/' . $file[0] . $file[1] . '_' . $iDocVersion . '.' . $ext;
|
||||||
@@ -513,7 +562,7 @@ class InputDocument
|
|||||||
}
|
}
|
||||||
@fclose($fp);
|
@fclose($fp);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -691,19 +740,20 @@ class InputDocument
|
|||||||
*
|
*
|
||||||
* @param string $inputDocumentUid
|
* @param string $inputDocumentUid
|
||||||
*
|
*
|
||||||
* return array Return an array with data of an InputDocument
|
* @return array Return an array with data of an InputDocument
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function removeInputDocument($inputDocumentUid)
|
public function removeInputDocument($inputDocumentUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oAppDocument = \AppDocumentPeer::retrieveByPK( $inputDocumentUid, 1 );
|
$oAppDocument = AppDocumentPeer::retrieveByPK( $inputDocumentUid, 1 );
|
||||||
if (is_null( $oAppDocument ) || $oAppDocument->getAppDocStatus() == 'DELETED') {
|
if (is_null( $oAppDocument ) || $oAppDocument->getAppDocStatus() == 'DELETED') {
|
||||||
throw new \Exception(\G::LoadTranslation("ID_CASES_INPUT_DOES_NOT_EXIST", array($inputDocumentUid)));
|
throw new Exception(G::LoadTranslation("ID_CASES_INPUT_DOES_NOT_EXIST", array($inputDocumentUid)));
|
||||||
}
|
}
|
||||||
|
|
||||||
$ws = new \WsBase();
|
$ws = new WsBase();
|
||||||
$ws->removeDocument($inputDocumentUid);
|
$ws->removeDocument($inputDocumentUid);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -717,7 +767,8 @@ class InputDocument
|
|||||||
* @param string $inputDocumentUid
|
* @param string $inputDocumentUid
|
||||||
* @param string $userUid
|
* @param string $userUid
|
||||||
*
|
*
|
||||||
* return array Return an array with data of an 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($applicationUid, $taskUid, $appDocComment, $inputDocumentUid, $userUid, $runningWorkflow = true)
|
||||||
{
|
{
|
||||||
@@ -726,90 +777,90 @@ class InputDocument
|
|||||||
$code = $_FILES['form']['error'];
|
$code = $_FILES['form']['error'];
|
||||||
switch ($code) {
|
switch ($code) {
|
||||||
case UPLOAD_ERR_INI_SIZE:
|
case UPLOAD_ERR_INI_SIZE:
|
||||||
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_INI_SIZE' );
|
$message = G::LoadTranslation( 'ID_UPLOAD_ERR_INI_SIZE' );
|
||||||
break;
|
break;
|
||||||
case UPLOAD_ERR_FORM_SIZE:
|
case UPLOAD_ERR_FORM_SIZE:
|
||||||
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_FORM_SIZE' );
|
$message = G::LoadTranslation( 'ID_UPLOAD_ERR_FORM_SIZE' );
|
||||||
break;
|
break;
|
||||||
case UPLOAD_ERR_PARTIAL:
|
case UPLOAD_ERR_PARTIAL:
|
||||||
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_PARTIAL' );
|
$message = G::LoadTranslation( 'ID_UPLOAD_ERR_PARTIAL' );
|
||||||
break;
|
break;
|
||||||
case UPLOAD_ERR_NO_FILE:
|
case UPLOAD_ERR_NO_FILE:
|
||||||
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_NO_FILE' );
|
$message = G::LoadTranslation( 'ID_UPLOAD_ERR_NO_FILE' );
|
||||||
break;
|
break;
|
||||||
case UPLOAD_ERR_NO_TMP_DIR:
|
case UPLOAD_ERR_NO_TMP_DIR:
|
||||||
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_NO_TMP_DIR' );
|
$message = G::LoadTranslation( 'ID_UPLOAD_ERR_NO_TMP_DIR' );
|
||||||
break;
|
break;
|
||||||
case UPLOAD_ERR_CANT_WRITE:
|
case UPLOAD_ERR_CANT_WRITE:
|
||||||
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_CANT_WRITE' );
|
$message = G::LoadTranslation( 'ID_UPLOAD_ERR_CANT_WRITE' );
|
||||||
break;
|
break;
|
||||||
case UPLOAD_ERR_EXTENSION:
|
case UPLOAD_ERR_EXTENSION:
|
||||||
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_EXTENSION' );
|
$message = G::LoadTranslation( 'ID_UPLOAD_ERR_EXTENSION' );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$message = \G::LoadTranslation( 'ID_UPLOAD_ERR_UNKNOWN' );
|
$message = G::LoadTranslation( 'ID_UPLOAD_ERR_UNKNOWN' );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
\G::SendMessageText( $message, "ERROR" );
|
G::SendMessageText( $message, "ERROR" );
|
||||||
$backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] );
|
$backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] );
|
||||||
\G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] );
|
G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] );
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
$appDocUid = \G::generateUniqueID();
|
$appDocUid = G::generateUniqueID();
|
||||||
$docVersion = '';
|
$docVersion = '';
|
||||||
$appDocType = 'INPUT';
|
$appDocType = 'INPUT';
|
||||||
$case = new \Cases();
|
$case = new Cases();
|
||||||
$delIndex = \AppDelegation::getCurrentIndex($applicationUid);
|
$delIndex = AppDelegation::getCurrentIndex($applicationUid);
|
||||||
|
|
||||||
if ($runningWorkflow) {
|
if ($runningWorkflow) {
|
||||||
$case->thisIsTheCurrentUser($applicationUid, $delIndex, $userUid, 'REDIRECT', 'casesListExtJs');
|
$case->thisIsTheCurrentUser($applicationUid, $delIndex, $userUid, 'REDIRECT', 'casesListExtJs');
|
||||||
} else {
|
} else {
|
||||||
$criteria = new \Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
|
|
||||||
$criteria->add(\AppDelegationPeer::APP_UID, $applicationUid);
|
$criteria->add(AppDelegationPeer::APP_UID, $applicationUid);
|
||||||
$criteria->add(\AppDelegationPeer::DEL_INDEX, $delIndex);
|
$criteria->add(AppDelegationPeer::DEL_INDEX, $delIndex);
|
||||||
$criteria->add(\AppDelegationPeer::USR_UID, $userUid);
|
$criteria->add(AppDelegationPeer::USR_UID, $userUid);
|
||||||
|
|
||||||
$rsCriteria = \ProcessUserPeer::doSelectRS($criteria);
|
$rsCriteria = ProcessUserPeer::doSelectRS($criteria);
|
||||||
|
|
||||||
if (!$rsCriteria->next()) {
|
if (!$rsCriteria->next()) {
|
||||||
$case2 = new \ProcessMaker\BusinessModel\Cases();
|
$case2 = new BusinessModelCases();
|
||||||
|
|
||||||
$arrayApplicationData = $case2->getApplicationRecordByPk($applicationUid, [], false);
|
$arrayApplicationData = $case2->getApplicationRecordByPk($applicationUid, [], false);
|
||||||
|
|
||||||
$msg = '';
|
$msg = '';
|
||||||
|
|
||||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
$supervisor = new ProcessSupervisor();
|
||||||
$flagps = $supervisor->isUserProcessSupervisor($arrayApplicationData['PRO_UID'], $userUid);
|
$flagps = $supervisor->isUserProcessSupervisor($arrayApplicationData['PRO_UID'], $userUid);
|
||||||
|
|
||||||
if ($flagps == false) {
|
if ($flagps == false) {
|
||||||
$msg = \G::LoadTranslation('ID_USER_NOT_IT_BELONGS_CASE_OR_NOT_SUPERVISOR');
|
$msg = G::LoadTranslation('ID_USER_NOT_IT_BELONGS_CASE_OR_NOT_SUPERVISOR');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($msg == '') {
|
if ($msg == '') {
|
||||||
$criteria = new \Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
|
|
||||||
$criteria->add(\StepSupervisorPeer::PRO_UID, $arrayApplicationData['PRO_UID'], \Criteria::EQUAL);
|
$criteria->add(StepSupervisorPeer::PRO_UID, $arrayApplicationData['PRO_UID'], Criteria::EQUAL);
|
||||||
$criteria->add(\StepSupervisorPeer::STEP_TYPE_OBJ, 'INPUT_DOCUMENT', \Criteria::EQUAL);
|
$criteria->add(StepSupervisorPeer::STEP_TYPE_OBJ, 'INPUT_DOCUMENT', Criteria::EQUAL);
|
||||||
$criteria->add(\StepSupervisorPeer::STEP_UID_OBJ, $inputDocumentUid, \Criteria::EQUAL);
|
$criteria->add(StepSupervisorPeer::STEP_UID_OBJ, $inputDocumentUid, Criteria::EQUAL);
|
||||||
|
|
||||||
$rsCriteria = \StepSupervisorPeer::doSelectRS($criteria);
|
$rsCriteria = StepSupervisorPeer::doSelectRS($criteria);
|
||||||
|
|
||||||
if (!$rsCriteria->next()) {
|
if (!$rsCriteria->next()) {
|
||||||
$msg = \G::LoadTranslation('ID_USER_IS_SUPERVISOR_DOES_NOT_ASSOCIATED_INPUT_DOCUMENT');
|
$msg = G::LoadTranslation('ID_USER_IS_SUPERVISOR_DOES_NOT_ASSOCIATED_INPUT_DOCUMENT');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($msg != '') {
|
if ($msg != '') {
|
||||||
if ($runningWorkflow) {
|
if ($runningWorkflow) {
|
||||||
\G::SendMessageText($msg, 'ERROR');
|
G::SendMessageText($msg, 'ERROR');
|
||||||
$backUrlObj = explode('sys' . SYS_SYS, $_SERVER['HTTP_REFERER']);
|
$backUrlObj = explode('sys' . SYS_SYS, $_SERVER['HTTP_REFERER']);
|
||||||
|
|
||||||
\G::header('location: ' . '/sys' . SYS_SYS . $backUrlObj[1]);
|
G::header('location: ' . '/sys' . SYS_SYS . $backUrlObj[1]);
|
||||||
exit(0);
|
exit(0);
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception($msg);
|
throw new Exception($msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -817,19 +868,19 @@ class InputDocument
|
|||||||
|
|
||||||
//Load the fields
|
//Load the fields
|
||||||
$arrayField = $case->loadCase($applicationUid);
|
$arrayField = $case->loadCase($applicationUid);
|
||||||
$arrayField["APP_DATA"] = array_merge($arrayField["APP_DATA"], \G::getSystemConstants());
|
$arrayField["APP_DATA"] = array_merge($arrayField["APP_DATA"], G::getSystemConstants());
|
||||||
//Validate Process Uid and Input Document Process Uid
|
//Validate Process Uid and Input Document Process Uid
|
||||||
$inputDocumentInstance = new \InputDocument();
|
$inputDocumentInstance = new \InputDocument();
|
||||||
$inputDocumentFields = $inputDocumentInstance->load($inputDocumentUid);
|
$inputDocumentFields = $inputDocumentInstance->load($inputDocumentUid);
|
||||||
if ($arrayField['PRO_UID'] != $inputDocumentFields['PRO_UID']) {
|
if ($arrayField['PRO_UID'] != $inputDocumentFields['PRO_UID']) {
|
||||||
throw new \Exception(\G::LoadTranslation("ID_INPUT_DOCUMENT_DOES_NOT_EXIST",
|
throw new Exception(G::LoadTranslation("ID_INPUT_DOCUMENT_DOES_NOT_EXIST",
|
||||||
array('UID=' . $inputDocumentUid, 'PRO_UID=' . $arrayField['PRO_UID'])));
|
array('UID=' . $inputDocumentUid, 'PRO_UID=' . $arrayField['PRO_UID'])));
|
||||||
}
|
}
|
||||||
//Triggers
|
//Triggers
|
||||||
$arrayTrigger = $case->loadTriggers($taskUid, "INPUT_DOCUMENT", $inputDocumentUid, "AFTER");
|
$arrayTrigger = $case->loadTriggers($taskUid, "INPUT_DOCUMENT", $inputDocumentUid, "AFTER");
|
||||||
//Add Input Document
|
//Add Input Document
|
||||||
if (empty($_FILES)) {
|
if (empty($_FILES)) {
|
||||||
throw new \Exception(\G::LoadTranslation("ID_CASES_INPUT_FILENAME_DOES_NOT_EXIST"));
|
throw new Exception(G::LoadTranslation("ID_CASES_INPUT_FILENAME_DOES_NOT_EXIST"));
|
||||||
}
|
}
|
||||||
if (!$_FILES["form"]["error"]) {
|
if (!$_FILES["form"]["error"]) {
|
||||||
$_FILES["form"]["error"] = 0;
|
$_FILES["form"]["error"] = 0;
|
||||||
@@ -866,14 +917,14 @@ class InputDocument
|
|||||||
$arrayData["TAS_UID"] = $taskUid;
|
$arrayData["TAS_UID"] = $taskUid;
|
||||||
$case->updateCase($applicationUid, $arrayData);
|
$case->updateCase($applicationUid, $arrayData);
|
||||||
return($this->getCasesInputDocument($applicationUid, $userUid, $appDocUid));
|
return($this->getCasesInputDocument($applicationUid, $userUid, $appDocUid));
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $files $_FILES request files
|
* @param $files $_FILES request files
|
||||||
* @param $caseInstance \Cases object class.cases
|
* @param $caseInstance Cases object class.cases
|
||||||
* @param $aData array data case
|
* @param $aData array data case
|
||||||
* @param $userUid string user id
|
* @param $userUid string user id
|
||||||
* @param $appUid string application id
|
* @param $appUid string application id
|
||||||
@@ -941,10 +992,10 @@ class InputDocument
|
|||||||
$aID = $oInputDocument->load($indocUid);
|
$aID = $oInputDocument->load($indocUid);
|
||||||
|
|
||||||
//Get the Custom Folder ID (create if necessary)
|
//Get the Custom Folder ID (create if necessary)
|
||||||
$oFolder = new \AppFolder();
|
$oFolder = new AppFolder();
|
||||||
|
|
||||||
//***Validating the file allowed extensions***
|
//***Validating the file allowed extensions***
|
||||||
$res = \G::verifyInputDocExtension($aID['INP_DOC_TYPE_FILE'], $arrayFileName[$i], $arrayFileTmpName[$i]);
|
$res = G::verifyInputDocExtension($aID['INP_DOC_TYPE_FILE'], $arrayFileName[$i], $arrayFileTmpName[$i]);
|
||||||
if ($res->status == 0) {
|
if ($res->status == 0) {
|
||||||
//The value of the variable "_label" is cleared because the file load failed.
|
//The value of the variable "_label" is cleared because the file load failed.
|
||||||
//The validation of the die command should be improved.
|
//The validation of the die command should be improved.
|
||||||
@@ -953,9 +1004,9 @@ class InputDocument
|
|||||||
$caseInstance->updateCase($appUid, $aData);
|
$caseInstance->updateCase($appUid, $aData);
|
||||||
}
|
}
|
||||||
$message = $res->message;
|
$message = $res->message;
|
||||||
\G::SendMessageText($message, "ERROR");
|
G::SendMessageText($message, "ERROR");
|
||||||
$backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']);
|
$backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']);
|
||||||
\G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]);
|
G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]);
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -967,9 +1018,9 @@ class InputDocument
|
|||||||
|
|
||||||
if ($inpDocMaxFilesize > 0 && $fileSizeByField > 0) {
|
if ($inpDocMaxFilesize > 0 && $fileSizeByField > 0) {
|
||||||
if ($fileSizeByField > $inpDocMaxFilesize) {
|
if ($fileSizeByField > $inpDocMaxFilesize) {
|
||||||
\G::SendMessageText(\G::LoadTranslation("ID_SIZE_VERY_LARGE_PERMITTED"), "ERROR");
|
G::SendMessageText(G::LoadTranslation("ID_SIZE_VERY_LARGE_PERMITTED"), "ERROR");
|
||||||
$arrayAux1 = explode("sys" . SYS_SYS, $_SERVER["HTTP_REFERER"]);
|
$arrayAux1 = explode("sys" . SYS_SYS, $_SERVER["HTTP_REFERER"]);
|
||||||
\G::header("location: /sys" . SYS_SYS . $arrayAux1[1]);
|
G::header("location: /sys" . SYS_SYS . $arrayAux1[1]);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -980,31 +1031,31 @@ class InputDocument
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sExtension = pathinfo($aFields["APP_DOC_FILENAME"]);
|
$sExtension = pathinfo($aFields["APP_DOC_FILENAME"]);
|
||||||
if (\Bootstrap::getDisablePhpUploadExecution() === 1 && $sExtension["extension"] === 'php') {
|
if (Bootstrap::getDisablePhpUploadExecution() === 1 && $sExtension["extension"] === 'php') {
|
||||||
$message = \G::LoadTranslation('THE_UPLOAD_OF_PHP_FILES_WAS_DISABLED');
|
$message = G::LoadTranslation('THE_UPLOAD_OF_PHP_FILES_WAS_DISABLED');
|
||||||
\Bootstrap::registerMonologPhpUploadExecution('phpUpload', 550, $message, $sFileName);
|
Bootstrap::registerMonologPhpUploadExecution('phpUpload', 550, $message, 'processmaker.log');
|
||||||
\G::SendMessageText($message, "ERROR");
|
G::SendMessageText($message, "ERROR");
|
||||||
$backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']);
|
$backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']);
|
||||||
\G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]);
|
G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]);
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
$oAppDocument = new \AppDocument();
|
$oAppDocument = new AppDocument();
|
||||||
$oAppDocument->create($aFields);
|
$oAppDocument->create($aFields);
|
||||||
|
|
||||||
$iDocVersion = $oAppDocument->getDocVersion();
|
$iDocVersion = $oAppDocument->getDocVersion();
|
||||||
$sAppDocUid = $oAppDocument->getAppDocUid();
|
$sAppDocUid = $oAppDocument->getAppDocUid();
|
||||||
$aInfo = pathinfo($oAppDocument->getAppDocFilename());
|
$aInfo = pathinfo($oAppDocument->getAppDocFilename());
|
||||||
$sExtension = ((isset($aInfo["extension"])) ? $aInfo["extension"] : "");
|
$sExtension = ((isset($aInfo["extension"])) ? $aInfo["extension"] : "");
|
||||||
$pathUID = \G::getPathFromUID($appUid);
|
$pathUID = G::getPathFromUID($appUid);
|
||||||
$sPathName = PATH_DOCUMENT . $pathUID . PATH_SEP;
|
$sPathName = PATH_DOCUMENT . $pathUID . PATH_SEP;
|
||||||
$sFileName = $sAppDocUid . "_" . $iDocVersion . "." . $sExtension;
|
$sFileName = $sAppDocUid . "_" . $iDocVersion . "." . $sExtension;
|
||||||
|
|
||||||
\G::uploadFile($arrayFileTmpName[$i], $sPathName, $sFileName);
|
G::uploadFile($arrayFileTmpName[$i], $sPathName, $sFileName);
|
||||||
|
|
||||||
//set variable for APP_DOC_UID
|
//set variable for APP_DOC_UID
|
||||||
$aData["APP_DATA"][$oAppDocument->getAppDocFieldname()] = \G::json_encode([$oAppDocument->getAppDocUid()]);
|
$aData["APP_DATA"][$oAppDocument->getAppDocFieldname()] = G::json_encode([$oAppDocument->getAppDocUid()]);
|
||||||
$aData["APP_DATA"][$oAppDocument->getAppDocFieldname() . "_label"] = \G::json_encode([$oAppDocument->getAppDocFilename()]);
|
$aData["APP_DATA"][$oAppDocument->getAppDocFieldname() . "_label"] = G::json_encode([$oAppDocument->getAppDocFilename()]);
|
||||||
$caseInstance->updateCase($appUid, $aData);
|
$caseInstance->updateCase($appUid, $aData);
|
||||||
|
|
||||||
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
|
//Plugin Hook PM_UPLOAD_DOCUMENT for upload document
|
||||||
@@ -1031,4 +1082,62 @@ class InputDocument
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all versions related to the appDocUid
|
||||||
|
* @param string $appUid, Uid of the case
|
||||||
|
* @param string $appDocUid, Uid of the document
|
||||||
|
* @param string $docUid, Uid of the inputDocument
|
||||||
|
* @param string $userUid, Uid of user
|
||||||
|
* @param string $status, It can be ACTIVE, DELETED
|
||||||
|
* @param string $docType, It can be ATTACHED, INPUT
|
||||||
|
* @param string $docTags, It can be EXTERNAL, INPUT
|
||||||
|
*
|
||||||
|
* @return array $docVersion
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function getAllVersionByDocUid ($appUid, $appDocUid, $docUid = '', $userUid = '', $status = 'ACTIVE', $docType = '', $docTags = '')
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$criteria = new Criteria('workflow');
|
||||||
|
$criteria->add(AppDocumentPeer::APP_UID, $appUid);
|
||||||
|
$criteria->add(AppDocumentPeer::APP_DOC_UID, $appDocUid);
|
||||||
|
$criteria->add(AppDocumentPeer::APP_DOC_STATUS, $status, Criteria::EQUAL);
|
||||||
|
if (!empty($docUid)) {
|
||||||
|
$criteria->add(AppDocumentPeer::DOC_UID, $docUid);
|
||||||
|
}
|
||||||
|
if (!empty($userUid)) {
|
||||||
|
$criteria->add(AppDocumentPeer::USR_UID, $userUid);
|
||||||
|
}
|
||||||
|
if (!empty($docType)) {
|
||||||
|
$criteria->add(AppDocumentPeer::APP_DOC_TYPE, $docType);
|
||||||
|
}
|
||||||
|
if (!empty($docTags)) {
|
||||||
|
$criteria->add(AppDocumentPeer::APP_DOC_TAGS, $docTags);
|
||||||
|
}
|
||||||
|
$criteria->addDescendingOrderByColumn(AppDocumentPeer::DOC_VERSION);
|
||||||
|
$dataset = AppDocumentPeer::doSelectRS($criteria);
|
||||||
|
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
$dataset->next();
|
||||||
|
$config = new Configurations();
|
||||||
|
$confEnvSetting = $config->getFormats();
|
||||||
|
$user = new Users();
|
||||||
|
|
||||||
|
$arrayInputDocument = array();
|
||||||
|
while ($row = $dataset->getRow()) {
|
||||||
|
//todo, we use this *** in others endpoint for mark that user not exist, but we need to change
|
||||||
|
$userInfo = '***';
|
||||||
|
if ($row["USR_UID"] !== '-1') {
|
||||||
|
$arrayUserData = $user->load($row["USR_UID"]);
|
||||||
|
$userInfo = $config->usersNameFormatBySetParameters($confEnvSetting["format"], $arrayUserData["USR_USERNAME"], $arrayUserData["USR_FIRSTNAME"], $arrayUserData["USR_LASTNAME"]);
|
||||||
|
}
|
||||||
|
$row["APP_DOC_CREATE_USER"] = $userInfo;
|
||||||
|
$arrayInputDocument[] = $this->getAppDocumentDataFromRecord($row);
|
||||||
|
$dataset->next();
|
||||||
|
}
|
||||||
|
return $arrayInputDocument;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,31 @@ use AppDelayPeer;
|
|||||||
use ProcessMaker\Core\System;
|
use ProcessMaker\Core\System;
|
||||||
use ProcessMaker\Util\DateTime;
|
use ProcessMaker\Util\DateTime;
|
||||||
use PmLicenseManager;
|
use PmLicenseManager;
|
||||||
|
use Bootstrap;
|
||||||
|
use ProcessPeer;
|
||||||
|
use BpmnProjectPeer;
|
||||||
|
use Propel;
|
||||||
|
use ResultSet;
|
||||||
|
use Process;
|
||||||
|
use Cases;
|
||||||
|
use ProcessMaker\BusinessModel\Task as BusinessModelTask;
|
||||||
|
use ProcessMaker\Services\Api\Project\Activity\Step;
|
||||||
|
use Exception;
|
||||||
|
use AppCacheView;
|
||||||
|
use database;
|
||||||
|
use TaskPeer;
|
||||||
|
use StepPeer;
|
||||||
|
use GulliverBasePeer;
|
||||||
|
use AppDocument;
|
||||||
|
use Users;
|
||||||
|
use ProcessMaker\BusinessModel\User as BusinessModelUser;
|
||||||
|
use ProcessMaker\BusinessModel\Cases as BusinessModelCases;
|
||||||
|
use ProcessMaker\Core\RoutingScreen;
|
||||||
|
use Configurations;
|
||||||
|
use InputDocument;
|
||||||
|
use AppFolder;
|
||||||
|
use PMmemcached;
|
||||||
|
use RBAC;
|
||||||
|
|
||||||
class Light
|
class Light
|
||||||
{
|
{
|
||||||
@@ -21,7 +46,7 @@ class Light
|
|||||||
*
|
*
|
||||||
* @param $userId User id
|
* @param $userId User id
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getProcessListStartCase($userId)
|
public function getProcessListStartCase($userId)
|
||||||
{
|
{
|
||||||
@@ -29,9 +54,9 @@ class Light
|
|||||||
try {
|
try {
|
||||||
// getting bpmn projects
|
// getting bpmn projects
|
||||||
$c = new Criteria('workflow');
|
$c = new Criteria('workflow');
|
||||||
$c->addSelectColumn(\BpmnProjectPeer::PRJ_UID);
|
$c->addSelectColumn(BpmnProjectPeer::PRJ_UID);
|
||||||
$ds = \ProcessPeer::doSelectRS($c, \Propel::getDbConnection('workflow_ro'));
|
$ds = ProcessPeer::doSelectRS($c, Propel::getDbConnection('workflow_ro'));
|
||||||
$ds->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$bpmnProjects = array();
|
$bpmnProjects = array();
|
||||||
|
|
||||||
while ($ds->next()) {
|
while ($ds->next()) {
|
||||||
@@ -39,8 +64,8 @@ class Light
|
|||||||
$bpmnProjects[] = $row['PRJ_UID'];
|
$bpmnProjects[] = $row['PRJ_UID'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$oProcess = new \Process();
|
$oProcess = new Process();
|
||||||
$oCase = new \Cases();
|
$oCase = new Cases();
|
||||||
|
|
||||||
//Get ProcessStatistics Info
|
//Get ProcessStatistics Info
|
||||||
$start = 0;
|
$start = 0;
|
||||||
@@ -68,11 +93,11 @@ class Light
|
|||||||
$proData[$proInfo['PRO_UID']] = $proInfo;
|
$proData[$proInfo['PRO_UID']] = $proInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
$task = new \ProcessMaker\BusinessModel\Task();
|
$task = new BusinessModelTask();
|
||||||
$task->setFormatFieldNameInUppercase(false);
|
$task->setFormatFieldNameInUppercase(false);
|
||||||
$task->setArrayParamException(array("taskUid" => "act_uid", "stepUid" => "step_uid"));
|
$task->setArrayParamException(array("taskUid" => "act_uid", "stepUid" => "step_uid"));
|
||||||
|
|
||||||
$step = new \ProcessMaker\Services\Api\Project\Activity\Step();
|
$step = new Step();
|
||||||
$response = array();
|
$response = array();
|
||||||
foreach ($processList as $key => $processInfo) {
|
foreach ($processList as $key => $processInfo) {
|
||||||
$tempTreeChildren = array();
|
$tempTreeChildren = array();
|
||||||
@@ -81,7 +106,8 @@ class Light
|
|||||||
$tempTreeChild['text'] = $keyChild; //ellipsis ( $keyChild, 50 );
|
$tempTreeChild['text'] = $keyChild; //ellipsis ( $keyChild, 50 );
|
||||||
$tempTreeChild['processId'] = $processInfoChild['pro_uid'];
|
$tempTreeChild['processId'] = $processInfoChild['pro_uid'];
|
||||||
$tempTreeChild['taskId'] = $processInfoChild['uid'];
|
$tempTreeChild['taskId'] = $processInfoChild['uid'];
|
||||||
list($tempTreeChild['offlineEnabled'], $tempTreeChild['autoRoot']) = $task->getColumnValues($processInfoChild['pro_uid'], $processInfoChild['uid'], array('TAS_OFFLINE', 'TAS_AUTO_ROOT'));
|
list($tempTreeChild['offlineEnabled'], $tempTreeChild['autoRoot']) = $task->getColumnValues($processInfoChild['pro_uid'],
|
||||||
|
$processInfoChild['uid'], array('TAS_OFFLINE', 'TAS_AUTO_ROOT'));
|
||||||
//Add process category
|
//Add process category
|
||||||
$tempTreeChild['categoryName'] = $processInfoChild['catname'];
|
$tempTreeChild['categoryName'] = $processInfoChild['catname'];
|
||||||
$tempTreeChild['categoryId'] = $processInfoChild['cat'];
|
$tempTreeChild['categoryId'] = $processInfoChild['cat'];
|
||||||
@@ -102,7 +128,8 @@ class Light
|
|||||||
$newForm[$c]['stepMode'] = $form['step_mode'];
|
$newForm[$c]['stepMode'] = $form['step_mode'];
|
||||||
$newForm[$c]['stepCondition'] = $form['step_condition'];
|
$newForm[$c]['stepCondition'] = $form['step_condition'];
|
||||||
$newForm[$c]['stepPosition'] = $form['step_position'];
|
$newForm[$c]['stepPosition'] = $form['step_position'];
|
||||||
$trigger = $this->statusTriggers($step->doGetActivityStepTriggers($form["step_uid"], $tempTreeChild['taskId'], $tempTreeChild['processId']));
|
$trigger = $this->statusTriggers($step->doGetActivityStepTriggers($form["step_uid"],
|
||||||
|
$tempTreeChild['taskId'], $tempTreeChild['processId']));
|
||||||
$newForm[$c]["triggers"] = $trigger;
|
$newForm[$c]["triggers"] = $trigger;
|
||||||
$c++;
|
$c++;
|
||||||
}
|
}
|
||||||
@@ -115,9 +142,10 @@ class Light
|
|||||||
}
|
}
|
||||||
$response = array_merge($response, $tempTreeChildren);
|
$response = array_merge($response, $tempTreeChildren);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -137,6 +165,7 @@ class Light
|
|||||||
$return["after"] = true;
|
$return["after"] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,13 +173,13 @@ class Light
|
|||||||
* Get counters each type of list
|
* Get counters each type of list
|
||||||
* @param $userId
|
* @param $userId
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getCounterCase($userId)
|
public function getCounterCase($userId)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$userUid = (isset($userId) && $userId != '') ? $userId : null;
|
$userUid = (isset($userId) && $userId != '') ? $userId : null;
|
||||||
$oAppCache = new \AppCacheView();
|
$oAppCache = new AppCacheView();
|
||||||
|
|
||||||
$aTypes = Array();
|
$aTypes = Array();
|
||||||
$aTypes['to_do'] = 'toDo';
|
$aTypes['to_do'] = 'toDo';
|
||||||
@@ -167,9 +196,10 @@ class Light
|
|||||||
foreach ($aCount as $type => $count) {
|
foreach ($aCount as $type => $count) {
|
||||||
$response[$aTypes[$type]] = $count;
|
$response[$aTypes[$type]] = $count;
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,10 +221,11 @@ class Light
|
|||||||
$sDataBase = 'database_' . strtolower(DB_ADAPTER);
|
$sDataBase = 'database_' . strtolower(DB_ADAPTER);
|
||||||
if (G::LoadSystemExist($sDataBase)) {
|
if (G::LoadSystemExist($sDataBase)) {
|
||||||
|
|
||||||
$oDataBase = new \database();
|
$oDataBase = new database();
|
||||||
$c->addAsColumn('USR_NAME', $oDataBase->concatString("USR_LASTNAME", "' '", "USR_FIRSTNAME"));
|
$c->addAsColumn('USR_NAME', $oDataBase->concatString("USR_LASTNAME", "' '", "USR_FIRSTNAME"));
|
||||||
$c->addAsColumn(
|
$c->addAsColumn(
|
||||||
'DEL_FINISH_DATE', $oDataBase->getCaseWhen("DEL_FINISH_DATE IS NULL", "'-'", AppDelegationPeer::DEL_FINISH_DATE)
|
'DEL_FINISH_DATE',
|
||||||
|
$oDataBase->getCaseWhen("DEL_FINISH_DATE IS NULL", "'-'", AppDelegationPeer::DEL_FINISH_DATE)
|
||||||
);
|
);
|
||||||
$c->addAsColumn(
|
$c->addAsColumn(
|
||||||
'APP_TYPE', $oDataBase->getCaseWhen("DEL_FINISH_DATE IS NULL", "'IN_PROGRESS'", AppDelayPeer::APP_TYPE)
|
'APP_TYPE', $oDataBase->getCaseWhen("DEL_FINISH_DATE IS NULL", "'IN_PROGRESS'", AppDelayPeer::APP_TYPE)
|
||||||
@@ -203,13 +234,10 @@ class Light
|
|||||||
$c->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);
|
$c->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE);
|
||||||
$c->addSelectColumn(AppDelayPeer::APP_ENABLE_ACTION_DATE);
|
$c->addSelectColumn(AppDelayPeer::APP_ENABLE_ACTION_DATE);
|
||||||
$c->addSelectColumn(AppDelayPeer::APP_DISABLE_ACTION_DATE);
|
$c->addSelectColumn(AppDelayPeer::APP_DISABLE_ACTION_DATE);
|
||||||
$c->addSelectColumn(\TaskPeer::TAS_TITLE);
|
$c->addSelectColumn(TaskPeer::TAS_TITLE);
|
||||||
//APP_DELEGATION LEFT JOIN USERS
|
//APP_DELEGATION LEFT JOIN USERS
|
||||||
$c->addJoin(AppDelegationPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
|
$c->addJoin(AppDelegationPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN);
|
||||||
|
|
||||||
//APP_DELAY FOR MORE DESCRIPTION
|
|
||||||
//$c->addJoin(AppDelegationPeer::DEL_INDEX, AppDelayPeer::APP_DEL_INDEX, Criteria::LEFT_JOIN);
|
|
||||||
//$c->addJoin(AppDelegationPeer::APP_UID, AppDelayPeer::APP_UID, Criteria::LEFT_JOIN);
|
|
||||||
$del = \DBAdapter::getStringDelimiter();
|
$del = \DBAdapter::getStringDelimiter();
|
||||||
$app = array();
|
$app = array();
|
||||||
$app[] = array(AppDelegationPeer::DEL_INDEX, AppDelayPeer::APP_DEL_INDEX);
|
$app[] = array(AppDelegationPeer::DEL_INDEX, AppDelayPeer::APP_DEL_INDEX);
|
||||||
@@ -217,7 +245,7 @@ class Light
|
|||||||
$c->addJoinMC($app, Criteria::LEFT_JOIN);
|
$c->addJoinMC($app, Criteria::LEFT_JOIN);
|
||||||
|
|
||||||
//LEFT JOIN TASK TAS_TITLE
|
//LEFT JOIN TASK TAS_TITLE
|
||||||
$c->addJoin(AppDelegationPeer::TAS_UID, \TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
|
$c->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
|
||||||
|
|
||||||
//WHERE
|
//WHERE
|
||||||
$c->add(AppDelegationPeer::APP_UID, $sAppUid);
|
$c->add(AppDelegationPeer::APP_UID, $sAppUid);
|
||||||
@@ -234,19 +262,17 @@ class Light
|
|||||||
*
|
*
|
||||||
* @param $app_uid
|
* @param $app_uid
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getCasesListHistory($app_uid)
|
public function getCasesListHistory($app_uid)
|
||||||
{
|
{
|
||||||
|
|
||||||
//global $G_PUBLISH;
|
//global $G_PUBLISH;
|
||||||
$c = $this->getTransferHistoryCriteria($app_uid);
|
$c = $this->getTransferHistoryCriteria($app_uid);
|
||||||
|
|
||||||
//$result = new \stdClass();
|
|
||||||
$aProcesses = Array();
|
$aProcesses = Array();
|
||||||
|
|
||||||
$rs = \GulliverBasePeer::doSelectRs( $c );
|
$rs = GulliverBasePeer::doSelectRs($c);
|
||||||
$rs->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
|
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$rs->next();
|
$rs->next();
|
||||||
for ($j = 0; $j < $rs->getRecordCount(); $j++) {
|
for ($j = 0; $j < $rs->getRecordCount(); $j++) {
|
||||||
$result = $rs->getRow();
|
$result = $rs->getRow();
|
||||||
@@ -256,17 +282,14 @@ class Light
|
|||||||
$processUid = $result["PRO_UID"];
|
$processUid = $result["PRO_UID"];
|
||||||
}
|
}
|
||||||
|
|
||||||
$process = new \Process();
|
$process = new Process();
|
||||||
|
|
||||||
$arrayProcessData = $process->load($processUid);
|
$arrayProcessData = $process->load($processUid);
|
||||||
|
|
||||||
//$newDir = '/tmp/test/directory';
|
|
||||||
//G::verifyPath( $newDir );
|
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
$result["processName"] = $arrayProcessData["PRO_TITLE"];
|
$result["processName"] = $arrayProcessData["PRO_TITLE"];
|
||||||
//$result["PRO_DESCRIPTION"] = $arrayProcessData["PRO_DESCRIPTION"];
|
|
||||||
$result['flow'] = $aProcesses;
|
$result['flow'] = $aProcesses;
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,16 +300,16 @@ class Light
|
|||||||
* @param string $proUid
|
* @param string $proUid
|
||||||
* @param string $taskUid
|
* @param string $taskUid
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function startCase($userId = '', $proUid = '', $taskUid = '')
|
public function startCase($userId = '', $proUid = '', $taskUid = '')
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oCase = new \Cases();
|
$oCase = new Cases();
|
||||||
|
|
||||||
$aData = $oCase->startCase($taskUid, $userId);
|
$aData = $oCase->startCase($taskUid, $userId);
|
||||||
|
|
||||||
$user = new \ProcessMaker\BusinessModel\User();
|
$user = new BusinessModelUser();
|
||||||
$arrayUserData = $user->getUserRecordByPk($userId, ['$userUid' => '$userId']);
|
$arrayUserData = $user->getUserRecordByPk($userId, ['$userUid' => '$userId']);
|
||||||
|
|
||||||
$_SESSION['APPLICATION'] = $aData['APPLICATION'];
|
$_SESSION['APPLICATION'] = $aData['APPLICATION'];
|
||||||
@@ -305,11 +328,13 @@ class Light
|
|||||||
$response['caseNumber'] = $aData['CASE_NUMBER'];
|
$response['caseNumber'] = $aData['CASE_NUMBER'];
|
||||||
|
|
||||||
//Log
|
//Log
|
||||||
\Bootstrap::registerMonolog('MobileCreateCase', 200, "Create case", ['application_uid' => $aData['APPLICATION'], 'usr_uid' => $userId], SYS_SYS, 'processmaker.log');
|
Bootstrap::registerMonolog('MobileCreateCase', 200, "Create case",
|
||||||
|
['application_uid' => $aData['APPLICATION'], 'usr_uid' => $userId], SYS_SYS, 'processmaker.log');
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$response['status'] = 'failure';
|
$response['status'] = 'failure';
|
||||||
$response['message'] = $e->getMessage();
|
$response['message'] = $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -317,33 +342,34 @@ class Light
|
|||||||
{
|
{
|
||||||
$oContent = new \Content();
|
$oContent = new \Content();
|
||||||
///we are looking for a pro title for this process $sproUid
|
///we are looking for a pro title for this process $sproUid
|
||||||
$oCriteria = new \Criteria( 'workflow' );
|
$oCriteria = new Criteria('workflow');
|
||||||
$oCriteria->add(\ProcessPeer::PRO_UID, $sproUid);
|
$oCriteria->add(ProcessPeer::PRO_UID, $sproUid);
|
||||||
$oDataset = \ProcessPeer::doSelectRS( $oCriteria );
|
$oDataset = ProcessPeer::doSelectRS($oCriteria);
|
||||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
$aRow = $oDataset->getRow();
|
$aRow = $oDataset->getRow();
|
||||||
if (!is_array($aRow)) {
|
if (!is_array($aRow)) {
|
||||||
$oC = new \Criteria('workflow');
|
$oC = new Criteria('workflow');
|
||||||
$oC->addSelectColumn(\TaskPeer::TAS_UID);
|
$oC->addSelectColumn(TaskPeer::TAS_UID);
|
||||||
$oC->addSelectColumn(\TaskPeer::TAS_TITLE);
|
$oC->addSelectColumn(TaskPeer::TAS_TITLE);
|
||||||
$oC->add(\TaskPeer::PRO_UID, $sproUid);
|
$oC->add(TaskPeer::PRO_UID, $sproUid);
|
||||||
$oDataset1 = \TaskPeer::doSelectRS($oC);
|
$oDataset1 = TaskPeer::doSelectRS($oC);
|
||||||
$oDataset1->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
while ($oDataset1->next()) {
|
while ($oDataset1->next()) {
|
||||||
$aRow1 = $oDataset1->getRow();
|
$aRow1 = $oDataset1->getRow();
|
||||||
\Content::insertContent('TAS_TITLE', '', $aRow1['TAS_UID'], 'en', $aRow1['TAS_TITLE']);
|
\Content::insertContent('TAS_TITLE', '', $aRow1['TAS_UID'], 'en', $aRow1['TAS_TITLE']);
|
||||||
}
|
}
|
||||||
$oC2 = new Criteria('workflow');
|
$oC2 = new Criteria('workflow');
|
||||||
$oC2->addSelectColumn(\ProcessPeer::PRO_UID);
|
$oC2->addSelectColumn(ProcessPeer::PRO_UID);
|
||||||
$oC2->addSelectColumn(\ProcessPeer::PRO_TITLE);
|
$oC2->addSelectColumn(ProcessPeer::PRO_TITLE);
|
||||||
$oC2->add(\ProcessPeer::PRO_UID, $sproUid);
|
$oC2->add(ProcessPeer::PRO_UID, $sproUid);
|
||||||
$oDataset3 = \ProcessPeer::doSelectRS($oC2);
|
$oDataset3 = ProcessPeer::doSelectRS($oC2);
|
||||||
$oDataset3->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$oDataset3->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$oDataset3->next();
|
$oDataset3->next();
|
||||||
$aRow3 = $oDataset3->getRow();
|
$aRow3 = $oDataset3->getRow();
|
||||||
\Content::insertContent('PRO_TITLE', '', $aRow3['PRO_UID'], 'en', $aRow3['PRO_TITLE']);
|
\Content::insertContent('PRO_TITLE', '', $aRow3['PRO_UID'], 'en', $aRow3['PRO_TITLE']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -355,20 +381,20 @@ class Light
|
|||||||
public function doExecuteTriggerCase($usr_uid, $prj_uid, $act_uid, $cas_uid, $step_uid, $type, $del_index = null)
|
public function doExecuteTriggerCase($usr_uid, $prj_uid, $act_uid, $cas_uid, $step_uid, $type, $del_index = null)
|
||||||
{
|
{
|
||||||
$userData = $this->getUserData($usr_uid);
|
$userData = $this->getUserData($usr_uid);
|
||||||
$c = new \Criteria();
|
$c = new Criteria();
|
||||||
$c->clearSelectColumns();
|
$c->clearSelectColumns();
|
||||||
$c->addSelectColumn(\StepPeer::STEP_UID);
|
$c->addSelectColumn(StepPeer::STEP_UID);
|
||||||
$c->addSelectColumn(\StepPeer::STEP_UID_OBJ);
|
$c->addSelectColumn(StepPeer::STEP_UID_OBJ);
|
||||||
$c->add(\StepPeer::TAS_UID, $act_uid);
|
$c->add(StepPeer::TAS_UID, $act_uid);
|
||||||
$c->add(\StepPeer::STEP_TYPE_OBJ, 'DYNAFORM');
|
$c->add(StepPeer::STEP_TYPE_OBJ, 'DYNAFORM');
|
||||||
$c->add(\StepPeer::STEP_UID, $step_uid);
|
$c->add(StepPeer::STEP_UID, $step_uid);
|
||||||
$rs = \StepPeer::doSelectRS($c);
|
$rs = StepPeer::doSelectRS($c);
|
||||||
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$rs->next();
|
$rs->next();
|
||||||
$row = $rs->getRow();
|
$row = $rs->getRow();
|
||||||
$step_uid_obj = $row['STEP_UID_OBJ'];
|
$step_uid_obj = $row['STEP_UID_OBJ'];
|
||||||
|
|
||||||
$oCase = new \Cases();
|
$oCase = new Cases();
|
||||||
$Fields = $oCase->loadCase($cas_uid);
|
$Fields = $oCase->loadCase($cas_uid);
|
||||||
$_SESSION["APPLICATION"] = $cas_uid;
|
$_SESSION["APPLICATION"] = $cas_uid;
|
||||||
$_SESSION["PROCESS"] = $prj_uid;
|
$_SESSION["PROCESS"] = $prj_uid;
|
||||||
@@ -379,7 +405,8 @@ class Light
|
|||||||
$Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], G::getSystemConstants());
|
$Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], G::getSystemConstants());
|
||||||
$triggers = $oCase->loadTriggers($act_uid, 'DYNAFORM', $step_uid_obj, strtoupper($type));
|
$triggers = $oCase->loadTriggers($act_uid, 'DYNAFORM', $step_uid_obj, strtoupper($type));
|
||||||
if ($triggers) {
|
if ($triggers) {
|
||||||
$Fields['APP_DATA'] = $oCase->ExecuteTriggers( $act_uid, 'DYNAFORM', $step_uid_obj, strtoupper($type), $Fields['APP_DATA'] );
|
$Fields['APP_DATA'] = $oCase->ExecuteTriggers($act_uid, 'DYNAFORM', $step_uid_obj, strtoupper($type),
|
||||||
|
$Fields['APP_DATA']);
|
||||||
}
|
}
|
||||||
$Fields['TAS_UID'] = $act_uid;
|
$Fields['TAS_UID'] = $act_uid;
|
||||||
$Fields['CURRENT_DYNAFORM'] = $step_uid_obj;
|
$Fields['CURRENT_DYNAFORM'] = $step_uid_obj;
|
||||||
@@ -387,6 +414,7 @@ class Light
|
|||||||
$Fields['PRO_UID'] = $prj_uid;
|
$Fields['PRO_UID'] = $prj_uid;
|
||||||
$oCase->updateCase($cas_uid, $Fields);
|
$oCase->updateCase($cas_uid, $Fields);
|
||||||
$response = array('status' => 'ok');
|
$response = array('status' => 'ok');
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -399,7 +427,7 @@ class Light
|
|||||||
public function getPrepareInformation($usr_uid, $tas_uid, $app_uid, $del_index = null)
|
public function getPrepareInformation($usr_uid, $tas_uid, $app_uid, $del_index = null)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oCase = new \Cases();
|
$oCase = new Cases();
|
||||||
$Fields = $oCase->loadCase($app_uid);
|
$Fields = $oCase->loadCase($app_uid);
|
||||||
$_SESSION["APPLICATION"] = $app_uid;
|
$_SESSION["APPLICATION"] = $app_uid;
|
||||||
$_SESSION["PROCESS"] = $Fields['PRO_UID'];
|
$_SESSION["PROCESS"] = $Fields['PRO_UID'];
|
||||||
@@ -411,7 +439,8 @@ class Light
|
|||||||
$triggers = $oCase->loadTriggers($tas_uid, 'ASSIGN_TASK', '-1', 'BEFORE');
|
$triggers = $oCase->loadTriggers($tas_uid, 'ASSIGN_TASK', '-1', 'BEFORE');
|
||||||
if (isset($triggers)) {
|
if (isset($triggers)) {
|
||||||
$Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], G::getSystemConstants());
|
$Fields['APP_DATA'] = array_merge($Fields['APP_DATA'], G::getSystemConstants());
|
||||||
$Fields['APP_DATA'] = $oCase->ExecuteTriggers( $tas_uid, 'DYNAFORM', '-1', 'BEFORE', $Fields['APP_DATA'] );
|
$Fields['APP_DATA'] = $oCase->ExecuteTriggers($tas_uid, 'DYNAFORM', '-1', 'BEFORE',
|
||||||
|
$Fields['APP_DATA']);
|
||||||
$oCase->updateCase($app_uid, $Fields);
|
$oCase->updateCase($app_uid, $Fields);
|
||||||
}
|
}
|
||||||
$oDerivation = new \Derivation();
|
$oDerivation = new \Derivation();
|
||||||
@@ -419,15 +448,17 @@ class Light
|
|||||||
$aData['APP_UID'] = $app_uid;
|
$aData['APP_UID'] = $app_uid;
|
||||||
$aData['DEL_INDEX'] = $del_index;
|
$aData['DEL_INDEX'] = $del_index;
|
||||||
$aData['USER_UID'] = $usr_uid;
|
$aData['USER_UID'] = $usr_uid;
|
||||||
$oRoute = new \ProcessMaker\Core\RoutingScreen();
|
$oRoute = new RoutingScreen();
|
||||||
$derive = $oRoute->prepareRoutingScreen($aData);
|
$derive = $oRoute->prepareRoutingScreen($aData);
|
||||||
$response = array();
|
$response = array();
|
||||||
foreach ($derive as $sKey => &$aValues) {
|
foreach ($derive as $sKey => &$aValues) {
|
||||||
$sPriority = ''; //set priority value
|
$sPriority = ''; //set priority value
|
||||||
if ($derive[$sKey]['NEXT_TASK']['TAS_PRIORITY_VARIABLE'] != '') {
|
if ($derive[$sKey]['NEXT_TASK']['TAS_PRIORITY_VARIABLE'] != '') {
|
||||||
//TO DO: review this type of assignment
|
//TO DO: review this type of assignment
|
||||||
if (isset( $aData['APP_DATA'][str_replace( '@@', '', $derive[$sKey]['NEXT_TASK']['TAS_PRIORITY_VARIABLE'] )] )) {
|
if (isset($aData['APP_DATA'][str_replace('@@', '',
|
||||||
$sPriority = $aData['APP_DATA'][str_replace( '@@', '', $derive[$sKey]['NEXT_TASK']['TAS_PRIORITY_VARIABLE'] )];
|
$derive[$sKey]['NEXT_TASK']['TAS_PRIORITY_VARIABLE'])])) {
|
||||||
|
$sPriority = $aData['APP_DATA'][str_replace('@@', '',
|
||||||
|
$derive[$sKey]['NEXT_TASK']['TAS_PRIORITY_VARIABLE'])];
|
||||||
}
|
}
|
||||||
} //set priority value
|
} //set priority value
|
||||||
|
|
||||||
@@ -502,11 +533,12 @@ class Light
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (empty($response)) {
|
if (empty($response)) {
|
||||||
throw new \Exception(G::LoadTranslation("ID_NO_DERIVATION_RULE"));
|
throw new Exception(G::LoadTranslation("ID_NO_DERIVATION_RULE"));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -529,11 +561,12 @@ class Light
|
|||||||
}
|
}
|
||||||
|
|
||||||
$ws = new \WsBase();
|
$ws = new \WsBase();
|
||||||
$fields = $ws->derivateCase($userUid, $applicationUid, $delIndex, $bExecuteTriggersBeforeAssignment = false, $tasks);
|
$fields = $ws->derivateCase($userUid, $applicationUid, $delIndex, $bExecuteTriggersBeforeAssignment = false,
|
||||||
|
$tasks);
|
||||||
$array = json_decode(json_encode($fields), true);
|
$array = json_decode(json_encode($fields), true);
|
||||||
$array['message'] = trim(strip_tags($array['message']));
|
$array['message'] = trim(strip_tags($array['message']));
|
||||||
if ($array ["status_code"] != 0) {
|
if ($array ["status_code"] != 0) {
|
||||||
throw (new \Exception($array ["message"]));
|
throw (new Exception($array ["message"]));
|
||||||
} else {
|
} else {
|
||||||
unset($array['status_code']);
|
unset($array['status_code']);
|
||||||
unset($array['message']);
|
unset($array['message']);
|
||||||
@@ -541,10 +574,12 @@ class Light
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Log
|
//Log
|
||||||
\Bootstrap::registerMonolog('MobileRouteCase', 200, 'Route case', ['application_uid' => $applicationUid, 'usr_uid' => $userUid], SYS_SYS, 'processmaker.log');
|
Bootstrap::registerMonolog('MobileRouteCase', 200, 'Route case',
|
||||||
} catch (\Exception $e) {
|
['application_uid' => $applicationUid, 'usr_uid' => $userUid], SYS_SYS, 'processmaker.log');
|
||||||
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -580,9 +615,10 @@ class Light
|
|||||||
$response['userPhone'] = $aUserLog['USR_PHONE'];
|
$response['userPhone'] = $aUserLog['USR_PHONE'];
|
||||||
$response['updateDate'] = $aUserLog['USR_UPDATE_DATE'];
|
$response['updateDate'] = $aUserLog['USR_UPDATE_DATE'];
|
||||||
$response['userPhoto'] = base64_encode($contenido);
|
$response['userPhoto'] = base64_encode($contenido);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,7 +631,7 @@ class Light
|
|||||||
public function downloadFile($app_uid, $request_data)
|
public function downloadFile($app_uid, $request_data)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oAppDocument = new \AppDocument();
|
$oAppDocument = new AppDocument();
|
||||||
$arrayFiles = array();
|
$arrayFiles = array();
|
||||||
foreach ($request_data as $key => $fileData) {
|
foreach ($request_data as $key => $fileData) {
|
||||||
if (!isset($fileData['version'])) {
|
if (!isset($fileData['version'])) {
|
||||||
@@ -611,8 +647,8 @@ class Light
|
|||||||
$info = pathinfo($oAppDocument->getAppDocFilename());
|
$info = pathinfo($oAppDocument->getAppDocFilename());
|
||||||
$ext = (isset($info['extension']) ? $info['extension'] : '');//BUG fix: must handle files without any extension
|
$ext = (isset($info['extension']) ? $info['extension'] : '');//BUG fix: must handle files without any extension
|
||||||
|
|
||||||
//$app_uid = \G::getPathFromUID($oAppDocument->Fields['APP_UID']);
|
//$app_uid = G::getPathFromUID($oAppDocument->Fields['APP_UID']);
|
||||||
$file = \G::getPathFromFileUID($oAppDocument->Fields['APP_UID'], $sAppDocUid);
|
$file = G::getPathFromFileUID($oAppDocument->Fields['APP_UID'], $sAppDocUid);
|
||||||
|
|
||||||
$realPath = PATH_DOCUMENT . G::getPathFromUID($app_uid) . '/' . $file[0] . $file[1] . '_' . $iDocVersion . '.' . $ext;
|
$realPath = PATH_DOCUMENT . G::getPathFromUID($app_uid) . '/' . $file[0] . $file[1] . '_' . $iDocVersion . '.' . $ext;
|
||||||
$realPath1 = PATH_DOCUMENT . G::getPathFromUID($app_uid) . '/' . $file[0] . $file[1] . '.' . $ext;
|
$realPath1 = PATH_DOCUMENT . G::getPathFromUID($app_uid) . '/' . $file[0] . $file[1] . '.' . $ext;
|
||||||
@@ -626,7 +662,8 @@ class Light
|
|||||||
case 'gif':
|
case 'gif':
|
||||||
case 'png':
|
case 'png':
|
||||||
$arrayFiles[$key]['fileId'] = $fileData['fileId'];
|
$arrayFiles[$key]['fileId'] = $fileData['fileId'];
|
||||||
$arrayFiles[$key]['fileContent'] = base64_encode($this->imagesThumbnails($realPath, $ext, $width, $height));
|
$arrayFiles[$key]['fileContent'] = base64_encode($this->imagesThumbnails($realPath, $ext,
|
||||||
|
$width, $height));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$fileTmp = fopen($realPath, "r");
|
$fileTmp = fopen($realPath, "r");
|
||||||
@@ -643,7 +680,8 @@ class Light
|
|||||||
case 'gif':
|
case 'gif':
|
||||||
case 'png':
|
case 'png':
|
||||||
$arrayFiles[$key]['fileId'] = $fileData['fileId'];
|
$arrayFiles[$key]['fileId'] = $fileData['fileId'];
|
||||||
$arrayFiles[$key]['fileContent'] = $this->imagesThumbnails($realPath1, $ext, $width, $height);
|
$arrayFiles[$key]['fileContent'] = $this->imagesThumbnails($realPath1, $ext, $width,
|
||||||
|
$height);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$fileTmp = fopen($realPath, "r");
|
$fileTmp = fopen($realPath, "r");
|
||||||
@@ -655,9 +693,10 @@ class Light
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $arrayFiles;
|
return $arrayFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -727,6 +766,7 @@ class Light
|
|||||||
}
|
}
|
||||||
$image = ob_get_clean();
|
$image = ob_get_clean();
|
||||||
imagedestroy($thumb);
|
imagedestroy($thumb);
|
||||||
|
|
||||||
return $image;
|
return $image;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -784,7 +824,8 @@ class Light
|
|||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
$licenseManager =& PmLicenseManager::getSingleton();
|
$licenseManager =& PmLicenseManager::getSingleton();
|
||||||
if (in_array(md5($licenseManager->result), array('38afd7ae34bd5e3e6fc170d8b09178a3', 'ba2b45bdc11e2a4a6e86aab2ac693cbb'))) {
|
if (in_array(md5($licenseManager->result),
|
||||||
|
array('38afd7ae34bd5e3e6fc170d8b09178a3', 'ba2b45bdc11e2a4a6e86aab2ac693cbb'))) {
|
||||||
$G_PUBLISH = new \Publisher();
|
$G_PUBLISH = new \Publisher();
|
||||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/licenseExpired', '', array(), 'licenseUpdate');
|
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/licenseExpired', '', array(), 'licenseUpdate');
|
||||||
G::RenderPage('publish');
|
G::RenderPage('publish');
|
||||||
@@ -801,6 +842,7 @@ class Light
|
|||||||
$response["status"] = "ERROR";
|
$response["status"] = "ERROR";
|
||||||
$response["message"] = $e->getMessage();
|
$response["message"] = $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -811,7 +853,7 @@ class Light
|
|||||||
* @param $userUid
|
* @param $userUid
|
||||||
* @param $type
|
* @param $type
|
||||||
* @param $app_uid
|
* @param $app_uid
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getInformation($userUid, $type, $app_uid)
|
public function getInformation($userUid, $type, $app_uid)
|
||||||
{
|
{
|
||||||
@@ -820,22 +862,23 @@ class Light
|
|||||||
case 'unassigned':
|
case 'unassigned':
|
||||||
case 'paused':
|
case 'paused':
|
||||||
case 'participated':
|
case 'participated':
|
||||||
$oCase = new \Cases();
|
$oCase = new Cases();
|
||||||
$iDelIndex = $oCase->getCurrentDelegationCase($app_uid);
|
$iDelIndex = $oCase->getCurrentDelegationCase($app_uid);
|
||||||
$aFields = $oCase->loadCase($app_uid, $iDelIndex);
|
$aFields = $oCase->loadCase($app_uid, $iDelIndex);
|
||||||
$response = $this->getInfoResume($userUid, $aFields, $type);
|
$response = $this->getInfoResume($userUid, $aFields, $type);
|
||||||
break;
|
break;
|
||||||
case 'lastopenindex':
|
case 'lastopenindex':
|
||||||
//Get the last participate from a user
|
//Get the last participate from a user
|
||||||
$oNewCase = new \ProcessMaker\BusinessModel\Cases();
|
$oNewCase = new BusinessModelCases();
|
||||||
$iDelIndex = $oNewCase->getLastParticipatedByUser($app_uid, $userUid, 'OPEN');
|
$iDelIndex = $oNewCase->getLastParticipatedByUser($app_uid, $userUid, 'OPEN');
|
||||||
$oCase = new \Cases();
|
$oCase = new Cases();
|
||||||
$aFields = $oCase->loadCase($app_uid, $iDelIndex);
|
$aFields = $oCase->loadCase($app_uid, $iDelIndex);
|
||||||
$aFields['DEL_INDEX'] = $iDelIndex === 0 ? '' : $iDelIndex;
|
$aFields['DEL_INDEX'] = $iDelIndex === 0 ? '' : $iDelIndex;
|
||||||
$aFields['USR_UID'] = $userUid;
|
$aFields['USR_UID'] = $userUid;
|
||||||
$response = $this->getInfoResume($userUid, $aFields, $type);
|
$response = $this->getInfoResume($userUid, $aFields, $type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -845,12 +888,12 @@ class Light
|
|||||||
* @param $userUid
|
* @param $userUid
|
||||||
* @param $Fields
|
* @param $Fields
|
||||||
* @param $type
|
* @param $type
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function getInfoResume($userUid, $Fields, $type)
|
public function getInfoResume($userUid, $Fields, $type)
|
||||||
{
|
{
|
||||||
/* Prepare page before to show */
|
/* Prepare page before to show */
|
||||||
$objProc = new \Process();
|
$objProc = new Process();
|
||||||
$aProc = $objProc->load($Fields['PRO_UID']);
|
$aProc = $objProc->load($Fields['PRO_UID']);
|
||||||
$Fields['PRO_TITLE'] = $aProc['PRO_TITLE'];
|
$Fields['PRO_TITLE'] = $aProc['PRO_TITLE'];
|
||||||
|
|
||||||
@@ -875,43 +918,47 @@ class Light
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* first step for upload file
|
* First step for upload file
|
||||||
* create uid app_document for upload file
|
* create uid app_document for upload file
|
||||||
*
|
*
|
||||||
* @param $userUid
|
* @param string $userUid
|
||||||
* @param $Fields
|
* @param string $appUid
|
||||||
* @param $type
|
* @param array $requestData
|
||||||
* @throws \Exception
|
* @return array $response
|
||||||
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function postUidUploadFiles($userUid, $app_uid, $request_data)
|
public function postUidUploadFiles($userUid, $appUid, $requestData)
|
||||||
{
|
{
|
||||||
$response = array();
|
$response = array();
|
||||||
if (is_array($request_data)) {
|
if (is_array($requestData)) {
|
||||||
foreach ($request_data as $k => $file) {
|
$config = new Configurations();
|
||||||
|
$confEnvSetting = $config->getFormats();
|
||||||
|
$user = new Users();
|
||||||
|
foreach ($requestData as $k => $file) {
|
||||||
$ext = pathinfo($file['name'], PATHINFO_EXTENSION);
|
$ext = pathinfo($file['name'], PATHINFO_EXTENSION);
|
||||||
if (\Bootstrap::getDisablePhpUploadExecution() === 1 && $ext === 'php') {
|
if (Bootstrap::getDisablePhpUploadExecution() === 1 && $ext === 'php') {
|
||||||
$message = \G::LoadTranslation('THE_UPLOAD_OF_PHP_FILES_WAS_DISABLED');
|
$message = G::LoadTranslation('THE_UPLOAD_OF_PHP_FILES_WAS_DISABLED');
|
||||||
\Bootstrap::registerMonologPhpUploadExecution('phpUpload', 550, $message, $file['name']);
|
Bootstrap::registerMonologPhpUploadExecution('phpUpload', 550, $message, $file['name']);
|
||||||
$response[$k]['error'] = array(
|
$response[$k]['error'] = array(
|
||||||
"code" => "400",
|
"code" => "400",
|
||||||
"message" => $message
|
"message" => $message
|
||||||
);
|
);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$oCase = new \Cases();
|
$cases = new Cases();
|
||||||
$delIndex = $oCase->getCurrentDelegation($app_uid, $userUid);
|
$delIndex = $cases->getCurrentDelegation($appUid, $userUid);
|
||||||
$docUid = !empty($file['docUid']) ? $file['docUid'] : -1;
|
$docUid = !empty($file['docUid']) ? $file['docUid'] : -1;
|
||||||
$folderId = '';
|
$folderId = '';
|
||||||
if ($docUid !== -1) {
|
if ($docUid !== -1) {
|
||||||
$inputDocument = new \InputDocument();
|
$inputDocument = new InputDocument();
|
||||||
$aInputDocumentData = $inputDocument->load($docUid);
|
$aInputDocumentData = $inputDocument->load($docUid);
|
||||||
$appFolder = new \AppFolder();
|
$appFolder = new AppFolder();
|
||||||
$folderId = $appFolder->createFromPath($aInputDocumentData["INP_DOC_DESTINATION_PATH"], $app_uid);
|
$folderId = $appFolder->createFromPath($aInputDocumentData["INP_DOC_DESTINATION_PATH"], $appUid);
|
||||||
}
|
}
|
||||||
$appDocType = !empty($file['appDocType']) ? $file['appDocType'] : "ATTACHED";
|
$appDocType = !empty($file['appDocType']) ? $file['appDocType'] : "ATTACHED";
|
||||||
$fieldName = !empty($file['fieldName']) ? $file['fieldName'] : null;
|
$fieldName = !empty($file['fieldName']) ? $file['fieldName'] : null;
|
||||||
$aFields = array(
|
$fieldsInput = array(
|
||||||
"APP_UID" => $app_uid,
|
"APP_UID" => $appUid,
|
||||||
"DEL_INDEX" => $delIndex,
|
"DEL_INDEX" => $delIndex,
|
||||||
"USR_UID" => $userUid,
|
"USR_UID" => $userUid,
|
||||||
"DOC_UID" => $docUid,
|
"DOC_UID" => $docUid,
|
||||||
@@ -923,12 +970,31 @@ class Light
|
|||||||
"APP_DOC_FIELDNAME" => $fieldName,
|
"APP_DOC_FIELDNAME" => $fieldName,
|
||||||
"FOLDER_UID" => $folderId
|
"FOLDER_UID" => $folderId
|
||||||
);
|
);
|
||||||
$oAppDocument = new \AppDocument();
|
//We will to create a new version related to the appDocUid
|
||||||
$oAppDocument->create($aFields);
|
if (isset($file['appDocUid'])) {
|
||||||
$response[$k]['docVersion'] = $iDocVersion = $oAppDocument->getDocVersion();
|
$fieldsInput['APP_DOC_UID'] = $file['appDocUid'];
|
||||||
$response[$k]['appDocUid'] = $sAppDocUid = $oAppDocument->getAppDocUid();
|
}
|
||||||
|
$appDocument = new AppDocument();
|
||||||
|
$appDocument->create($fieldsInput);
|
||||||
|
//todo, we need to uniform the response format with camelCase
|
||||||
|
$response[$k]['appDocUid'] = $appDocUid = $appDocument->getAppDocUid();
|
||||||
|
$response[$k]['docVersion'] = $docVersion = $appDocument->getDocVersion();
|
||||||
|
$response[$k]['appDocFilename'] = $appDocument->getAppDocFilename();
|
||||||
|
$response[$k]['appDocCreateDate'] = $appDocument->getAppDocCreateDate();
|
||||||
|
$response[$k]['appDocType'] = $appDocument->getAppDocType();
|
||||||
|
$response[$k]['appDocIndex'] = $appDocument->getAppDocIndex();
|
||||||
|
//todo, we use this *** in others endpoint for mark that user not exist, but we need to change
|
||||||
|
$userInfo = '***';
|
||||||
|
if ($userUid !== '-1') {
|
||||||
|
$arrayUserData = $user->load($userUid);
|
||||||
|
$userInfo = $config->usersNameFormatBySetParameters($confEnvSetting["format"],
|
||||||
|
$arrayUserData["USR_USERNAME"], $arrayUserData["USR_FIRSTNAME"],
|
||||||
|
$arrayUserData["USR_LASTNAME"]);
|
||||||
|
}
|
||||||
|
$response[$k]['appDocCreateUser'] = $userInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -939,7 +1005,7 @@ class Light
|
|||||||
* @param $userUid
|
* @param $userUid
|
||||||
* @param $Fields
|
* @param $Fields
|
||||||
* @param $type
|
* @param $type
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function documentUploadFiles($userUid, $app_uid, $app_doc_uid, $request_data)
|
public function documentUploadFiles($userUid, $app_uid, $app_doc_uid, $request_data)
|
||||||
{
|
{
|
||||||
@@ -983,7 +1049,7 @@ class Light
|
|||||||
$fieldName = null;
|
$fieldName = null;
|
||||||
$fileSizeByField = 0;
|
$fileSizeByField = 0;
|
||||||
|
|
||||||
$oAppDocument = new \AppDocument();
|
$oAppDocument = new AppDocument();
|
||||||
$aAux = $oAppDocument->load($app_doc_uid);
|
$aAux = $oAppDocument->load($app_doc_uid);
|
||||||
|
|
||||||
$iDocVersion = $oAppDocument->getDocVersion();
|
$iDocVersion = $oAppDocument->getDocVersion();
|
||||||
@@ -1009,12 +1075,12 @@ class Light
|
|||||||
* @param $userUid
|
* @param $userUid
|
||||||
* @param $Fields
|
* @param $Fields
|
||||||
* @param $type
|
* @param $type
|
||||||
* @throws \Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function claimCaseUser($userUid, $sAppUid)
|
public function claimCaseUser($userUid, $sAppUid)
|
||||||
{
|
{
|
||||||
$response = array("status" => "fail");
|
$response = array("status" => "fail");
|
||||||
$oCase = new \Cases();
|
$oCase = new Cases();
|
||||||
$iDelIndex = $oCase->getCurrentDelegation($sAppUid, '', true);
|
$iDelIndex = $oCase->getCurrentDelegation($sAppUid, '', true);
|
||||||
|
|
||||||
$oAppDelegation = new \AppDelegation();
|
$oAppDelegation = new \AppDelegation();
|
||||||
@@ -1027,6 +1093,7 @@ class Light
|
|||||||
} else {
|
} else {
|
||||||
//G::SendMessageText( G::LoadTranslation( 'ID_CASE_ALREADY_DERIVATED' ), 'error' );
|
//G::SendMessageText( G::LoadTranslation( 'ID_CASE_ALREADY_DERIVATED' ), 'error' );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1041,18 +1108,19 @@ class Light
|
|||||||
$category[] = array("", G::LoadTranslation("ID_ALL_CATEGORIES"));
|
$category[] = array("", G::LoadTranslation("ID_ALL_CATEGORIES"));
|
||||||
|
|
||||||
$criteria = new Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
$criteria->addSelectColumn( \ProcessCategoryPeer::CATEGORY_UID );
|
$criteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_UID);
|
||||||
$criteria->addSelectColumn( \ProcessCategoryPeer::CATEGORY_NAME );
|
$criteria->addSelectColumn(ProcessCategoryPeer::CATEGORY_NAME);
|
||||||
$criteria->addAscendingOrderByColumn(\ProcessCategoryPeer::CATEGORY_NAME);
|
$criteria->addAscendingOrderByColumn(ProcessCategoryPeer::CATEGORY_NAME);
|
||||||
|
|
||||||
$dataset = \ProcessCategoryPeer::doSelectRS( $criteria );
|
$dataset = ProcessCategoryPeer::doSelectRS($criteria);
|
||||||
$dataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
|
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$dataset->next();
|
$dataset->next();
|
||||||
|
|
||||||
while ($row = $dataset->getRow()) {
|
while ($row = $dataset->getRow()) {
|
||||||
$category[] = array($row['CATEGORY_UID'], $row['CATEGORY_NAME']);
|
$category[] = array($row['CATEGORY_UID'], $row['CATEGORY_NAME']);
|
||||||
$dataset->next();
|
$dataset->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $category;
|
return $category;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1061,7 +1129,7 @@ class Light
|
|||||||
* @param $categoryUid
|
* @param $categoryUid
|
||||||
* @param $userUid
|
* @param $userUid
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \PropelException
|
* @throws PropelException
|
||||||
*/
|
*/
|
||||||
public function getProcessList($action, $categoryUid, $userUid)
|
public function getProcessList($action, $categoryUid, $userUid)
|
||||||
{
|
{
|
||||||
@@ -1070,7 +1138,7 @@ class Light
|
|||||||
//$userUid = (isset( $_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '') ? $_SESSION['USER_LOGGED'] : null;
|
//$userUid = (isset( $_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '') ? $_SESSION['USER_LOGGED'] : null;
|
||||||
|
|
||||||
// global $oAppCache;
|
// global $oAppCache;
|
||||||
$oAppCache = new \AppCacheView();
|
$oAppCache = new AppCacheView();
|
||||||
$processes = array();
|
$processes = array();
|
||||||
$processes[] = array('', G::LoadTranslation('ID_ALL_PROCESS'));
|
$processes[] = array('', G::LoadTranslation('ID_ALL_PROCESS'));
|
||||||
|
|
||||||
@@ -1087,29 +1155,30 @@ class Light
|
|||||||
//in search action, the query to obtain all process is too slow, so we need to query directly to
|
//in search action, the query to obtain all process is too slow, so we need to query directly to
|
||||||
//process and content tables, and for that reason we need the current language in AppCacheView.
|
//process and content tables, and for that reason we need the current language in AppCacheView.
|
||||||
|
|
||||||
$oConf = new \Configurations();
|
$oConf = new Configurations();
|
||||||
$oConf->loadConfig($x, 'APP_CACHE_VIEW_ENGINE', '', '', '', '');
|
$oConf->loadConfig($x, 'APP_CACHE_VIEW_ENGINE', '', '', '', '');
|
||||||
$appCacheViewEngine = $oConf->aConfig;
|
$appCacheViewEngine = $oConf->aConfig;
|
||||||
$lang = isset($appCacheViewEngine['LANG']) ? $appCacheViewEngine['LANG'] : 'en';
|
$lang = isset($appCacheViewEngine['LANG']) ? $appCacheViewEngine['LANG'] : 'en';
|
||||||
|
|
||||||
$cProcess = new Criteria('workflow');
|
$cProcess = new Criteria('workflow');
|
||||||
$cProcess->clearSelectColumns();
|
$cProcess->clearSelectColumns();
|
||||||
$cProcess->addSelectColumn( \ProcessPeer::PRO_UID );
|
$cProcess->addSelectColumn(ProcessPeer::PRO_UID);
|
||||||
$cProcess->addSelectColumn( \ProcessPeer::PRO_TITLE );
|
$cProcess->addSelectColumn(ProcessPeer::PRO_TITLE);
|
||||||
if ($categoryUid) {
|
if ($categoryUid) {
|
||||||
$cProcess->add( \ProcessPeer::PRO_CATEGORY, $categoryUid );
|
$cProcess->add(ProcessPeer::PRO_CATEGORY, $categoryUid);
|
||||||
}
|
}
|
||||||
$cProcess->add(ProcessPeer::PRO_STATUS, 'ACTIVE');
|
$cProcess->add(ProcessPeer::PRO_STATUS, 'ACTIVE');
|
||||||
$cProcess->addAscendingOrderByColumn(\ProcessPeer::PRO_TITLE);
|
$cProcess->addAscendingOrderByColumn(ProcessPeer::PRO_TITLE);
|
||||||
|
|
||||||
$oDataset = \ProcessPeer::doSelectRS( $cProcess );
|
$oDataset = ProcessPeer::doSelectRS($cProcess);
|
||||||
$oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
|
|
||||||
while ($aRow = $oDataset->getRow()) {
|
while ($aRow = $oDataset->getRow()) {
|
||||||
$processes[] = array($aRow['PRO_UID'], $aRow['PRO_TITLE']);
|
$processes[] = array($aRow['PRO_UID'], $aRow['PRO_TITLE']);
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
return print G::json_encode($processes);
|
return print G::json_encode($processes);
|
||||||
break;
|
break;
|
||||||
case 'unassigned':
|
case 'unassigned':
|
||||||
@@ -1134,28 +1203,31 @@ class Light
|
|||||||
}
|
}
|
||||||
//get the processes for this user in this action
|
//get the processes for this user in this action
|
||||||
$cProcess->clearSelectColumns();
|
$cProcess->clearSelectColumns();
|
||||||
$cProcess->addSelectColumn( \AppCacheViewPeer::PRO_UID );
|
$cProcess->addSelectColumn(AppCacheViewPeer::PRO_UID);
|
||||||
$cProcess->addSelectColumn( \AppCacheViewPeer::APP_PRO_TITLE );
|
$cProcess->addSelectColumn(AppCacheViewPeer::APP_PRO_TITLE);
|
||||||
$cProcess->setDistinct( \AppCacheViewPeer::PRO_UID );
|
$cProcess->setDistinct(AppCacheViewPeer::PRO_UID);
|
||||||
if ($categoryUid) {
|
if ($categoryUid) {
|
||||||
require_once 'classes/model/Process.php';
|
require_once 'classes/model/Process.php';
|
||||||
$cProcess->addAlias('CP', 'PROCESS');
|
$cProcess->addAlias('CP', 'PROCESS');
|
||||||
$cProcess->add('CP.PRO_CATEGORY', $categoryUid, Criteria::EQUAL);
|
$cProcess->add('CP.PRO_CATEGORY', $categoryUid, Criteria::EQUAL);
|
||||||
$cProcess->addJoin( \AppCacheViewPeer::PRO_UID, 'CP.PRO_UID', Criteria::LEFT_JOIN );
|
$cProcess->addJoin(AppCacheViewPeer::PRO_UID, 'CP.PRO_UID', Criteria::LEFT_JOIN);
|
||||||
$cProcess->addAsColumn('CATEGORY_UID', 'CP.PRO_CATEGORY');
|
$cProcess->addAsColumn('CATEGORY_UID', 'CP.PRO_CATEGORY');
|
||||||
}
|
}
|
||||||
|
|
||||||
$cProcess->addAscendingOrderByColumn(\AppCacheViewPeer::APP_PRO_TITLE);
|
$cProcess->addAscendingOrderByColumn(AppCacheViewPeer::APP_PRO_TITLE);
|
||||||
|
|
||||||
$oDataset = \AppCacheViewPeer::doSelectRS( $cProcess, \Propel::getDbConnection('workflow_ro') );
|
$oDataset = AppCacheViewPeer::doSelectRS($cProcess, Propel::getDbConnection('workflow_ro'));
|
||||||
$oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
|
|
||||||
while ($aRow = $oDataset->getRow()) {
|
while ($aRow = $oDataset->getRow()) {
|
||||||
$processes[] = array ($aRow['PRO_UID'],$aRow['APP_PRO_TITLE']
|
$processes[] = array(
|
||||||
|
$aRow['PRO_UID'],
|
||||||
|
$aRow['APP_PRO_TITLE']
|
||||||
);
|
);
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $processes;
|
return $processes;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1165,22 +1237,23 @@ class Light
|
|||||||
public function getUsersToReassign($usr_uid, $task_uid)
|
public function getUsersToReassign($usr_uid, $task_uid)
|
||||||
{
|
{
|
||||||
|
|
||||||
$memcache = \PMmemcached::getSingleton( SYS_SYS );
|
$memcache = PMmemcached::getSingleton(SYS_SYS);
|
||||||
$RBAC = \RBAC::getSingleton( PATH_DATA, session_id() );
|
$RBAC = RBAC::getSingleton(PATH_DATA, session_id());
|
||||||
$RBAC->sSystem = 'PROCESSMAKER';
|
$RBAC->sSystem = 'PROCESSMAKER';
|
||||||
$RBAC->initRBAC();
|
$RBAC->initRBAC();
|
||||||
$memKey = 'rbacSession' . session_id();
|
$memKey = 'rbacSession' . session_id();
|
||||||
if (($RBAC->aUserInfo = $memcache->get($memKey)) === false) {
|
if (($RBAC->aUserInfo = $memcache->get($memKey)) === false) {
|
||||||
$RBAC->loadUserRolePermission($RBAC->sSystem, $usr_uid);
|
$RBAC->loadUserRolePermission($RBAC->sSystem, $usr_uid);
|
||||||
$memcache->set( $memKey, $RBAC->aUserInfo, \PMmemcached::EIGHT_HOURS );
|
$memcache->set($memKey, $RBAC->aUserInfo, PMmemcached::EIGHT_HOURS);
|
||||||
}
|
}
|
||||||
$GLOBALS['RBAC'] = $RBAC;
|
$GLOBALS['RBAC'] = $RBAC;
|
||||||
|
|
||||||
$task = new \Task();
|
$task = new \Task();
|
||||||
$tasks = $task->load($task_uid);
|
$tasks = $task->load($task_uid);
|
||||||
$case = new \Cases();
|
$case = new Cases();
|
||||||
$result = new \stdclass();
|
$result = new \stdclass();
|
||||||
$result->data = $case->getUsersToReassign($task_uid, $usr_uid, $tasks['PRO_UID']);
|
$result->data = $case->getUsersToReassign($task_uid, $usr_uid, $tasks['PRO_UID']);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1189,7 +1262,7 @@ class Light
|
|||||||
*/
|
*/
|
||||||
public function reassignCase($usr_uid, $app_uid, $TO_USR_UID)
|
public function reassignCase($usr_uid, $app_uid, $TO_USR_UID)
|
||||||
{
|
{
|
||||||
$cases = new \Cases();
|
$cases = new Cases();
|
||||||
$user = new \Users();
|
$user = new \Users();
|
||||||
$app = new \Application();
|
$app = new \Application();
|
||||||
$result = new \stdclass();
|
$result = new \stdclass();
|
||||||
@@ -1203,7 +1276,7 @@ class Light
|
|||||||
$data['USER'] = $userData['USR_LASTNAME'] . ' ' . $userData['USR_FIRSTNAME']; //TODO change with the farmated username from environment conf
|
$data['USER'] = $userData['USR_LASTNAME'] . ' ' . $userData['USR_FIRSTNAME']; //TODO change with the farmated username from environment conf
|
||||||
$result->status = 0;
|
$result->status = 0;
|
||||||
$result->msg = G::LoadTranslation('ID_REASSIGNMENT_SUCCESS', SYS_LANG, $data);
|
$result->msg = G::LoadTranslation('ID_REASSIGNMENT_SUCCESS', SYS_LANG, $data);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
$result->status = 1;
|
$result->status = 1;
|
||||||
$result->msg = $e->getMessage();
|
$result->msg = $e->getMessage();
|
||||||
}
|
}
|
||||||
@@ -1219,7 +1292,7 @@ class Light
|
|||||||
$result = new \stdclass();
|
$result = new \stdclass();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$oCase = new \Cases();
|
$oCase = new Cases();
|
||||||
$iDelIndex = $oCase->getCurrentDelegation($app_uid, $usr_uid);
|
$iDelIndex = $oCase->getCurrentDelegation($app_uid, $usr_uid);
|
||||||
// Save the note pause reason
|
// Save the note pause reason
|
||||||
if ($request_data['noteContent'] != '') {
|
if ($request_data['noteContent'] != '') {
|
||||||
@@ -1238,9 +1311,10 @@ class Light
|
|||||||
|
|
||||||
$result->success = true;
|
$result->success = true;
|
||||||
$result->msg = G::LoadTranslation('ID_CASE_PAUSED_SUCCESSFULLY', SYS_LANG, $data);
|
$result->msg = G::LoadTranslation('ID_CASE_PAUSED_SUCCESSFULLY', SYS_LANG, $data);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1250,7 +1324,7 @@ class Light
|
|||||||
*/
|
*/
|
||||||
public function getConfiguration($params)
|
public function getConfiguration($params)
|
||||||
{
|
{
|
||||||
$sysConf = \Bootstrap::getSystemConfiguration('','',SYS_SYS);
|
$sysConf = Bootstrap::getSystemConfiguration('', '', SYS_SYS);
|
||||||
$multiTimeZone = false;
|
$multiTimeZone = false;
|
||||||
//Set Time Zone
|
//Set Time Zone
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
@@ -1261,7 +1335,8 @@ class Light
|
|||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
$tz = isset($_SESSION['USR_TIME_ZONE']) ? $_SESSION['USR_TIME_ZONE'] : $sysConf['time_zone'];
|
$tz = isset($_SESSION['USR_TIME_ZONE']) ? $_SESSION['USR_TIME_ZONE'] : $sysConf['time_zone'];
|
||||||
$offset = timezone_offset_get(new \DateTimeZone($tz), new \DateTime());
|
$offset = timezone_offset_get(new \DateTimeZone($tz), new \DateTime());
|
||||||
$response['timeZone'] = sprintf( "GMT%s%02d:%02d", ( $offset >= 0 ) ? '+' : '-', abs( $offset / 3600 ), abs( ($offset % 3600) / 60 ) );
|
$response['timeZone'] = sprintf("GMT%s%02d:%02d", ($offset >= 0) ? '+' : '-', abs($offset / 3600),
|
||||||
|
abs(($offset % 3600) / 60));
|
||||||
$response['multiTimeZone'] = $multiTimeZone;
|
$response['multiTimeZone'] = $multiTimeZone;
|
||||||
$fields = System::getSysInfo();
|
$fields = System::getSysInfo();
|
||||||
$response['version'] = $fields['PM_VERSION'];
|
$response['version'] = $fields['PM_VERSION'];
|
||||||
@@ -1272,7 +1347,7 @@ class Light
|
|||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
$response['buildType'] = $buildType;
|
$response['buildType'] = $buildType;
|
||||||
|
|
||||||
$conf = new \Configurations();
|
$conf = new Configurations();
|
||||||
$confEnvironment = $conf->getFormats();
|
$confEnvironment = $conf->getFormats();
|
||||||
|
|
||||||
$response['environment'] = array();
|
$response['environment'] = array();
|
||||||
@@ -1309,6 +1384,7 @@ class Light
|
|||||||
if (isset($params['tz']) && $params['tz']) {
|
if (isset($params['tz']) && $params['tz']) {
|
||||||
$response['tz'] = isset($_SESSION['USR_TIME_ZONE']) ? $_SESSION['USR_TIME_ZONE'] : $sysConf['time_zone'];
|
$response['tz'] = isset($_SESSION['USR_TIME_ZONE']) ? $_SESSION['USR_TIME_ZONE'] : $sysConf['time_zone'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1341,12 +1417,13 @@ class Light
|
|||||||
$oCriteria->add(AppDelegationPeer::APP_UID, $app_uid);
|
$oCriteria->add(AppDelegationPeer::APP_UID, $app_uid);
|
||||||
$oCriteria->add(AppDelegationPeer::DEL_PREVIOUS, $del_index);
|
$oCriteria->add(AppDelegationPeer::DEL_PREVIOUS, $del_index);
|
||||||
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
|
$oDataset = AppDelegationPeer::doSelectRS($oCriteria);
|
||||||
$oDataset->setFetchmode( \ResultSet::FETCHMODE_ASSOC );
|
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
while ($row = $oDataset->getRow()) {
|
while ($row = $oDataset->getRow()) {
|
||||||
$children[] = $row;
|
$children[] = $row;
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
}
|
}
|
||||||
|
|
||||||
return $children;
|
return $children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use \ProcessMaker\Services\Api;
|
|||||||
use \Luracast\Restler\RestException;
|
use \Luracast\Restler\RestException;
|
||||||
use \ProcessMaker\Util\DateTime;
|
use \ProcessMaker\Util\DateTime;
|
||||||
use \ProcessMaker\BusinessModel\Validator;
|
use \ProcessMaker\BusinessModel\Validator;
|
||||||
|
use AppDocument;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cases Api Controller
|
* Cases Api Controller
|
||||||
@@ -108,7 +109,27 @@ class Cases extends Api
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'doDownloadInputDocument':
|
||||||
|
//Verify if the user can be download the file
|
||||||
|
$appDocUid = $this->parameters[$arrayArgs['app_doc_uid']];
|
||||||
|
$version = $this->parameters[$arrayArgs['v']];
|
||||||
|
$usrUid = $this->getUserId();
|
||||||
|
$oAppDocument = new AppDocument();
|
||||||
|
if ($version == 0) {
|
||||||
|
$docVersion = $oAppDocument->getLastAppDocVersion($appDocUid);
|
||||||
|
} else {
|
||||||
|
$docVersion = $version;
|
||||||
}
|
}
|
||||||
|
if (defined('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION') && DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION == 0) {
|
||||||
|
if ($oAppDocument->canDownloadInput($usrUid, $appDocUid, $docVersion)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ namespace ProcessMaker\Services\Api\Cases;
|
|||||||
|
|
||||||
use \ProcessMaker\Services\Api;
|
use \ProcessMaker\Services\Api;
|
||||||
use \Luracast\Restler\RestException;
|
use \Luracast\Restler\RestException;
|
||||||
|
use ProcessMaker\BusinessModel\Cases\InputDocument AS CasesInputDocument;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cases\InputDocument Api Controller
|
* Cases\InputDocument Api Controller
|
||||||
@@ -54,6 +56,8 @@ class InputDocument extends Api
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* @access protected
|
||||||
|
* @class AccessControl {@className \ProcessMaker\Services\Api\Cases}
|
||||||
* @url GET /:app_uid/input-document/:app_doc_uid/file
|
* @url GET /:app_uid/input-document/:app_doc_uid/file
|
||||||
*
|
*
|
||||||
* @param string $app_uid {@min 32}{@max 32}
|
* @param string $app_uid {@min 32}{@max 32}
|
||||||
@@ -111,5 +115,24 @@ class InputDocument extends Api
|
|||||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @url GET /:app_uid/input-document/:app_doc_uid/versions
|
||||||
|
*
|
||||||
|
* @param string $app_uid {@min 32}{@max 32}
|
||||||
|
* @param string $app_doc_uid {@min 32}{@max 32}
|
||||||
|
* @return array $response
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public function doGetDocumentByVersion($app_uid, $app_doc_uid)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$inputDocument = new CasesInputDocument();
|
||||||
|
$response = $inputDocument->getAllVersionByDocUid($app_uid, $app_doc_uid);
|
||||||
|
return $response;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user