Merged in feature/PMC-90 (pull request #6883)
PMC-90 Approved-by: Paula Quispe <paula.quispe@processmaker.com> Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
@@ -15,27 +15,65 @@ class PmDynaform
|
|||||||
{
|
{
|
||||||
use SuggestTrait;
|
use SuggestTrait;
|
||||||
|
|
||||||
public static $instance = null;
|
private $cache = [];
|
||||||
public $fields = null;
|
private $context = [];
|
||||||
public $record = null;
|
private $databaseProviders = null;
|
||||||
public $records = null;
|
private $dataSources = null;
|
||||||
|
private $lastQueryError = null;
|
||||||
|
private $propertiesToExclude = [];
|
||||||
|
private $sysSys = null;
|
||||||
public $credentials = null;
|
public $credentials = null;
|
||||||
|
public $displayMode = null;
|
||||||
|
public $fields = null;
|
||||||
|
public $isRTL = false;
|
||||||
public $lang = SYS_LANG;
|
public $lang = SYS_LANG;
|
||||||
public $langs = null;
|
public $langs = null;
|
||||||
public $displayMode = null;
|
|
||||||
public $onPropertyRead = "onPropertyReadFormInstance";
|
public $onPropertyRead = "onPropertyReadFormInstance";
|
||||||
public $isRTL = false;
|
|
||||||
public $pathRTLCss = '';
|
public $pathRTLCss = '';
|
||||||
|
public $record = null;
|
||||||
|
public $records = null;
|
||||||
public $serverConf = null;
|
public $serverConf = null;
|
||||||
private $cache = array();
|
public static $instance = null;
|
||||||
private $sysSys = null;
|
public static $prefixs = ["@@", "@#", "@%", "@?", "@$", "@="];
|
||||||
private $context = array();
|
|
||||||
private $dataSources = null;
|
|
||||||
private $databaseProviders = null;
|
|
||||||
private $propertiesToExclude = array();
|
|
||||||
public static $prefixs = array("@@", "@#", "@%", "@?", "@$", "@=");
|
|
||||||
|
|
||||||
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->sysSys = (!empty(config("system.workspace"))) ? config("system.workspace") : "Undefined";
|
||||||
$this->context = \Bootstrap::getDefaultContextLog();
|
$this->context = \Bootstrap::getDefaultContextLog();
|
||||||
@@ -642,6 +680,8 @@ class PmDynaform
|
|||||||
}
|
}
|
||||||
$json->rows = count($rows);
|
$json->rows = count($rows);
|
||||||
$json->data = $rows;
|
$json->data = $rows;
|
||||||
|
|
||||||
|
$this->setDataSchema($json, $this->fields["APP_DATA"][$json->name]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//languages
|
//languages
|
||||||
@@ -736,6 +776,17 @@ class PmDynaform
|
|||||||
return $data;
|
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)
|
private function getCacheQueryData($connection, $sql, $type = "", $clearCache = false)
|
||||||
{
|
{
|
||||||
$data = [];
|
$data = [];
|
||||||
@@ -764,6 +815,7 @@ class PmDynaform
|
|||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->context["action"] = "execute-sql" . $type;
|
$this->context["action"] = "execute-sql" . $type;
|
||||||
$this->context["exception"] = (array) $e;
|
$this->context["exception"] = (array) $e;
|
||||||
|
$this->lastQueryError = $e;
|
||||||
\Bootstrap::registerMonolog("sqlExecution",
|
\Bootstrap::registerMonolog("sqlExecution",
|
||||||
400,
|
400,
|
||||||
"Sql Execution",
|
"Sql Execution",
|
||||||
@@ -2215,6 +2267,55 @@ class PmDynaform
|
|||||||
$googleMaps->signature = $config['google_map_signature'];
|
$googleMaps->signature = $config['google_map_signature'];
|
||||||
$result = 'var googleMaps = ' . G::json_encode($googleMaps) . ';';
|
$result = 'var googleMaps = ' . G::json_encode($googleMaps) . ';';
|
||||||
return $result;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7475,6 +7475,12 @@ msgstr "There was a problem installing this add-on."
|
|||||||
msgid "Error in server"
|
msgid "Error in server"
|
||||||
msgstr "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
|
# TRANSLATION
|
||||||
# LABEL/ID_ERROR_JS_NOT_AVAILABLE
|
# LABEL/ID_ERROR_JS_NOT_AVAILABLE
|
||||||
#: LABEL/ID_ERROR_JS_NOT_AVAILABLE
|
#: LABEL/ID_ERROR_JS_NOT_AVAILABLE
|
||||||
|
|||||||
@@ -58067,6 +58067,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_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_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_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_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_MESSAGE','en','Error Message','2017-02-22') ,
|
||||||
( 'LABEL','ID_ERROR_OBJECT_NOT_EXISTS','en','Error: Object does not exist.','2014-01-15') ,
|
( 'LABEL','ID_ERROR_OBJECT_NOT_EXISTS','en','Error: Object does not exist.','2014-01-15') ,
|
||||||
|
|||||||
@@ -749,6 +749,8 @@ class Variable
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
|
* @see ProcessMaker\BusinessModel\Variable->executeSql()
|
||||||
|
* @see ProcessMaker\BusinessModel\Variable->executeSqlSuggest()
|
||||||
*/
|
*/
|
||||||
public function executeSqlControl($proUid, array $params = [])
|
public function executeSqlControl($proUid, array $params = [])
|
||||||
{
|
{
|
||||||
@@ -809,7 +811,12 @@ class Variable
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Populate control data
|
//Populate control data
|
||||||
|
$pmDynaform->clearLastQueryError();
|
||||||
$pmDynaform->jsonr($field);
|
$pmDynaform->jsonr($field);
|
||||||
|
$error = $pmDynaform->getLastQueryError();
|
||||||
|
if (!empty($error) && is_object($error)) {
|
||||||
|
throw new Exception(G::LoadTranslation("ID_ERROR_IN_THE_QUERY"));
|
||||||
|
}
|
||||||
$result = [];
|
$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) {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
<link rel="stylesheet" href="/lib/pmdynaform/build/css/PMDynaform.css">
|
<link rel="stylesheet" href="/lib/pmdynaform/build/css/PMDynaform.css">
|
||||||
<link rel="stylesheet" href="/css/{sys_skin}-pm3.css">
|
<link rel="stylesheet" href="/css/{sys_skin}-pm3.css">
|
||||||
<link rel="stylesheet" href="/lib/pmdynaform/libs/font-awesome-4.6.3/css/font-awesome.min.css">
|
<link rel="stylesheet" href="/lib/pmdynaform/libs/font-awesome-4.6.3/css/font-awesome.min.css">
|
||||||
|
<link rel="stylesheet" href="/lib/pmdynaform/libs/animate-css/animate.css">
|
||||||
|
|
||||||
<script type="text/javascript" src="/translations/translationsMafe.js"></script>
|
<script type="text/javascript" src="/translations/translationsMafe.js"></script>
|
||||||
<script type="text/javascript" src="/lib/pmdynaform/libs/moment/moment.min.js"></script>
|
<script type="text/javascript" src="/lib/pmdynaform/libs/moment/moment.min.js"></script>
|
||||||
@@ -21,6 +22,7 @@
|
|||||||
<script type="text/javascript" src="/lib/pmdynaform/libs/backbone/backbone-min.js"></script>
|
<script type="text/javascript" src="/lib/pmdynaform/libs/backbone/backbone-min.js"></script>
|
||||||
<script type="text/javascript" src="/lib/pmdynaform/libs/html5/html5.js"></script>
|
<script type="text/javascript" src="/lib/pmdynaform/libs/html5/html5.js"></script>
|
||||||
<script type="text/javascript" src="/lib/pmdynaform/libs/respondjs/respond.min.js"></script>
|
<script type="text/javascript" src="/lib/pmdynaform/libs/respondjs/respond.min.js"></script>
|
||||||
|
<script type="text/javascript" src="/lib/pmdynaform/libs/bootstrap-notify-3.1.3/bootstrap-notify.min.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body style="height:100%">
|
<body style="height:100%">
|
||||||
<div id="container" style="height:100%;display:none;"></div>
|
<div id="container" style="height:100%;display:none;"></div>
|
||||||
|
|||||||
Reference in New Issue
Block a user