HOR-4902
This commit is contained in:
@@ -2,11 +2,12 @@
|
|||||||
|
|
||||||
namespace ProcessMaker\BusinessModel;
|
namespace ProcessMaker\BusinessModel;
|
||||||
|
|
||||||
use G;
|
|
||||||
use Exception;
|
|
||||||
use AdditionalTables;
|
use AdditionalTables;
|
||||||
|
use Cases as ClassesCases;
|
||||||
|
use Exception;
|
||||||
|
use G;
|
||||||
use PmDynaform;
|
use PmDynaform;
|
||||||
use ProcessMaker\BusinessModel\Cases;
|
|
||||||
|
|
||||||
class Variable
|
class Variable
|
||||||
{
|
{
|
||||||
@@ -742,13 +743,14 @@ class Variable
|
|||||||
* control.
|
* control.
|
||||||
* If app_uid is not sent you can not get the appData in an environment where
|
* If app_uid is not sent you can not get the appData in an environment where
|
||||||
* only endPoint is used, it is always advisable to send the app_uid and _index.
|
* only endPoint is used, it is always advisable to send the app_uid and _index.
|
||||||
* Note: You do not get triguer execution values where only endPoint is used.
|
* Note: You do not get trigger execution values where only endPoint is used.
|
||||||
* @param type $proUid
|
* @param string $proUid
|
||||||
* @param array $params
|
* @param array $params
|
||||||
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function executeSqlControl($proUid, array $params = array())
|
public function executeSqlControl($proUid, array $params = [])
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//Get and clear vector data that does not correspond to variables
|
//Get and clear vector data that does not correspond to variables
|
||||||
@@ -769,21 +771,24 @@ class Variable
|
|||||||
unset($params["limit"]);
|
unset($params["limit"]);
|
||||||
|
|
||||||
//Get appData and system variables
|
//Get appData and system variables
|
||||||
$paramsWithoutAppData = $params;
|
$paramsAndGlobal = $params;
|
||||||
$globalVariables = [];
|
$globalVariables = [];
|
||||||
if ($appUid !== null) {
|
if ($appUid !== null) {
|
||||||
$case = new \Cases();
|
$case = new ClassesCases();
|
||||||
$fields = $case->loadCase($appUid, $delIndex);
|
$fields = $case->loadCase($appUid, $delIndex);
|
||||||
$appData = $fields["APP_DATA"];
|
$appData = $fields["APP_DATA"];
|
||||||
$globalVariables = Cases::getGlobalVariables($appData);
|
$globalVariables = Cases::getGlobalVariables($appData);
|
||||||
$appData = array_merge($appData, $globalVariables);
|
$appDataAndGlobal = array_merge($appData, $globalVariables);
|
||||||
$params = array_merge($appData, $params);
|
//Set the global variables and app data when this is not a grid
|
||||||
|
$params = array_merge($appDataAndGlobal, $params);
|
||||||
|
//Set the global variables for the grid
|
||||||
|
$paramsAndGlobal = array_merge($globalVariables, $paramsAndGlobal);
|
||||||
}
|
}
|
||||||
|
|
||||||
//This value is required to be able to query the database.
|
//This value is required to be able to query the database.
|
||||||
$_SESSION["PROCESS"] = $proUid;
|
$_SESSION["PROCESS"] = $proUid;
|
||||||
//The pmdynaform class is instantiated
|
//The pmdynaform class is instantiated
|
||||||
$pmDynaform = new PmDynaform(array("APP_DATA" => $params));
|
$pmDynaform = new PmDynaform(["APP_DATA" => $params]);
|
||||||
|
|
||||||
//Get control from dynaform.
|
//Get control from dynaform.
|
||||||
//The parameters: queryFilter, queryStart, queryLimit, are only necessary
|
//The parameters: queryFilter, queryStart, queryLimit, are only necessary
|
||||||
@@ -800,12 +805,12 @@ class Variable
|
|||||||
//if the control is in the grid.
|
//if the control is in the grid.
|
||||||
if (isset($field->columnWidth)) {
|
if (isset($field->columnWidth)) {
|
||||||
$pmDynaform->fields["APP_DATA"] = $globalVariables;
|
$pmDynaform->fields["APP_DATA"] = $globalVariables;
|
||||||
$field->queryInputData = $paramsWithoutAppData;
|
$field->queryInputData = $paramsAndGlobal;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Populate control data
|
//Populate control data
|
||||||
$pmDynaform->jsonr($field);
|
$pmDynaform->jsonr($field);
|
||||||
$result = array();
|
$result = [];
|
||||||
if (isset($field->queryOutputData) && is_array($field->queryOutputData)) {
|
if (isset($field->queryOutputData) && is_array($field->queryOutputData)) {
|
||||||
foreach ($field->queryOutputData as $item) {
|
foreach ($field->queryOutputData as $item) {
|
||||||
$result[] = ["value" => $item->value, "text" => $item->label];
|
$result[] = ["value" => $item->value, "text" => $item->label];
|
||||||
|
|||||||
Reference in New Issue
Block a user