Merge branch 'develop' into feature/HOR-3056

This commit is contained in:
qronald
2017-05-18 15:31:23 -04:00
542 changed files with 63584 additions and 17538 deletions

View File

@@ -232,11 +232,14 @@ class Cases
Validator::usrUid($dataList["userId"], "userId");
}
G::LoadClass("applications");
$solrEnabled = false;
$userUid = $dataList["userId"];
$callback = isset( $dataList["callback"] ) ? $dataList["callback"] : "stcCallback1001";
$dir = isset( $dataList["dir"] ) ? $dataList["dir"] : "DESC";
$sort = isset( $dataList["sort"] ) ? $dataList["sort"] : "APP_CACHE_VIEW.APP_NUMBER";
$sort = isset( $dataList["sort"] ) ? $dataList["sort"] : "APPLICATION.APP_NUMBER";
if ($sort === 'APP_CACHE_VIEW.APP_NUMBER') {
$sort = "APPLICATION.APP_NUMBER";
}
$start = isset( $dataList["start"] ) ? $dataList["start"] : "0";
$limit = isset( $dataList["limit"] ) ? $dataList["limit"] : "";
$filter = isset( $dataList["filter"] ) ? $dataList["filter"] : "";
@@ -253,126 +256,36 @@ class Cases
$newerThan = (!empty($dataList['newerThan']))? $dataList['newerThan'] : '';
$oldestThan = (!empty($dataList['oldestthan']))? $dataList['oldestthan'] : '';
$first = isset( $dataList["first"] ) ? true :false;
$filterStatus = isset( $dataList["filterStatus"] ) ? strtoupper( $dataList["filterStatus"] ) : "";
$u = new \ProcessMaker\BusinessModel\User();
if ($action == "search" && !$u->checkPermission($dataList["userId"], "PM_ALLCASES")) {
throw new \Exception(\G::LoadTranslation("ID_CASE_USER_NOT_HAVE_PERMISSION", array($dataList["userId"])));
}
$valuesCorrect = array('todo', 'draft', 'paused', 'sent', 'selfservice', 'unassigned', 'search');
if (!in_array($action, $valuesCorrect)) {
throw (new \Exception(\G::LoadTranslation("ID_INCORRECT_VALUE_ACTION")));
}
$start = (int)$start;
$start = abs($start);
if ($start != 0) {
$start--;
}
$limit = (int)$limit;
$limit = abs($limit);
if ($limit == 0) {
G::LoadClass("configuration");
$conf = new \Configurations();
$generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', '');
if (isset($generalConfCasesList['casesListRowNumber'])) {
$limit = (int)$generalConfCasesList['casesListRowNumber'];
} else {
$limit = 25;
}
} else {
$limit = (int)$limit;
}
if ($sort != 'APP_CACHE_VIEW.APP_NUMBER') {
$sort = G::toUpper($sort);
$columnsAppCacheView = \AppCacheViewPeer::getFieldNames(\BasePeer::TYPE_FIELDNAME);
if (!(in_array($sort, $columnsAppCacheView))) {
$sort = 'APP_CACHE_VIEW.APP_NUMBER';
}
}
$dir = G::toUpper($dir);
if (!($dir == 'DESC' || $dir == 'ASC')) {
$dir = 'ASC';
}
if ($process != '') {
Validator::proUid($process, '$pro_uid');
}
if ($category != '') {
Validator::catUid($category, '$cat_uid');
}
$status = G::toUpper($status);
$listStatus = array('TO_DO', 'DRAFT', 'COMPLETED', 'CANCELLED', 'OPEN', 'CLOSE');
if (!(in_array($status, $listStatus))) {
$status = '';
}
if ($user != '') {
Validator::usrUid($user, '$usr_uid');
}
if ($dateFrom != '') {
Validator::isDate($dateFrom, 'Y-m-d', '$date_from');
}
if ($dateTo != '') {
Validator::isDate($dateTo, 'Y-m-d', '$date_to');
}
if ($action == 'search' || $action == 'to_reassign') {
$userUid = ($user == "CURRENT_USER") ? $userUid : $user;
if ($first) {
$result = array();
$result['totalCount'] = 0;
$result['data'] = array();
return $result;
}
}
G::LoadClass("applications");
$apps = new \Applications();
$result = $apps->getAll(
$response = $apps->searchAll(
$userUid,
$start,
$limit,
$action,
$filter,
$search,
$process,
$status,
$type,
$dateFrom,
$dateTo,
$callback,
$filterStatus,
$dir,
(strpos($sort, ".") !== false) ? $sort : "APP_CACHE_VIEW." . $sort,
$sort,
$category,
true,
$paged,
$newerThan,
$oldestThan
$dateFrom,
$dateTo
);
if (!empty($result['data'])) {
foreach ($result['data'] as &$value) {
$value = array_change_key_case($value, CASE_LOWER);
}
}
if ($paged == false) {
$response = $result['data'];
} else {
$response['total'] = $result['totalCount'];
$response['start'] = $start+1;
$response['limit'] = $limit;
$response['sort'] = G::toLower($sort);
$response['dir'] = G::toLower($dir);
$response['cat_uid'] = $category;
$response['pro_uid'] = $process;
$response['search'] = $search;
if ($action == 'search') {
$response['app_status'] = G::toLower($status);
$response['usr_uid'] = $user;
$response['date_from'] = $dateFrom;
$response['date_to'] = $dateTo;
}
$response['data'] = $result['data'];
$response['total'] = 0;
$response['start'] = $start + 1;
$response['limit'] = $limit;
$response['sort'] = G::toLower($sort);
$response['dir'] = G::toLower($dir);
$response['cat_uid'] = $category;
$response['pro_uid'] = $process;
$response['search'] = $search;
if ($action == 'search') {
$response['app_status'] = G::toLower($status);
$response['usr_uid'] = $user;
$response['date_from'] = $dateFrom;
$response['date_to'] = $dateTo;
}
return $response;
}
@@ -1095,6 +1008,12 @@ class Cases
try {
if (!$delIndex) {
$delIndex = \AppDelegation::getCurrentIndex($applicationUid);
//Check if the next task is a subprocess SYNCHRONOUS with a thread Open
$subAppData = new \SubApplication();
$caseSubprocessPending = $subAppData->isSubProcessWithCasePending($applicationUid, $delIndex);
if ($caseSubprocessPending) {
throw (new \Exception(\G::LoadTranslation("ID_CASE_ALREADY_DERIVATED")));
}
}
\G::LoadClass('wsBase');
$ws = new \wsBase();

View File

@@ -622,6 +622,7 @@ class ScriptTask
if (!is_null($trigger)) {
$pmScript = new \PMScript();
$pmScript->setDataTrigger($trigger->toArray(\BasePeer::TYPE_FIELDNAME));
$pmScript->setFields($arrayApplicationData["APP_DATA"]);
$pmScript->setScript($trigger->getTriWebbot());

View File

@@ -270,7 +270,7 @@ class Light extends Api
'PREVIOUS_USR_UID' => 'userId',
'PREVIOUS_USR_FIRSTNAME' => 'firstName',
'PREVIOUS_USR_LASTNAME' => 'lastName',
'PREVIOUS_USR_USERNAME' => 'fullName',
'PREVIOUS_USR_USERNAME' => 'userName',
),
'process' => array(
'PRO_UID' => 'processId',
@@ -369,7 +369,7 @@ class Light extends Api
'USR_UID' => 'userId',
'USR_FIRSTNAME' => 'firstName',
'USR_LASTNAME' => 'lastName',
'USR_USERNAME' => 'fullName',
'USR_USERNAME' => 'userName',
),
'process' => array(
'PRO_UID' => 'processId',
@@ -472,13 +472,13 @@ class Light extends Api
'USR_UID' => 'userId',
'USR_FIRSTNAME' => 'firstName',
'USR_LASTNAME' => 'lastName',
'USR_USERNAME' => 'fullName',
'USR_USERNAME' => 'userName',
),
'prevUser' => array(
'PREVIOUS_USR_UID' => 'userId',
'PREVIOUS_USR_FIRSTNAME' => 'firstName',
'PREVIOUS_USR_LASTNAME' => 'lastName',
'PREVIOUS_USR_USERNAME' => 'fullName',
'PREVIOUS_USR_USERNAME' => 'userName',
),
'process' => array(
'PRO_UID' => 'processId',
@@ -572,13 +572,13 @@ class Light extends Api
'USR_UID' => 'userId',
'DEL_CURRENT_USR_FIRSTNAME' => 'firstName',
'DEL_CURRENT_USR_LASTNAME' => 'lastName',
'DEL_CURRENT_USR_USERNAME' => 'fullName',
'DEL_CURRENT_USR_USERNAME' => 'userName',
),
'prevUser' => array(
'DEL_PREVIOUS_USR_UID' => 'userId',
'DEL_PREVIOUS_USR_FIRSTNAME' => 'firstName',
'DEL_PREVIOUS_USR_LASTNAME' => 'lastName',
'DEL_PREVIOUS_USR_USERNAME' => 'fullName',
'DEL_PREVIOUS_USR_USERNAME' => 'userName',
),
'process' => array(
'PRO_UID' => 'processId',
@@ -655,13 +655,13 @@ class Light extends Api
'usrcr_usr_uid' => 'userId',
'usrcr_usr_firstname' => 'firstName',
'usrcr_usr_lastname' => 'lastName',
'usrcr_usr_username' => 'fullName',
'usrcr_usr_username' => 'userName',
),
'prevUser' => array(
'previous_usr_uid' => 'userId',
'previous_usr_firstname' => 'firstName',
'previous_usr_lastname' => 'lastName',
'previous_usr_username' => 'fullName',
'previous_usr_username' => 'userName',
),
'process' => array(
'pro_uid' => 'processId',

View File

@@ -57,6 +57,9 @@ class Project extends Api
try {
$project = Adapter\BpmnWorkflow::getStruct($prj_uid);
$userProperty = new \UsersProperties();
$property = $userProperty->loadOrCreateIfNotExists($this->getUserId());
$project['usr_setting_designer'] = isset($property['USR_SETTING_DESIGNER']) ? \G::json_decode($property['USR_SETTING_DESIGNER']) : null;
return DateTime::convertUtcToIso8601($project, $this->arrayFieldIso8601);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
@@ -96,6 +99,16 @@ class Project extends Api
public function doPutProject($prj_uid, $request_data)
{
try {
if (array_key_exists('usr_setting_designer', $request_data)) {
$oUserProperty = new \UsersProperties();
$property = $oUserProperty->loadOrCreateIfNotExists($this->getUserId());
$propertyArray = isset($property['USR_SETTING_DESIGNER']) ? \G::json_decode($property['USR_SETTING_DESIGNER'], true) : [];
$usrSettingDesigner = array_merge($propertyArray, $request_data['usr_setting_designer']);
$property['USR_SETTING_DESIGNER'] = \G::json_encode($usrSettingDesigner);
$oUserProperty->update($property);
unset($request_data['usr_setting_designer']);
}
Validator::throwExceptionIfDataNotMetIso8601Format($request_data, $this->arrayFieldIso8601);
return Adapter\BpmnWorkflow::updateFromStruct($prj_uid, DateTime::convertDataToUtc($request_data, $this->arrayFieldIso8601));
} catch (\Exception $e) {