HOR-3185 improvement
This commit is contained in:
@@ -12,6 +12,7 @@ use WsBase;
|
|||||||
use RBAC;
|
use RBAC;
|
||||||
use Applications;
|
use Applications;
|
||||||
use PmDynaform;
|
use PmDynaform;
|
||||||
|
use ProcessMaker\Services\OAuth2\Server;
|
||||||
|
|
||||||
class Cases
|
class Cases
|
||||||
{
|
{
|
||||||
@@ -3245,26 +3246,46 @@ class Cases
|
|||||||
$appData = array_change_key_case($appData, CASE_UPPER);
|
$appData = array_change_key_case($appData, CASE_UPPER);
|
||||||
$dataVariable = array_change_key_case($dataVariable, CASE_UPPER);
|
$dataVariable = array_change_key_case($dataVariable, CASE_UPPER);
|
||||||
|
|
||||||
if (!isset($dataVariable['APPLICATION']) || empty($dataVariable['APPLICATION'])) {
|
$result = [];
|
||||||
$dataVariable['APPLICATION'] = (isset($dataVariable['APP_UID']) && $dataVariable['APP_UID'] != '') ? $dataVariable['APP_UID'] : $appData['APPLICATION'];
|
//we get the appData parameters
|
||||||
|
if (!empty($appData['APPLICATION'])) {
|
||||||
|
$result['APPLICATION'] = $appData['APPLICATION'];
|
||||||
}
|
}
|
||||||
if (!isset($dataVariable['PROCESS']) || empty($dataVariable['PROCESS'])) {
|
if (!empty($appData['PROCESS'])) {
|
||||||
$dataVariable['PROCESS'] = (isset($dataVariable['PRO_UID']) && $dataVariable['PRO_UID'] != '') ? $dataVariable['PRO_UID'] : $appData['PROCESS'];
|
$result['PROCESS'] = $appData['PROCESS'];
|
||||||
}
|
}
|
||||||
if (isset($appData['TASK']) && !empty($appData['TASK'])) {
|
if (!empty($appData['TASK'])) {
|
||||||
$dataVariable['TASK'] = $appData['TASK'];
|
$result['TASK'] = $appData['TASK'];
|
||||||
}
|
}
|
||||||
if (isset($appData['INDEX']) && !empty($appData['INDEX'])) {
|
if (!empty($appData['INDEX'])) {
|
||||||
$dataVariable['INDEX'] = $appData['INDEX'];
|
$result['INDEX'] = $appData['INDEX'];
|
||||||
}
|
}
|
||||||
$dataVariable['USER_LOGGED'] = \ProcessMaker\Services\OAuth2\Server::getUserId();
|
if (!empty($appData['USER_LOGGED'])) {
|
||||||
if (isset($dataVariable['USER_LOGGED']) && !empty($dataVariable['USER_LOGGED'])) {
|
$result['USER_LOGGED'] = $appData['USER_LOGGED'];
|
||||||
$oUserLogged = new \Users();
|
}
|
||||||
$oUserLogged->load($dataVariable['USER_LOGGED']);
|
if (!empty($appData['USR_USERNAME'])) {
|
||||||
$dataVariable['USR_USERNAME'] = $oUserLogged->getUsrUsername();
|
$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();
|
$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, \ProcessMaker\BusinessModel\Cases::getGlobalVariables($appData));
|
$appData = array_merge($appData, Cases::getGlobalVariables($appData));
|
||||||
$paramsWithoutAppData = $params;
|
$paramsWithoutAppData = $params;
|
||||||
$params = array_merge($appData, $params);
|
$params = array_merge($appData, $params);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user