Upgrade code - step 1

This commit is contained in:
Fernando Ontiveros
2025-03-27 12:06:06 +00:00
parent fbd92c5964
commit 7f3ee186de
47635 changed files with 5941896 additions and 1779 deletions

View File

@@ -4491,7 +4491,7 @@ class Cases
// Join with STEP table
$query->join('STEP', function ($join) {
$join->on('APPLICATION.PRO_UID', '=', 'STEP.PRO_UID');
$join->on('STEP.STEP_TYPE_OBJ', '=', DB::raw("'DYNAFORM'"));
$join->whereRaw('`STEP`.`STEP_TYPE_OBJ` = "DYNAFORM"');
});
// Filter by application Uid

View File

@@ -1254,7 +1254,7 @@ class Task
* @param string $proUid {@min 32} {@max 32}
* @param string $tasUid {@min 32} {@max 32}
* @param string $uid {@min 32} {@max 32}
* @param string $type {@choice user,group}
* @param string $type
*
* @return array
*
@@ -1456,7 +1456,7 @@ class Task
* @param string $sProcessUID {@min 32} {@max 32}
* @param string $sTaskUID {@min 32} {@max 32}
* @param string $sAssigneeUID {@min 32} {@max 32}
* @param string $assType {@choice user,group}
* @param string $assType
*
* return array
*

View File

@@ -797,7 +797,7 @@ class Installer
]
];
$results = DB::connection($nameConnection)->select(DB::raw('select version()'));
$results = DB::connection($nameConnection)->select(rawQuery('select version()'));
preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $results[0]->{'version()'}, $version);
$rt['version'] = version_compare($mysql_version = $version[0], '4.1.0', '>=');

View File

@@ -1073,11 +1073,11 @@ class Delegation extends Model
*/
public function scopeSendBy($query, int $usrId)
{
$query->where(DB::raw($usrId), function ($sql) {
$query->where(rawQuery($usrId), function ($sql) {
$sql->from('APP_DELEGATION AS B')
->select('B.USR_ID')
->where('B.APP_NUMBER', '=', DB::raw('APP_DELEGATION.APP_NUMBER'))
->where('B.DEL_INDEX', '=', DB::raw('APP_DELEGATION.DEL_PREVIOUS'))
->where('B.APP_NUMBER', '=', rawQuery('APP_DELEGATION.APP_NUMBER'))
->where('B.DEL_INDEX', '=', rawQuery('APP_DELEGATION.DEL_PREVIOUS'))
->limit(1);
});
return $query;
@@ -1267,7 +1267,7 @@ class Delegation extends Model
'TASK.TAS_TITLE AS APP_TAS_TITLE',
'TASK.TAS_TYPE AS APP_TAS_TYPE',
];
$query = DB::table('APP_DELEGATION')->select(DB::raw(implode(',', $selectColumns)));
$query = DB::table('APP_DELEGATION')->selectRaw(implode(',', $selectColumns));
// Add join for task, filtering for task title if needed
// It doesn't make sense for us to search for any delegations that match tasks that are events or web entry
@@ -1621,9 +1621,8 @@ class Delegation extends Model
// Add joins
$join->on('APP_DELEGATION.TAS_ID', '=', 'TASK.TAS_ID');
$join->on('TASK.TAS_ASSIGN_TYPE', '=', DB::raw("'SELF_SERVICE'"));
$join->on('APP_DELEGATION.DEL_THREAD_STATUS', '=', DB::raw("'OPEN'"));
$join->on('APP_DELEGATION.USR_ID', '=', DB::raw("'0'"))->whereRaw($complexJoin);
$join->whereRaw('`TASK`.`TAS_ASSIGN_TYPE` = "SELF_SERVICE" AND `APP_DELEGATION`.`DEL_THREAD_STATUS` = "OPEN" AND `APP_DELEGATION`.`USR_ID` = 0');
$join->whereRaw($complexJoin);
});
// Add join clause with APPLICATION table if required

View File

@@ -73,10 +73,10 @@ class ClassStructure
/**
* Sets a property by name.
* @param string $name
* @param string $value
* @param string|array $value
* @return void
*/
public function setInfo(string $name, string $value): void
public function setInfo($name, $value): void
{
$this->info[$name] = $value;
}

View File

@@ -48,10 +48,10 @@ class MethodStructure
/**
* Sets a property with supplied name to a supplied value.
* @param string $name
* @param string $value
* @param string|array $value
* @return void
*/
public function setInfo(string $name, string $value): void
public function setInfo($name, $value): void
{
$this->info[$name] = $value;
}

View File

