HOR-3221 improvement

This commit is contained in:
Roly Rudy Gutierrez Pinto
2017-09-20 10:27:38 -04:00
parent 8a07af4461
commit 50b23ff793
2 changed files with 15 additions and 9 deletions

View File

@@ -13,6 +13,7 @@ use RBAC;
use Applications; use Applications;
use PmDynaform; use PmDynaform;
use ProcessMaker\Services\OAuth2\Server; use ProcessMaker\Services\OAuth2\Server;
use Users;
class Cases class Cases
{ {
@@ -1680,7 +1681,7 @@ class Cases
$arrayCaseVariable = []; $arrayCaseVariable = [];
if (!is_null($dynaFormUid)) { if (!is_null($dynaFormUid)) {
$data = [];
$data["APP_DATA"] = $fields['APP_DATA']; $data["APP_DATA"] = $fields['APP_DATA'];
$data["CURRENT_DYNAFORM"] = $dynaFormUid; $data["CURRENT_DYNAFORM"] = $dynaFormUid;
$pmDynaForm = new PmDynaform($data); $pmDynaForm = new PmDynaform($data);
@@ -3260,12 +3261,6 @@ class Cases
if (!empty($appData['INDEX'])) { if (!empty($appData['INDEX'])) {
$result['INDEX'] = $appData['INDEX']; $result['INDEX'] = $appData['INDEX'];
} }
if (!empty($appData['USER_LOGGED'])) {
$result['USER_LOGGED'] = $appData['USER_LOGGED'];
}
if (!empty($appData['USR_USERNAME'])) {
$result['USR_USERNAME'] = $appData['USR_USERNAME'];
}
//we try to get the missing elements //we try to get the missing elements
if (!empty($dataVariable['APP_UID']) && empty($result['APPLICATION'])) { if (!empty($dataVariable['APP_UID']) && empty($result['APPLICATION'])) {
@@ -3274,11 +3269,19 @@ class Cases
if (!empty($dataVariable['PRO_UID']) && empty($result['PROCESS'])) { if (!empty($dataVariable['PRO_UID']) && empty($result['PROCESS'])) {
$result['PROCESS'] = $dataVariable['PRO_UID']; $result['PROCESS'] = $dataVariable['PRO_UID'];
} }
$result['USER_LOGGED'] = '';
$result['USR_USERNAME'] = '';
global $RBAC;
if (isset($RBAC) && isset($RBAC->aUserInfo)) {
$result['USER_LOGGED'] = $RBAC->aUserInfo['USER_INFO']['USR_UID'];
$result['USR_USERNAME'] = $RBAC->aUserInfo['USER_INFO']['USR_USERNAME'];
}
if (empty($result['USER_LOGGED'])) { if (empty($result['USER_LOGGED'])) {
$result['USER_LOGGED'] = Server::getUserId(); $result['USER_LOGGED'] = Server::getUserId();
if (!empty($result['USER_LOGGED'])) { if (!empty($result['USER_LOGGED'])) {
$oUserLogged = new Users(); $oUserLogged = new Users();
$oUserLogged->load($dataVariable['USER_LOGGED']); $oUserLogged->load($result['USER_LOGGED']);
$result['USR_USERNAME'] = $oUserLogged->getUsrUsername(); $result['USR_USERNAME'] = $oUserLogged->getUsrUsername();
} }
} }

View File

@@ -774,12 +774,12 @@ class Variable
unset($params["limit"]); unset($params["limit"]);
//Get appData and system variables //Get appData and system variables
$paramsWithoutAppData = $params;
if ($appUid !== null) { if ($appUid !== null) {
$case = new \Cases(); $case = new \Cases();
$fields = $case->loadCase($appUid, $delIndex); $fields = $case->loadCase($appUid, $delIndex);
$appData = $fields["APP_DATA"]; $appData = $fields["APP_DATA"];
$appData = array_merge($appData, Cases::getGlobalVariables($appData)); $appData = array_merge($appData, Cases::getGlobalVariables($appData));
$paramsWithoutAppData = $params;
$params = array_merge($appData, $params); $params = array_merge($appData, $params);
} }
@@ -798,6 +798,9 @@ class Variable
$field->queryStart = $start; $field->queryStart = $start;
$field->queryLimit = $limit; $field->queryLimit = $limit;
//Grids only access the global variables of 'ProcessMaker', other variables are removed. //Grids only access the global variables of 'ProcessMaker', other variables are removed.
//The property 'columnWidth' is only present in the controls of a grid,
//in the current change there is no specific property that indicates
//if the control is in the grid.
if (isset($field->columnWidth)) { if (isset($field->columnWidth)) {
$pmDynaform->fields["APP_DATA"] = Cases::getGlobalVariables($appData); $pmDynaform->fields["APP_DATA"] = Cases::getGlobalVariables($appData);
$field->queryInputData = $paramsWithoutAppData; $field->queryInputData = $paramsWithoutAppData;