HOR-3185 improvement
This commit is contained in:
@@ -12,6 +12,7 @@ use WsBase;
|
||||
use RBAC;
|
||||
use Applications;
|
||||
use PmDynaform;
|
||||
use ProcessMaker\Services\OAuth2\Server;
|
||||
|
||||
class Cases
|
||||
{
|
||||
@@ -3245,26 +3246,46 @@ class Cases
|
||||
$appData = array_change_key_case($appData, CASE_UPPER);
|
||||
$dataVariable = array_change_key_case($dataVariable, CASE_UPPER);
|
||||
|
||||
if (!isset($dataVariable['APPLICATION']) || empty($dataVariable['APPLICATION'])) {
|
||||
$dataVariable['APPLICATION'] = (isset($dataVariable['APP_UID']) && $dataVariable['APP_UID'] != '') ? $dataVariable['APP_UID'] : $appData['APPLICATION'];
|
||||
$result = [];
|
||||
//we get the appData parameters
|
||||
if (!empty($appData['APPLICATION'])) {
|
||||
$result['APPLICATION'] = $appData['APPLICATION'];
|
||||
}
|
||||
if (!isset($dataVariable['PROCESS']) || empty($dataVariable['PROCESS'])) {
|
||||
$dataVariable['PROCESS'] = (isset($dataVariable['PRO_UID']) && $dataVariable['PRO_UID'] != '') ? $dataVariable['PRO_UID'] : $appData['PROCESS'];
|
||||
if (!empty($appData['PROCESS'])) {
|
||||
$result['PROCESS'] = $appData['PROCESS'];
|
||||
}
|
||||
if (isset($appData['TASK']) && !empty($appData['TASK'])) {
|
||||
$dataVariable['TASK'] = $appData['TASK'];
|
||||
if (!empty($appData['TASK'])) {
|
||||
$result['TASK'] = $appData['TASK'];
|
||||
}
|
||||
if (isset($appData['INDEX']) && !empty($appData['INDEX'])) {
|
||||
$dataVariable['INDEX'] = $appData['INDEX'];
|
||||
if (!empty($appData['INDEX'])) {
|
||||
$result['INDEX'] = $appData['INDEX'];
|
||||
}
|
||||
$dataVariable['USER_LOGGED'] = \ProcessMaker\Services\OAuth2\Server::getUserId();
|
||||
if (isset($dataVariable['USER_LOGGED']) && !empty($dataVariable['USER_LOGGED'])) {
|
||||
$oUserLogged = new \Users();
|
||||
$oUserLogged->load($dataVariable['USER_LOGGED']);
|
||||
$dataVariable['USR_USERNAME'] = $oUserLogged->getUsrUsername();
|
||||
if (!empty($appData['USER_LOGGED'])) {
|
||||
$result['USER_LOGGED'] = $appData['USER_LOGGED'];
|
||||
}
|
||||
if (!empty($appData['USR_USERNAME'])) {
|
||||
$result['USR_USERNAME'] = $appData['USR_USERNAME'];
|
||||
}
|
||||
|
||||
return $dataVariable;
|
||||
//we try to get the missing elements
|
||||
if (!empty($dataVariable['APP_UID']) && empty($result['APPLICATION'])) {
|
||||
$result['APPLICATION'] = $dataVariable['APP_UID'];
|
||||
}
|
||||
if (!empty($dataVariable['PRO_UID']) && empty($result['PROCESS'])) {
|
||||
$result['PROCESS'] = $dataVariable['PRO_UID'];
|
||||
}
|
||||
if (empty($result['USER_LOGGED'])) {
|
||||
$result['USER_LOGGED'] = Server::getUserId();
|
||||
if (!empty($result['USER_LOGGED'])) {
|
||||
$oUserLogged = new Users();
|
||||
$oUserLogged->load($dataVariable['USER_LOGGED']);
|
||||
$result['USR_USERNAME'] = $oUserLogged->getUsrUsername();
|
||||
}
|
||||
}
|
||||
|
||||
//the parameter dataVariable may contain additional elements
|
||||
$result = array_merge($dataVariable, $result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -778,7 +778,7 @@ class Variable
|
||||
$case = new \Cases();
|
||||
$fields = $case->loadCase($appUid, $delIndex);
|
||||
$appData = $fields["APP_DATA"];
|
||||
$appData = array_merge($appData, \ProcessMaker\BusinessModel\Cases::getGlobalVariables($appData));
|
||||
$appData = array_merge($appData, Cases::getGlobalVariables($appData));
|
||||
$paramsWithoutAppData = $params;
|
||||
$params = array_merge($appData, $params);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user