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 PmDynaform;
use ProcessMaker\Services\OAuth2\Server;
use Users;
class Cases
{
@@ -1680,7 +1681,7 @@ class Cases
$arrayCaseVariable = [];
if (!is_null($dynaFormUid)) {
$data = [];
$data["APP_DATA"] = $fields['APP_DATA'];
$data["CURRENT_DYNAFORM"] = $dynaFormUid;
$pmDynaForm = new PmDynaform($data);
@@ -3260,12 +3261,6 @@ class Cases
if (!empty($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
if (!empty($dataVariable['APP_UID']) && empty($result['APPLICATION'])) {
@@ -3274,11 +3269,19 @@ class Cases
if (!empty($dataVariable['PRO_UID']) && empty($result['PROCESS'])) {
$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'])) {
$result['USER_LOGGED'] = Server::getUserId();
if (!empty($result['USER_LOGGED'])) {
$oUserLogged = new Users();
$oUserLogged->load($dataVariable['USER_LOGGED']);
$oUserLogged->load($result['USER_LOGGED']);
$result['USR_USERNAME'] = $oUserLogged->getUsrUsername();
}
}

View File

@@ -774,12 +774,12 @@ class Variable
unset($params["limit"]);
//Get appData and system variables
$paramsWithoutAppData = $params;
if ($appUid !== null) {
$case = new \Cases();
$fields = $case->loadCase($appUid, $delIndex);
$appData = $fields["APP_DATA"];
$appData = array_merge($appData, Cases::getGlobalVariables($appData));
$paramsWithoutAppData = $params;
$params = array_merge($appData, $params);
}
@@ -798,6 +798,9 @@ class Variable
$field->queryStart = $start;
$field->queryLimit = $limit;
//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)) {
$pmDynaform->fields["APP_DATA"] = Cases::getGlobalVariables($appData);
$field->queryInputData = $paramsWithoutAppData;