Merged in bugfix/HOR-2758 (pull request #5456)
HOR-2758 Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
@@ -255,6 +255,7 @@ class pmDynaform
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$dtFields = array_merge($this->fields['APP_DATA'], $dtFields);
|
||||||
$sql = G::replaceDataField($json->sql, $dtFields);
|
$sql = G::replaceDataField($json->sql, $dtFields);
|
||||||
if ($value === "suggest") {
|
if ($value === "suggest") {
|
||||||
$sql = $this->sqlParse($sql, function($parsed, &$select, &$from, &$where, &$groupBy, &$having, &$orderBy, &$limit) use ($json) {
|
$sql = $this->sqlParse($sql, function($parsed, &$select, &$from, &$where, &$groupBy, &$having, &$orderBy, &$limit) use ($json) {
|
||||||
|
|||||||
@@ -3307,4 +3307,38 @@ class Cases
|
|||||||
|
|
||||||
return $arrayAccess;
|
return $arrayAccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Global System Variables
|
||||||
|
* @param array $appData
|
||||||
|
* @param array $dataVariable
|
||||||
|
* @return array
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
public static function getGlobalVariables($appData = array(), $dataVariable = array())
|
||||||
|
{
|
||||||
|
$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'];
|
||||||
|
}
|
||||||
|
if (!isset($dataVariable['PROCESS']) || empty($dataVariable['PROCESS'])) {
|
||||||
|
$dataVariable['PROCESS'] = (isset($dataVariable['PRO_UID']) && $dataVariable['PRO_UID'] != '') ? $dataVariable['PRO_UID'] : $appData['PROCESS'];
|
||||||
|
}
|
||||||
|
if (isset($appData['TASK']) && !empty($appData['TASK'])) {
|
||||||
|
$dataVariable['TASK'] = $appData['TASK'];
|
||||||
|
}
|
||||||
|
if (isset($appData['INDEX']) && !empty($appData['INDEX'])) {
|
||||||
|
$dataVariable['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();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $dataVariable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -970,6 +970,40 @@ class Light extends Api
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @url GET /project/:prj_uid/dynaformprocessed/:dyn_uid
|
||||||
|
*
|
||||||
|
* @param string $dyn_uid {@min 32}{@max 32}
|
||||||
|
* @param string $prj_uid {@min 32}{@max 32}
|
||||||
|
*/
|
||||||
|
public function doGetDynaformProcessed($prj_uid, $dyn_uid, $app_uid = null, $del_index = 0)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$dynaForm = new \ProcessMaker\BusinessModel\DynaForm();
|
||||||
|
$dynaForm->setFormatFieldNameInUppercase(false);
|
||||||
|
$_SESSION['PROCESS'] = $prj_uid;
|
||||||
|
$response = $dynaForm->getDynaForm($dyn_uid);
|
||||||
|
$result = $this->parserDataDynaForm($response);
|
||||||
|
$result['formContent'] = (isset($result['formContent']) && $result['formContent'] != null) ?
|
||||||
|
\G::json_decode($result['formContent']) : "";
|
||||||
|
|
||||||
|
$caseVariables = array();
|
||||||
|
if (!is_null($app_uid)) {
|
||||||
|
$case = new \Cases();
|
||||||
|
$fields = $case->loadCase($app_uid, $del_index);
|
||||||
|
$caseVariables = array_merge($fields['APP_DATA'],
|
||||||
|
\ProcessMaker\BusinessModel\Cases::getGlobalVariables($fields['APP_DATA']));
|
||||||
|
}
|
||||||
|
|
||||||
|
\G::LoadClass("pmDynaform");
|
||||||
|
$pmDynaform = new \pmDynaform(array("APP_DATA" => $caseVariables, "CURRENT_DYNAFORM" => $dyn_uid));
|
||||||
|
$pmDynaform->jsonr($result['formContent']);
|
||||||
|
return $result;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @url GET /project/:prj_uid/dynaform/:dyn_uid
|
* @url GET /project/:prj_uid/dynaform/:dyn_uid
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user