Fix conflict
This commit is contained in:
@@ -15,27 +15,65 @@ class PmDynaform
|
||||
{
|
||||
use SuggestTrait;
|
||||
|
||||
public static $instance = null;
|
||||
public $fields = null;
|
||||
public $record = null;
|
||||
public $records = null;
|
||||
private $cache = [];
|
||||
private $context = [];
|
||||
private $databaseProviders = null;
|
||||
private $dataSources = null;
|
||||
private $lastQueryError = null;
|
||||
private $propertiesToExclude = [];
|
||||
private $sysSys = null;
|
||||
public $credentials = null;
|
||||
public $displayMode = null;
|
||||
public $fields = null;
|
||||
public $isRTL = false;
|
||||
public $lang = SYS_LANG;
|
||||
public $langs = null;
|
||||
public $displayMode = null;
|
||||
public $onPropertyRead = "onPropertyReadFormInstance";
|
||||
public $isRTL = false;
|
||||
public $pathRTLCss = '';
|
||||
public $record = null;
|
||||
public $records = null;
|
||||
public $serverConf = null;
|
||||
private $cache = array();
|
||||
private $sysSys = null;
|
||||
private $context = array();
|
||||
private $dataSources = null;
|
||||
private $databaseProviders = null;
|
||||
private $propertiesToExclude = array();
|
||||
public static $prefixs = array("@@", "@#", "@%", "@?", "@$", "@=");
|
||||
public static $instance = null;
|
||||
public static $prefixs = ["@@", "@#", "@%", "@?", "@$", "@="];
|
||||
|
||||
public function __construct($fields = array())
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param array $fields
|
||||
* @see workflow/engine/classes/class.pmFunctions.php PMFDynaFormFields()
|
||||
* @see workflow/engine/classes/class.pmFunctions.php PMFgetLabelOption()
|
||||
* @see \ConsolidatedCases->processConsolidated()
|
||||
* @see \WorkspaceTools->syncFormsWithInputDocumentInfo()
|
||||
* @see workflow/engine/methods/cases/ajaxListener.php Ajax->dynaformViewFromHistory()
|
||||
* @see workflow/engine/methods/cases/caseConsolidated.php
|
||||
* @see workflow/engine/methods/cases/cases_SaveData.php
|
||||
* @see workflow/engine/methods/cases/cases_Step.php
|
||||
* @see workflow/engine/methods/cases/cases_StepToRevise.php
|
||||
* @see workflow/engine/methods/cases/casesHistoryDynaformPage_Ajax.php
|
||||
* @see workflow/engine/methods/cases/pmDynaform.php
|
||||
* @see workflow/engine/methods/cases/summary.php
|
||||
* @see workflow/engine/methods/services/ActionsByEmailDataForm.php
|
||||
* @see workflow/engine/plugins/EnterpriseSearch/display_dynaform.php
|
||||
* @see workflow/engine/plugins/EnterpriseSearch/dynaform_view1.php
|
||||
* @see \ProcessMaker\BusinessModel\ActionsByEmail->viewFormBpmn()
|
||||
* @see \ProcessMaker\BusinessModel\Cases->getCaseVariables()
|
||||
* @see \ProcessMaker\BusinessModel\Consolidated->getDataGenerate()
|
||||
* @see \ProcessMaker\BusinessModel\InputDocument->update()
|
||||
* @see \ProcessMaker\BusinessModel\Light\Tracker->showObjects()
|
||||
* @see \ProcessMaker\BusinessModel\Variable->delete()
|
||||
* @see \ProcessMaker\BusinessModel\Variable->executeSqlControl()
|
||||
* @see \ProcessMaker\BusinessModel\Variable->update()
|
||||
* @see \ProcessMaker\Core\System\ActionsByEmailCoreClass->sendActionsByEmail()
|
||||
* @see \ProcessMaker\Services\Api\Light->doGetDynaForm()
|
||||
* @see \ProcessMaker\Services\Api\Light->doGetDynaformProcessed()
|
||||
* @see \ProcessMaker\Services\Api\Light->doGetDynaForms()
|
||||
* @see \ProcessMaker\Services\Api\Light->doGetDynaFormsId()
|
||||
* @see \ProcessMaker\Services\Api\Project\DynaForm->doDeleteDynaFormLanguage()
|
||||
* @see \ProcessMaker\Services\Api\Project\DynaForm->doGetDynaFormLanguage()
|
||||
* @see \ProcessMaker\Services\Api\Project\DynaForm->doGetListDynaFormLanguage()
|
||||
* @see \ProcessMaker\Services\Api\Project\DynaForm->doPostDynaFormLanguage()
|
||||
*/
|
||||
public function __construct($fields = [])
|
||||
{
|
||||
$this->sysSys = (!empty(config("system.workspace"))) ? config("system.workspace") : "Undefined";
|
||||
$this->context = \Bootstrap::getDefaultContextLog();
|
||||
@@ -253,7 +291,7 @@ class PmDynaform
|
||||
}
|
||||
}
|
||||
}
|
||||
$sql = G::replaceDataField($json->sql, $dtFields);
|
||||
$sql = G::replaceDataField($json->sql, $dtFields, 'mysql', false);
|
||||
if ($value === "suggest") {
|
||||
$sql = $this->prepareSuggestSql($sql, $json);
|
||||
}
|
||||
@@ -633,6 +671,8 @@ class PmDynaform
|
||||
}
|
||||
$json->rows = count($rows);
|
||||
$json->data = $rows;
|
||||
|
||||
$this->setDataSchema($json, $this->fields["APP_DATA"][$json->name]);
|
||||
}
|
||||
}
|
||||
//languages
|
||||
@@ -759,7 +799,7 @@ class PmDynaform
|
||||
}
|
||||
}
|
||||
if ($json->dbConnection !== "" && $json->dbConnection !== "none" && $json->sql !== "") {
|
||||
$sql = G::replaceDataField($json->sql, $data);
|
||||
$sql = G::replaceDataField($json->sql, $data, 'mysql', false);
|
||||
$dt = $this->getCacheQueryData($json->dbConnection, $sql, $json->type);
|
||||
$row = isset($dt[0]) ? $dt[0] : [];
|
||||
$index = $json->variable === "" ? $json->id : $json->variable;
|
||||
@@ -780,6 +820,17 @@ class PmDynaform
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data from cache query.
|
||||
*
|
||||
* @param string $connection
|
||||
* @param string $sql
|
||||
* @param string $type
|
||||
* @param boolean $clearCache
|
||||
* @return array
|
||||
* @see \PmDynaform->jsonr()
|
||||
* @see \PmDynaform->getValuesDependentFields()
|
||||
*/
|
||||
private function getCacheQueryData($connection, $sql, $type = "", $clearCache = false)
|
||||
{
|
||||
$data = [];
|
||||
@@ -808,6 +859,7 @@ class PmDynaform
|
||||
} catch (Exception $e) {
|
||||
$this->context["action"] = "execute-sql" . $type;
|
||||
$this->context["exception"] = (array) $e;
|
||||
$this->lastQueryError = $e;
|
||||
\Bootstrap::registerMonolog("sqlExecution",
|
||||
400,
|
||||
"Sql Execution",
|
||||
@@ -2259,6 +2311,55 @@ class PmDynaform
|
||||
$googleMaps->signature = $config['google_map_signature'];
|
||||
$result = 'var googleMaps = ' . G::json_encode($googleMaps) . ';';
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get last query error.
|
||||
*
|
||||
* @return object
|
||||
* @see ProcessMaker\BusinessModel\Variable->executeSqlControl()
|
||||
*/
|
||||
public function getLastQueryError()
|
||||
{
|
||||
return $this->lastQueryError;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear last query error.
|
||||
*
|
||||
* @see ProcessMaker\BusinessModel\Variable->executeSqlControl()
|
||||
*/
|
||||
public function clearLastQueryError()
|
||||
{
|
||||
$this->lastQueryError = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This adds a new definition on the json dynaform
|
||||
* @param json $json
|
||||
*
|
||||
* @link https://wiki.processmaker.com/3.0/Grid_Control
|
||||
* @see workflow/engine/classes/PmDynaform->jsonr
|
||||
*/
|
||||
public function setDataSchema($json, $appDataVariables)
|
||||
{
|
||||
foreach ($json->data as $key => $value) {
|
||||
$columnsData = [];
|
||||
foreach ($json->columns as $keyData => $valueData) {
|
||||
foreach ($appDataVariables as $keyAppData => $valueAppData) {
|
||||
if (array_key_exists($valueData->id, $valueAppData) || array_key_exists($valueData->id . "_label",
|
||||
$valueAppData) || array_key_exists($valueData->name,
|
||||
$valueAppData) || array_key_exists($valueData->name . "_label", $valueAppData)) {
|
||||
array_push($columnsData, ["defined" => true]);
|
||||
break;
|
||||
} else {
|
||||
array_push($columnsData, ["defined" => false]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$json->dataSchema[$key] = $columnsData;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user