PMC-551
This commit is contained in:
@@ -14,27 +14,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();
|
||||
@@ -738,6 +776,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 = [];
|
||||
@@ -766,6 +815,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",
|
||||
@@ -2237,5 +2287,26 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7469,6 +7469,12 @@ msgstr "There was a problem installing this add-on."
|
||||
msgid "Error in server"
|
||||
msgstr "Error in server"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_ERROR_IN_THE_QUERY
|
||||
#: LABEL/ID_ERROR_IN_THE_QUERY
|
||||
msgid "Error in the query"
|
||||
msgstr "Error in the query"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_ERROR_JS_NOT_AVAILABLE
|
||||
#: LABEL/ID_ERROR_JS_NOT_AVAILABLE
|
||||
|
||||
@@ -58066,6 +58066,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_ERROR_INSERT_LINE','en','Error trying to insert the line','2014-01-15') ,
|
||||
( 'LABEL','ID_ERROR_INSTALLING_ADDON','en','There was a problem installing this add-on.','2014-10-21') ,
|
||||
( 'LABEL','ID_ERROR_IN_SERVER','en','Error in server','2015-09-15') ,
|
||||
( 'LABEL','ID_ERROR_IN_THE_QUERY','en','Error in the query','2019-03-12') ,
|
||||
( 'LABEL','ID_ERROR_JS_NOT_AVAILABLE','en','Your browser doesn''t support JavaScript or it may be disabled. Please use a different browser or enable JavaScript. Dynaforms won''t entirely work because JavaScript is required.','2014-10-21') ,
|
||||
( 'LABEL','ID_ERROR_MESSAGE','en','Error Message','2017-02-22') ,
|
||||
( 'LABEL','ID_ERROR_OBJECT_NOT_EXISTS','en','Error: Object does not exist.','2014-01-15') ,
|
||||
|
||||
@@ -749,6 +749,8 @@ class Variable
|
||||
*
|
||||
* @return array
|
||||
* @throws Exception
|
||||
* @see ProcessMaker\BusinessModel\Variable->executeSql()
|
||||
* @see ProcessMaker\BusinessModel\Variable->executeSqlSuggest()
|
||||
*/
|
||||
public function executeSqlControl($proUid, array $params = [])
|
||||
{
|
||||
@@ -809,7 +811,12 @@ class Variable
|
||||
}
|
||||
|
||||
//Populate control data
|
||||
$pmDynaform->clearLastQueryError();
|
||||
$pmDynaform->jsonr($field);
|
||||
$error = $pmDynaform->getLastQueryError();
|
||||
if (!empty($error) && is_object($error)) {
|
||||
throw new Exception(G::LoadTranslation("ID_ERROR_IN_THE_QUERY"));
|
||||
}
|
||||
$result = [];
|
||||
if (isset($field->queryOutputData) && is_array($field->queryOutputData)) {
|
||||
foreach ($field->queryOutputData as $item) {
|
||||
|
||||
Reference in New Issue
Block a user