@@ -43,10 +43,10 @@ class AccessControl implements iAuthenticate
$this->userUid = $oServerOauth->getUserId();
$this->oUser->loadUserRolePermission(self::SYSTEM, $this->userUid);
$this->loadRbacUser($this->userUid);
$metadata = Util::nestedValue($this->restler, 'apiMethodInfo', 'metadata');
$metadata = Util::nestedValue(Util::$restler, 'apiMethodInfo', 'metadata');
$permissions = $this->getPermissions();
if ($allowed && !empty($this->userUid) && (!empty($metadata['access']) && $metadata['access'] == 'protected')) {
$parameters = Util::nestedValue($this->restler, 'apiMethodInfo', 'parameters');
$parameters = Util::nestedValue(Util::$restler, 'apiMethodInfo', 'parameters');
if (!is_null(self::$className) && is_string(self::$className)) {
$authObj = Scope::get(self::$className);
$authObj->parameters = $parameters;
@@ -118,7 +118,8 @@ class AccessControl implements iAuthenticate
private function getPermissions()
{
if (is_string(self::$permission)) {
$permission = trim(self::$permission);
$permission = explode(',', trim(self::$permission));
$permission = array_map('trim', $permission);
} elseif (is_array(self::$permission)) {
$permission = [];
foreach (self::$permission as $perm) {

View File

@@ -9,6 +9,7 @@ use Criteria;
use Exception;
use ListUnassigned;
use Luracast\Restler\RestException;
use Luracast\Restler\Util;
use ProcessMaker\BusinessModel\Cases as BmCases;
use ProcessMaker\BusinessModel\Cases\Filter;
use ProcessMaker\BusinessModel\User as BmUser;
@@ -62,8 +63,8 @@ class Cases extends Api
public function __isAllowed()
{
try {
$methodName = $this->restler->apiMethodInfo->methodName;
$arrayArgs = $this->restler->apiMethodInfo->arguments;
$methodName = Util::$restler->apiMethodInfo->methodName;
$arrayArgs = Util::$restler->apiMethodInfo->arguments;
switch ($methodName) {
case 'doGetCaseVariables':
$applicationUid = $this->parameters[$arrayArgs['appUid']];
@@ -1280,7 +1281,7 @@ class Cases extends Api
*
* @param string $appUid {@min 1}{@max 32}
* @param string $note_content {@min 1}{@max 500}
* @param int $send_mail {@choice 1,0}
* @param int $send_mail
*
* @return void
* @throws RestException

View File

@@ -1,8 +1,9 @@
<?php
namespace ProcessMaker\Services\Api\Cases;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
use ProcessMaker\Services\Api;
use Luracast\Restler\Util;
use Luracast\Restler\RestException;
/**
* Cases\OutputDocument Api Controller
@@ -14,8 +15,8 @@ class OutputDocument extends Api
public function __isAllowed()
{
try {
$methodName = $this->restler->apiMethodInfo->methodName;
$arrayArgs = $this->restler->apiMethodInfo->arguments;
$methodName = Util::$restler->apiMethodInfo->methodName;
$arrayArgs = Util::$restler->apiMethodInfo->arguments;
switch ($methodName) {
case 'doGetOutputDocumentFile':

View File

@@ -1,8 +1,9 @@
<?php
namespace ProcessMaker\Services\Api\Cases;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
use ProcessMaker\Services\Api;
use Luracast\Restler\RestException;
use Luracast\Restler\Util;
/**
* Cases\Variable Api Controller
@@ -56,7 +57,7 @@ class Variable extends Api
$limit = null
) {
try {
if (preg_match("/^.*\/paged.*$/", $this->restler->url)) {
if (preg_match("/^.*\/paged.*$/", Util::$restler->url)) {
$arrayFilterData = [
'filter' => (!is_null($filter))?
$filter : ((!is_null($lfilter))? $lfilter : ((!is_null($rfilter))? $rfilter : null)),

View File

@@ -9,6 +9,7 @@ use Criteria;
use Exception;
use G;
use Luracast\Restler\RestException;
use Luracast\Restler\Util;
use PmDynaform;
use Process as ModelProcess;
use ProcessMaker\BusinessModel\Cases as BusinessModelCases;
@@ -53,8 +54,8 @@ class Light extends Api
public function __isAllowed()
{
try {
$methodName = $this->restler->apiMethodInfo->methodName;
$arrayArgs = $this->restler->apiMethodInfo->arguments;
$methodName = Util::$restler->apiMethodInfo->methodName;
$arrayArgs = Util::$restler->apiMethodInfo->arguments;
switch ($methodName) {
case 'doIfAlreadyRoute':
$applicationUid = $this->parameters[$arrayArgs['app_uid']];
@@ -984,7 +985,7 @@ class Light extends Api
* @param string $act_uid {@min 1}{@max 32}
* @param string $cas_uid {@min 1}{@max 32}
* @param string $step_uid {@min 32}{@max 32}
* @param string $type {@choice before,after}
* @param string $type
*
* @return array
* @throws RestException
@@ -1608,7 +1609,7 @@ class Light extends Api
*
* @param string $app_uid {@min 1}{@max 32}
* @param string $noteContent {@min 1}{@max 500}
* @param int $sendMail {@choice 1,0}
* @param int $sendMail
*
* @return mixed
* @throws RestException

View File

@@ -17,7 +17,7 @@ class Activity extends Api
/**
* @param string $prj_uid {@min 32} {@max 32}
* @param string $act_uid {@min 32} {@max 32}
* @param string $filter {@choice definition,,properties}
* @param string $filter
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
@@ -67,10 +67,8 @@ class Activity extends Api
/**
* @param string $pro_uid {@min 32} {@max 32}
* @param string $tas_uid {@min 32} {@max 32}
* @param string $filter {@choice definition,,properties}
* @param string $filter
*
* @author Gustavo Cruz <gustavo.cruz@colosa.com>
* @copyright Colosa - Bolivia
* @return array
*
* @url GET /:pro_uid/activity/:tas_uid/feature-configuration
@@ -274,12 +272,12 @@ class ActivityPropertiesStructure
public $tas_derivation_screen_tpl;
/**
* @var string {@from body} {@choice TRUE,FALSE} {@required false}
* @var string {@from body} {@required false}
*/
public $tas_start;
/**
* @var string {@from body} {@choice BALANCED,MANUAL,EVALUATE,REPORT_TO,SELF_SERVICE,SELF_SERVICE_EVALUATE,MULTIPLE_INSTANCE,MULTIPLE_INSTANCE_VALUE_BASED} {@required false}
* @var string {@from body} {@required false}
*/
public $tas_assign_type;
@@ -299,12 +297,12 @@ class ActivityPropertiesStructure
public $tas_selfservice_time;
/**
* @var int {@from body} {@choice 1,0}
* @var int {@from body}
*/
public $tas_selfservice_timeout;
/**
* @var string {@from body} {@choice DAYS,,HOURS,MINUTES} {@required false}
* @var string {@from body} {@required false}
*/
public $tas_selfservice_time_unit;
@@ -314,12 +312,12 @@ class ActivityPropertiesStructure
public $tas_selfservice_trigger_uid;
/**
* @var string {@from body} {@choice EVERY_TIME,ONCE}
* @var string {@from body}
*/
public $tas_selfservice_execution;
/**
* @var string {@from body} {@choice TRUE,FALSE}
* @var string {@from body}
*/
public $tas_transfer_fly;
@@ -344,7 +342,7 @@ class ActivityPropertiesStructure
public $tas_calendar;
/**
* @var string {@from body} {@choice NORMAL,ADHOC,SUBPROCESS}
* @var string {@from body}
*/
public $tas_type;
@@ -359,7 +357,7 @@ class ActivityPropertiesStructure
public $tas_def_description;
/**
* @var string {@from body} {@choice TRUE,FALSE}
* @var string {@from body}
*/
public $tas_send_last_email;

View File

@@ -1,8 +1,9 @@
<?php
namespace ProcessMaker\Services\Api\Project\Activity;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
use ProcessMaker\Services\Api;
use Luracast\Restler\RestException;
use Luracast\Restler\Util;
/**
* Project\Activity\Assignee Api Controller
@@ -44,7 +45,7 @@ class Assignee extends Api
$response = $this->task->getTaskAssignees($prj_uid, $act_uid, "ASSIGNEE", 1, $arrayFilterData, $start, $limit, $type);
return (preg_match("/^.*\/paged.*$/", $this->restler->url))? $response : $response["data"];
return (preg_match("/^.*\/paged.*$/", Util::$restler->url))? $response : $response["data"];
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
@@ -67,7 +68,7 @@ class Assignee extends Api
$response = $this->task->getTaskAssignees($prj_uid, $act_uid, "AVAILABLE", 1, $arrayFilterData, $start, $limit, $type);
return (preg_match("/^.*\/paged.*$/", $this->restler->url))? $response : $response["data"];
return (preg_match("/^.*\/paged.*$/", Util::$restler->url))? $response : $response["data"];
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
@@ -100,7 +101,7 @@ class Assignee extends Api
* @param string $prjUid {@min 32} {@max 32}
* @param string $actUid {@min 32} {@max 32}
* @param string $aas_uid {@min 32} {@max 32}
* @param string $aas_type {@choice user,group}
* @param string $aas_type
*
* @return void
* @throws RestException
@@ -152,7 +153,7 @@ class Assignee extends Api
$response = $this->task->getTaskAssignees($prj_uid, $act_uid, "ASSIGNEE", 2, $arrayFilterData, $start, $limit, $type);
return (preg_match("/^.*\/paged.*$/", $this->restler->url))? $response : $response["data"];
return (preg_match("/^.*\/paged.*$/", Util::$restler->url))? $response : $response["data"];
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
@@ -175,7 +176,7 @@ class Assignee extends Api
$response = $this->task->getTaskAssignees($prj_uid, $act_uid, "AVAILABLE", 2, $arrayFilterData, $start, $limit, $type);
return (preg_match("/^.*\/paged.*$/", $this->restler->url))? $response : $response["data"];
return (preg_match("/^.*\/paged.*$/", Util::$restler->url))? $response : $response["data"];
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
@@ -208,7 +209,7 @@ class Assignee extends Api
* @param string $prjUid {@min 32} {@max 32}
* @param string $actUid {@min 32} {@max 32}
* @param string $ada_uid {@min 32} {@max 32}
* @param string $ada_type {@choice user,group}
* @param string $ada_type
*
* @return void
* @throws RestException
@@ -286,4 +287,3 @@ class Assignee extends Api
}
}
}

View File

@@ -42,11 +42,11 @@ class Step extends Api
* @param string $act_uid {@min 32}{@max 32}
* @param string $prj_uid {@min 32}{@max 32}
* @param array $request_data
* @param string $step_type_obj {@from body}{@choice DYNAFORM,INPUT_DOCUMENT,OUTPUT_DOCUMENT,EXTERNAL}{@required true}
* @param string $step_type_obj {@from body}{@required true}
* @param string $step_uid_obj {@from body}{@min 32}{@max 32}{@required true}
* @param string $step_condition {@from body}
* @param int $step_position {@from body}{@min 1}
* @param string $step_mode {@from body}{@choice EDIT,VIEW}{@required true}
* @param string $step_mode {@from body}{@required true}
*
* @return array
* @throws RestException
@@ -88,11 +88,11 @@ class Step extends Api
* @param string $act_uid {@min 32}{@max 32}
* @param string $prj_uid {@min 32}{@max 32}
* @param array $request_data
* @param string $step_type_obj {@from body}{@choice DYNAFORM,INPUT_DOCUMENT,OUTPUT_DOCUMENT,EXTERNAL}
* @param string $step_type_obj {@from body}
* @param string $step_uid_obj {@from body}{@min 32}{@max 32}
* @param string $step_condition {@from body}
* @param int $step_position {@from body}{@min 1}
* @param string $step_mode {@from body}{@choice EDIT,VIEW}
* @param string $step_mode {@from body}
*
* @throws RestException
*
@@ -171,7 +171,7 @@ class Step extends Api
* @param string $step_uid {@min 32}{@max 32}
* @param string $act_uid {@min 32}{@max 32}
* @param string $prj_uid {@min 32}{@max 32}
* @param string $type {@choice before,after}
* @param string $type
*/
public function doGetActivityStepAvailableTriggers($step_uid, $act_uid, $prj_uid, $type)
{
@@ -216,7 +216,7 @@ class Step extends Api
*
* @param string $act_uid {@min 32}{@max 32}
* @param string $prj_uid {@min 32}{@max 32}
* @param string $type {@choice before-assignment,before-routing,after-routing}
* @param string $type
*/
public function doGetActivityStepAssignTaskAvailableTriggers($act_uid, $prj_uid, $type)
{
@@ -242,11 +242,11 @@ class Step extends Api
* @param string $act_uid {@min 32}{@max 32}
* @param string $prj_uid {@min 32}{@max 32}
* @param array $request_data
* @param string $step_type_obj {@from body}{@choice DYNAFORM,INPUT_DOCUMENT,OUTPUT_DOCUMENT,EXTERNAL}{@required true}
* @param string $step_type_obj {@from body}{@required true}
* @param string $step_uid_obj {@from body}{@min 32}{@max 32}{@required true}
* @param string $step_condition {@from body}
* @param int $step_position {@from body}{@min 1}
* @param string $step_mode {@from body}{@choice EDIT,VIEW}{@required true}
* @param string $step_mode {@from body}{@required true}
*
* @return array
* @throws RestException

View File

@@ -18,7 +18,7 @@ class Trigger extends Api
* @param string $step_uid
* @param string $act_uid
* @param string $prj_uid
* @param string $type {@from body}{@choice before,after}
* @param string $type {@from body}
*/
public function doGetActivityStepTrigger($tri_uid, $step_uid, $act_uid, $prj_uid, $type)
{
@@ -101,7 +101,7 @@ class Trigger extends Api
* @param string $step_uid
* @param string $act_uid
* @param string $prj_uid
* @param string $type {@from body}{@choice before,after}
* @param string $type {@from body}
*/
public function doDeleteActivityStepTrigger($tri_uid, $step_uid, $act_uid, $prj_uid, $type)
{
@@ -122,7 +122,7 @@ class Trigger extends Api
* @param string $tri_uid
* @param string $act_uid
* @param string $prj_uid
* @param string $type {@from body}{@choice before-assignment,before-routing,after-routing}
* @param string $type {@from body}
*/
public function doGetActivityStepAssignTaskTrigger($tri_uid, $act_uid, $prj_uid, $type)
{
@@ -202,7 +202,7 @@ class Trigger extends Api
* @param string $tri_uid
* @param string $act_uid
* @param string $prj_uid
* @param string $type {@from body}{@choice before-assignment,before-routing,after-routing}
* @param string $type {@from body}
*/
public function doDeleteActivityStepAssignTaskTrigger($tri_uid, $act_uid, $prj_uid, $type)
{
@@ -219,7 +219,7 @@ class Trigger extends Api
class StepTriggerPostStructure
{
/**
* @var string {@from body}{@choice BEFORE,AFTER}{@required true}
* @var string {@from body}{@required true}
*/
public $st_type;
@@ -242,7 +242,7 @@ class StepTriggerPostStructure
class StepTriggerPutStructure
{
/**
* @var string {@from body}{@choice BEFORE,AFTER}{@required true}
* @var string {@from body}{@required true}
*/
public $st_type;
@@ -260,7 +260,7 @@ class StepTriggerPutStructure
class StepAssignTaskTriggerPostStructure
{
/**
* @var string {@from body}{@choice BEFORE_ASSIGNMENT,BEFORE_ROUTING,AFTER_ROUTING}{@required true}
* @var string {@from body}{@required true}
*/
public $st_type;
@@ -283,7 +283,7 @@ class StepAssignTaskTriggerPostStructure
class StepAssignTaskTriggerPutStructure
{
/**
* @var string {@from body}{@choice BEFORE_ASSIGNMENT,BEFORE_ROUTING,AFTER_ROUTING}{@required true}
* @var string {@from body}{@required true}
*/
public $st_type;

View File

@@ -171,7 +171,7 @@ class CaseSchedulerStructure
public $sch_last_run_time;
/**
* @var string {@from body} {@choice ACTIVE,INACTIVE}
* @var string {@from body}
*/
public $sch_state;
@@ -186,7 +186,7 @@ class CaseSchedulerStructure
public $usr_uid;
/**
* @var string {@from body} {@choice 1,2,3,4,5}
* @var string {@from body}
*/
public $sch_option;
@@ -216,7 +216,7 @@ class CaseSchedulerStructure
public $sch_week_days;
/**
* @var string {@from body} {@choice 1,2,}
* @var string {@from body}
*/
public $sch_start_day;

View File

@@ -36,9 +36,9 @@ class CaseTracker extends Api
*
* @param string $prj_uid {@min 32}{@max 32}
* @param array $request_data
* @param string $map_type {@from body}{@choice NONE,PROCESSMAP,STAGES}
* @param int $routing_history {@from body}{@choice 0,1}
* @param int $message_history {@from body}{@choice 0,1}
* @param string $map_type {@from body}
* @param int $routing_history {@from body}
* @param int $message_history {@from body}
*
* @throws RestException
*

View File

@@ -38,7 +38,7 @@ class CaseTrackerObject extends Api
*
* @param string $prj_uid {@min 32}{@max 32}
* @param array $request_data
* @param string $cto_type_obj {@from body}{@choice DYNAFORM,INPUT_DOCUMENT,OUTPUT_DOCUMENT}{@required true}
* @param string $cto_type_obj {@from body}{@required true}
* @param string $cto_uid_obj {@from body}{@min 32}{@max 32}{@required true}
* @param string $cto_condition {@from body}
* @param int $cto_position {@from body}{@min 1}
@@ -78,7 +78,7 @@ class CaseTrackerObject extends Api
* @param string $cto_uid {@min 32}{@max 32}
* @param string $prj_uid {@min 32}{@max 32}
* @param array $request_data
* @param string $cto_type_obj {@from body}{@choice DYNAFORM,INPUT_DOCUMENT,OUTPUT_DOCUMENT}
* @param string $cto_type_obj {@from body}
* @param string $cto_uid_obj {@from body}{@min 32}{@max 32}
* @param string $cto_condition {@from body}
* @param int $cto_position {@from body}{@min 1}

View File

@@ -16,7 +16,7 @@ class Event extends Api
{
/**
* @param string $prj_uid {@min 1} {@max 32}
* @param string $filter {@choice message,conditional,,multiple}
* @param string $filter
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
@@ -82,13 +82,13 @@ class Event extends Api
* @param string $prj_uid {@min 1} {@max 32}
* @param array $request_data
* @param string $evn_description {@from body} {@min 1}
* @param string $evn_status {@from body} {@choice ACTIVE,INACTIVE}
* @param string $evn_action {@from body} {@choice SEND_MESSAGE,EXECUTE_CONDITIONAL_TRIGGER,EXECUTE_TRIGGER}
* @param string $evn_related_to {@from body} {@choice SINGLE,MULTIPLE}
* @param string $evn_tas_estimated_duration {@from body} {@type float}
* @param string $evn_time_unit {@from body} {@choice DAYS,HOURS}
* @param string $evn_when {@from body} {@type float}
* @param string $evn_when_occurs {@from body} {@choice AFTER_TIME,TASK_STARTED}
* @param string $evn_status {@from body}
* @param string $evn_action {@from body}
* @param string $evn_related_to {@from body}
* @param string $evn_tas_estimated_duration {@from body}{@type float}
* @param string $evn_time_unit {@from body}
* @param string $evn_when {@from body}{@type float}
* @param string $evn_when_occurs {@from body}
* @param string $tri_uid {@from body} {@min 1}
* @param string $tas_uid {@from body}
* @param string $evn_tas_uid_from {@from body}
@@ -147,13 +147,13 @@ class Event extends Api
* @param string $evn_uid {@min 1} {@max 32}
* @param array $request_data
* @param string $evn_description {@from body} {@min 1}
* @param string $evn_status {@from body} {@choice ACTIVE,INACTIVE}
* @param string $evn_action {@from body} {@choice SEND_MESSAGE,EXECUTE_CONDITIONAL_TRIGGER,EXECUTE_TRIGGER}
* @param string $evn_related_to {@from body} {@choice SINGLE,MULTIPLE}
* @param string $evn_tas_estimated_duration {@from body} {@min 1}
* @param string $evn_time_unit {@from body} {@choice DAYS,HOURS}
* @param string $evn_status {@from body}
* @param string $evn_action {@from body}
* @param string $evn_related_to {@from body}
* @param string $evn_tas_estimated_duration {@from body}{@min 1}
* @param string $evn_time_unit {@from body}
* @param string $evn_when {@from body} {@type float}
* @param string $evn_when_occurs {@from body} {@choice AFTER_TIME,TASK_STARTED}
* @param string $evn_when_occurs {@from body}
* @param string $tri_uid {@from body} {@min 1}
* @param string $tas_uid {@from body}
* @param string $evn_tas_uid_from {@from body}

View File

@@ -150,12 +150,12 @@ class OutputDocumentStructure
public $out_doc_template;
/**
* @var string {@from body} {@choice TCPDF,HTML2PDF}
* @var string {@from body}
*/
public $out_doc_report_generator;
/**
* @var int {@from body} {@choice 0,1}
* @var int {@from body}
*/
public $out_doc_landscape;
@@ -185,7 +185,7 @@ class OutputDocumentStructure
public $out_doc_bottom_margin;
/**
* @var string {@from body} {@choice PDF,DOC,BOTH}
* @var string {@from body}
*/
public $out_doc_generate;
@@ -220,7 +220,7 @@ class OutputDocumentStructure
public $out_doc_tags;
/**
* @var int {@from body} {@choice 0,1}
* @var int {@from body}
*/
public $out_doc_pdf_security_enabled;
@@ -240,7 +240,7 @@ class OutputDocumentStructure
public $out_doc_pdf_security_permissions;
/**
* @var int {@from body} {@choice 0,1}
* @var int {@from body}
*/
public $out_doc_open_type;

View File

@@ -99,11 +99,11 @@ class ProcessPermissions extends Api
* @param string $ob_uid {@min 1} {@max 32}
* @param array $request_data
* @param string $usr_uid {@from body} {@min 1} {@max 32}
* @param string $op_user_relation {@from body} {@choice 1,2}
* @param string $op_case_status {@from body} {@choice ALL,DRAFT,TO_DO,PAUSED,COMPLETED}
* @param string $op_participate {@from body} {@choice 0,1}
* @param string $op_obj_type {@from body} {@choice ANY,DYNAFORM,ATTACHMENT,INPUT,OUTPUT,CASES_NOTES,MSGS_HISTORY,SUMMARY_FORM,REASSIGN_MY_CASES}
* @param string $op_action {@from body} {@choice VIEW,BLOCK,DELETE,RESEND}
* @param string $op_user_relation {@from body}
* @param string $op_case_status {@from body}
* @param string $op_participate {@from body}
* @param string $op_obj_type {@from body}
* @param string $op_action {@from body}
* @param string $tas_uid {@from body}
* @param string $op_task_source {@from body}
* @param string $dynaforms {@from body}

View File

@@ -1,8 +1,10 @@
<?php
namespace ProcessMaker\Services\Api\Project;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
use ProcessMaker\BusinessModel\ProcessSupervisor;
use ProcessMaker\Services\Api;
use Luracast\Restler\RestException;
use Luracast\Restler\Util;
/**
* Project\ProcessSupervisors Api Controller
@@ -29,7 +31,7 @@ class ProcessSupervisors extends Api
$response = $supervisor->getProcessSupervisors($prj_uid, "ASSIGNED", $arrayFilterData, $start, $limit, $type);
return (preg_match("/^.*\/paged.*$/", $this->restler->url))? $response : $response["data"];
return (preg_match("/^.*\/paged.*$/", Util::$restler->url))? $response : $response["data"];
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, htmlspecialchars($e->getMessage()));
}
@@ -44,7 +46,7 @@ class ProcessSupervisors extends Api
public function doGetProcessSupervisor($prjUid, $puUid)
{
try {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new ProcessSupervisor();
$objectData = $supervisor->getProcessSupervisor($prjUid, $puUid);
//Response
$response = $objectData;
@@ -73,7 +75,7 @@ class ProcessSupervisors extends Api
$response = $supervisor->getProcessSupervisors($prj_uid, "AVAILABLE", $arrayFilterData, $start, $limit, $type);
return (preg_match("/^.*\/paged.*$/", $this->restler->url))? $response : $response["data"];
return (preg_match("/^.*\/paged.*$/", Util::$restler->url))? $response : $response["data"];
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
@@ -87,7 +89,7 @@ class ProcessSupervisors extends Api
public function doGetProcessSupervisorDynaforms($prjUid)
{
try {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new ProcessSupervisor();
$arrayData = $supervisor->getProcessSupervisorDynaforms($prjUid);
//Response
$response = $arrayData;
@@ -106,7 +108,7 @@ class ProcessSupervisors extends Api
public function doGetProcessSupervisorAssignmentsteps($prjUid)
{
try {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new ProcessSupervisor();
$arrayData = $supervisor->getProcessSupervisorDynaformsInputsDocuments($prjUid);
//Response
$response = $arrayData;
@@ -126,7 +128,7 @@ class ProcessSupervisors extends Api
public function doGetProcessSupervisorDynaform($prjUid, $pudUid)
{
try {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new ProcessSupervisor();
$objectData = $supervisor->getProcessSupervisorDynaform($prjUid, $pudUid);
//Response
$response = $objectData;
@@ -145,7 +147,7 @@ class ProcessSupervisors extends Api
public function doGetAvailableProcessSupervisorDynaform($prjUid)
{
try {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new ProcessSupervisor();
$arrayData = $supervisor->getAvailableProcessSupervisorDynaform($prjUid);
//Response
$response = $arrayData;
@@ -164,7 +166,7 @@ class ProcessSupervisors extends Api
public function doGetAvailableProcessSupervisorAssignmentstep($prjUid)
{
try {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new ProcessSupervisor();
$arrayData = $supervisor->getAvailableProcessSupervisorDynaformInputDocument($prjUid);
//Response
$response = $arrayData;
@@ -183,7 +185,7 @@ class ProcessSupervisors extends Api
public function doGetProcessSupervisorInputDocuments($prjUid)
{
try {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new ProcessSupervisor();
$arrayData = $supervisor->getProcessSupervisorInputDocuments($prjUid);
//Response
$response = $arrayData;
@@ -203,7 +205,7 @@ class ProcessSupervisors extends Api
public function doGetProcessSupervisorInputDocument($prjUid, $puiUid)
{
try {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new ProcessSupervisor();
$objectData = $supervisor->getProcessSupervisorInputDocument($prjUid, $puiUid);
//Response
$response = $objectData;
@@ -222,7 +224,7 @@ class ProcessSupervisors extends Api
public function doGetAvailableProcessSupervisorInputDocument($prjUid)
{
try {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new ProcessSupervisor();
$arrayData = $supervisor->getAvailableProcessSupervisorInputDocument($prjUid);
//Response
$response = $arrayData;
@@ -241,7 +243,7 @@ class ProcessSupervisors extends Api
*
* @param string $prjUid {@min 32} {@max 32}
* @param string $usr_uid {@min 32} {@max 32}
* @param string $pu_type {@choice SUPERVISOR,GROUP_SUPERVISOR}
* @param string $pu_type
*
* @return array
* @throws RestException
@@ -252,7 +254,7 @@ class ProcessSupervisors extends Api
public function doPostProcessSupervisor($prjUid, $usr_uid, $pu_type)
{
try {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new ProcessSupervisor();
$objectData = $supervisor->addProcessSupervisor($prjUid, $usr_uid, $pu_type);
//Response
$response = $objectData;
@@ -282,7 +284,7 @@ class ProcessSupervisors extends Api
public function doPostProcessSupervisorDynaform($prjUid, $dyn_uid, $pud_position = null)
{
try {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new ProcessSupervisor();
$objectData = $supervisor->addProcessSupervisorDynaform($prjUid, $dyn_uid, $pud_position);
//Response
$response = $objectData;
@@ -312,7 +314,7 @@ class ProcessSupervisors extends Api
public function doPostProcessSupervisorInputDocument($prjUid, $inp_doc_uid, $pui_position = null)
{
try {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new ProcessSupervisor();
$objectData = $supervisor->addProcessSupervisorInputDocument($prjUid, $inp_doc_uid, $pui_position);
//Response
$response = $objectData;
@@ -335,7 +337,7 @@ class ProcessSupervisors extends Api
public function doDeleteSupervisor($prjUid, $puUid)
{
try {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new ProcessSupervisor();
$supervisor->removeProcessSupervisor($prjUid, $puUid);
} catch (\Exception $e) {
//response
@@ -355,7 +357,7 @@ class ProcessSupervisors extends Api
public function doDeleteDynaformSupervisor($prjUid, $pudUid)
{
try {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new ProcessSupervisor();
$supervisor->removeDynaformSupervisor($prjUid, $pudUid);
} catch (\Exception $e) {
//response
@@ -375,7 +377,7 @@ class ProcessSupervisors extends Api
public function doDeleteInputDocumentSupervisor($prjUid, $puiUid)
{
try {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new ProcessSupervisor();
$supervisor->removeInputDocumentSupervisor($prjUid, $puiUid);
} catch (\Exception $e) {
//response
@@ -401,7 +403,7 @@ class ProcessSupervisors extends Api
public function doPutProcessSupervisorDynaform($prjUid, $pud_uid, $pud_position = null)
{
try {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new ProcessSupervisor();
$objectData = $supervisor->updateProcessSupervisorDynaform($prjUid, $pud_uid, $pud_position);
//Response
$response = $objectData;
@@ -431,7 +433,7 @@ class ProcessSupervisors extends Api
public function doPutProcessSupervisorInputDocument($prjUid, $pui_uid, $pui_position = null)
{
try {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new ProcessSupervisor();
$objectData = $supervisor->updateProcessSupervisorInputDocument($prjUid, $pui_uid, $pui_position);
//Response
$response = $objectData;

View File

@@ -92,7 +92,7 @@ class ReportTable extends Api
* @param string $rep_tab_name {@from body}
* @param string $rep_tab_dsc {@from body}
* @param string $rep_tab_connection {@from body}
* @param string $rep_tab_type {@from body} {@choice NORMAL,GRID}
* @param string $rep_tab_type {@from body}
* @param string $rep_tab_grid {@from body}
*
* @return array

View File

@@ -1,8 +1,9 @@
<?php
namespace ProcessMaker\Services\Api\Role;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
use ProcessMaker\Services\Api;
use Luracast\Restler\RestException;
use Luracast\Restler\Util;
/**
* Role\Permission Api Controller
@@ -38,7 +39,7 @@ class Permission extends Api
public function doGetPermissions($rol_uid, $filter = null, $start = null, $limit = null)
{
try {
$response = $this->rolePermission->getPermissions($rol_uid, (preg_match("/^.*\/permissions$/", $this->restler->url))? "PERMISSIONS" : "AVAILABLE-PERMISSIONS", array("filter" => $filter), null, null, $start, $limit);
$response = $this->rolePermission->getPermissions($rol_uid, (preg_match("/^.*\/permissions$/", Util::$restler->url))? "PERMISSIONS" : "AVAILABLE-PERMISSIONS", array("filter" => $filter), null, null, $start, $limit);
return $response;
} catch (\Exception $e) {

View File

@@ -1,8 +1,9 @@
<?php
namespace ProcessMaker\Services\Api\Role;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
use ProcessMaker\Services\Api;
use Luracast\Restler\RestException;
use Luracast\Restler\Util;
/**
* Role\User Api Controller
@@ -40,7 +41,7 @@ class User extends Api
public function doGetUsers($rol_uid, $filter = null, $start = null, $limit = null)
{
try {
$option = (preg_match('/^.*\/users$/', $this->restler->url))? 'USERS' : 'AVAILABLE-USERS';
$option = (preg_match('/^.*\/users$/', Util::$restler->url))? 'USERS' : 'AVAILABLE-USERS';
$response = $this->roleUser->getUsers(
$rol_uid, $option, ['filter' => $filter, 'filterOption' => ''], null, null, $start, $limit

View File

@@ -165,7 +165,7 @@ class Type
}
/**
* @param string $gender {@from body}{@choice male,female}
* @param string $gender {@from body}
*/
public function postChoise($gender)
{

View File

@@ -16,14 +16,15 @@ use ProcessMaker\Policies\ControlUnderUpdating;
class Server implements iAuthenticate
{
/**
* @var OAuth2_Server
* @var OAuth2Server
*/
protected $server;
protected static $server;
/**
* @var OAuth2_Storage_Pdo
* @var Pdo
*/
protected $storage;
protected $scope = array();
protected static $storage;
protected $scope = [];
protected static $pmClientId;
protected static $userId;
@@ -40,38 +41,38 @@ class Server implements iAuthenticate
{
require_once 'PmPdo.php';
$this->scope = array(
$this->scope = [
'view_processes' => 'View Processes',
'edit_processes' => 'Edit Processes',
'*' => '*'
);
];
// $dsn is the Data Source Name for your database, for exmaple "mysql:dbname=my_oauth2_db;host=localhost"
$cnn = array('dsn' => self::$dsn, 'username' => self::$dbUser, 'password' => self::$dbPassword);
$cnn = ['dsn' => self::$dsn, 'username' => self::$dbUser, 'password' => self::$dbPassword];
if (self::$isRBAC) {
$config = array();
$cnnrbac = array('dsn' => self::$dsnRBAC, 'username' => self::$dbUserRBAC, 'password' => self::$dbPasswordRBAC);
$this->storage = new PmPdo($cnn, $config, $cnnrbac);
$config = [];
$cnnrbac = ['dsn' => self::$dsnRBAC, 'username' => self::$dbUserRBAC, 'password' => self::$dbPasswordRBAC];
static::$storage = new PmPdo($cnn, $config, $cnnrbac);
} else {
$this->storage = new PmPdo($cnn);
static::$storage = new PmPdo($cnn);
}
// Pass a storage object or array of storage objects to the OAuth2 server class
$this->server = new OAuth2Server($this->storage, array('allow_implicit' => true, 'access_lifetime' => 86400));
static::$server = new OAuth2Server(static::$storage, ['allow_implicit' => true, 'access_lifetime' => 86400]);
$this->server->setConfig('enforce_state', false);
static::$server->setConfig('enforce_state', false);
// Add the "Authorization Code" grant type (this is where the oauth magic happens)
$this->server->addGrantType(new \OAuth2\GrantType\AuthorizationCode($this->storage));
static::$server->addGrantType(new \OAuth2\GrantType\AuthorizationCode(static::$storage));
// Add the "Client Credentials" grant type (it is the simplest of the grant types)
$this->server->addGrantType(new \ProcessMaker\Services\OAuth2\PmClientCredentials($this->storage));
static::$server->addGrantType(new \ProcessMaker\Services\OAuth2\PmClientCredentials(static::$storage));
// Add the "Refresh token" grant type
$this->server->addGrantType(new \OAuth2\GrantType\RefreshToken(
$this->storage,
array("always_issue_new_refresh_token" => true)
static::$server->addGrantType(new \OAuth2\GrantType\RefreshToken(
static::$storage,
["always_issue_new_refresh_token" => true]
));
// create some users in memory
@@ -79,12 +80,12 @@ class Server implements iAuthenticate
// create a storage object
//$storage = new \OAuth2\Storage\Memory(array('user_credentials' => $users));
// create the grant type
$grantType = new \OAuth2\GrantType\UserCredentials($this->storage);
$grantType = new \OAuth2\GrantType\UserCredentials(static::$storage);
// add the grant type to your OAuth server
$this->server->addGrantType($grantType);
static::$server->addGrantType($grantType);
$scope = new \OAuth2\Scope(array('supported_scopes' => array_keys($this->scope)));
$this->server->setScopeUtil($scope);
$scope = new \OAuth2\Scope(['supported_scopes' => array_keys($this->scope)]);
static::$server->setScopeUtil($scope);
}
/**
@@ -94,7 +95,7 @@ class Server implements iAuthenticate
public function doPostExpireToken($token)
{
try {
$this->storage->expireToken($token);
static::$storage->expireToken($token);
} catch (\Exception $e) {
throw new RestException(400, $e->getMessage());
}
@@ -107,7 +108,7 @@ class Server implements iAuthenticate
public function doDeleteToken($token)
{
try {
$this->storage->deleteToken($token);
static::$storage->deleteToken($token);
} catch (\Exception $e) {
throw new RestException(400, $e->getMessage());
}
@@ -208,7 +209,7 @@ class Server implements iAuthenticate
$clientId = $_GET['client_id'];
$requestedScope = isset($_GET['scope']) ? $_GET['scope'] : '*';
$requestedScope = empty($requestedScope) ? array() : explode(' ', $requestedScope);
$client = $this->storage->getClientDetails($clientId);
$client = static::$storage->getClientDetails($clientId);
if (empty($client)) {
// throw error, client does not exist.
@@ -259,7 +260,7 @@ class Server implements iAuthenticate
$request = \OAuth2\Request::createFromGlobals();
$response = new \OAuth2\Response();
$response = $this->server->handleAuthorizeRequest(
$response = static::$server->handleAuthorizeRequest(
$request,
$response,
(bool)$authorize,
@@ -279,7 +280,7 @@ class Server implements iAuthenticate
* Stage 3: Client directly calls this api to exchange access token
* It can then use this access token to make calls to protected api.
* @format JsonFormat,UploadFormat
* @param object $request
* @param array $request
* @param boolean $returnResponse
* @return mixed
*/
@@ -288,7 +289,7 @@ class Server implements iAuthenticate
ControlUnderUpdating::verifyUnderUpgrading();
// Handle a request for an OAuth2.0 Access Token and send the response to the client
if ($request == null) {
if ($request == null || is_array($request)) {
$request = Request::createFromGlobals();
}
@@ -305,7 +306,7 @@ class Server implements iAuthenticate
}
}
$response = $this->server->handleTokenRequest($request); //Set/Get token //PmPdo->setAccessToken()
$response = static::$server->handleTokenRequest($request); //Set/Get token //PmPdo->setAccessToken()
$token = $response->getParameters();
@@ -313,7 +314,7 @@ class Server implements iAuthenticate
if ($request == null) {
session_start();
}
$data = $this->storage->getAccessToken($token['access_token']);
$data = static::$storage->getAccessToken($token['access_token']);
// verify if the client is our local PM Designer client
if ($data['client_id'] == self::getPmClientId()) {
@@ -345,8 +346,8 @@ class Server implements iAuthenticate
public function __isAllowed()
{
$request = \OAuth2\Request::createFromGlobals();
$allowed = $this->server->verifyResourceRequest($request);
$token = $this->server->getAccessTokenData($request);
$allowed = static::$server->verifyResourceRequest($request);
$token = static::$server->getAccessTokenData($request);
self::$userId = !empty($token['user_id']) ? $token['user_id'] : '';
// Session handling to prevent session lose in other places like, home, admin, etc
// when user is using the new designer that have not session because it is using only the API
@@ -418,7 +419,7 @@ class Server implements iAuthenticate
public function getServer()
{
return $this->server;
return static::$server;
}
public static function getUserId()

View File

@@ -300,15 +300,15 @@ function eprint ($s = "", $c = null)
if (isset( $c )) {
switch ($c) {
case 'green':
printf( "\033[0;35;32m$s\033[0m" );
printf("\033[0;35;32m$s\033[0m", $s);
return;
break;
case 'red':
printf( "\033[0;35;31m$s\033[0m" );
printf("\033[0;35;31m$s\033[0m", $s);
return;
break;
case 'blue':
printf( "\033[0;35;34m$s\033[0m" );
printf( "\033[0;35;34m$s\033[0m", $s);
return;
break;
default:
@@ -352,15 +352,15 @@ function eprintln ($s = "", $c = null)
if (isset( $c ) && (PHP_OS != 'WINNT')) {
switch ($c) {
case 'green':
printf( "\033[0;35;32m$s\033[0m\n" );
printf("\033[0;35;32m$s\033[0m\n", $s);
return;
break;
case 'red':
printf( "\033[0;35;31m$s\033[0m\n" );
printf("\033[0;35;31m$s\033[0m\n", $s);
return;
break;
case 'blue':
printf( "\033[0;35;34m$s\033[0m\n" );
printf("\033[0;35;34m$s\033[0m\n", $s);
return;
break;
}
@@ -595,7 +595,7 @@ function toSqlWithBindings(Illuminate\Database\Eloquent\Builder $queryObject) {
*/
function getMysqlVersion()
{
$results = DB::select(DB::raw("select version()"));
$results = DB::select("select version()");
$mysqlVersion = $results[0]->{'version()'};
return $mysqlVersion;
@@ -738,3 +738,13 @@ function getConstant(string $name, $default = '')
{
return defined($name) === true ? constant($name) : $default;
}
/**
* Get raw query prepared
*
* @param $query The query to prepare
* @return string
*/
function rawQuery($query): string {
return DB::raw($query)->getValue(DB::getQueryGrammar());
}