Fix conflict
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Validation\MySQL57;
|
||||
|
||||
CLI::taskName('info');
|
||||
CLI::taskDescription(<<<EOT
|
||||
Print information about the current system and any specified workspaces.
|
||||
@@ -372,6 +375,21 @@ EOT
|
||||
);
|
||||
CLI::taskRun("remove_deprecated_files");
|
||||
|
||||
/*********************************************************************/
|
||||
CLI::taskName("check-queries-incompatibilities");
|
||||
CLI::taskDescription(<<<EOT
|
||||
Check queries incompatibilities (MySQL 5.7) for the specified workspace(s).
|
||||
|
||||
This command checks the queries incompatibilities (MySQL 5.7) in the specified workspace(s).
|
||||
|
||||
If no workspace is specified, the command will be run in all workspaces.
|
||||
More than one workspace can be specified.
|
||||
EOT
|
||||
);
|
||||
CLI::taskArg("workspace-name", true, true);
|
||||
CLI::taskRun("run_check_queries_incompatibilities");
|
||||
/*********************************************************************/
|
||||
|
||||
/**
|
||||
* Function run_info
|
||||
*
|
||||
@@ -477,6 +495,7 @@ function run_upgrade_content($args, $opts)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will upgrade the CONTENT table for a workspace
|
||||
* This function is executed only for one workspace
|
||||
@@ -1373,3 +1392,74 @@ function remove_deprecated_files()
|
||||
$workspaceTools->removeDeprecatedFiles();
|
||||
CLI::logging("<*> The deprecated files has been removed. \n");
|
||||
}
|
||||
|
||||
/**
|
||||
* This function review the queries for each workspace or for an specific workspace
|
||||
*
|
||||
* @param array $args
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function run_check_queries_incompatibilities($args)
|
||||
{
|
||||
try {
|
||||
$workspaces = get_workspaces_from_args($args);
|
||||
if (count($args) === 1) {
|
||||
CLI::logging("> Workspace: " . $workspaces[0]->name . PHP_EOL);
|
||||
check_queries_incompatibilities($workspaces[0]->name);
|
||||
} else {
|
||||
foreach ($workspaces as $workspace) {
|
||||
passthru(PHP_BINARY . " processmaker check-queries-incompatibilities " . $workspace->name);
|
||||
}
|
||||
}
|
||||
echo "Done!\n\n";
|
||||
} catch (Exception $e) {
|
||||
G::outRes(CLI::error($e->getMessage()) . "\n");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for the incompatibilities in the queries for the specific workspace
|
||||
*
|
||||
* @param string $wsName
|
||||
*/
|
||||
function check_queries_incompatibilities($wsName)
|
||||
{
|
||||
Bootstrap::setConstantsRelatedWs($wsName);
|
||||
require_once(PATH_DB . $wsName . '/db.php');
|
||||
System::initLaravel();
|
||||
|
||||
$query = Process::query()->select('PRO_UID', 'PRO_TITLE');
|
||||
$processesToCheck = $query->get()->values()->toArray();
|
||||
|
||||
$obj = new MySQL57();
|
||||
$resTriggers = $obj->checkIncompatibilityTriggers($processesToCheck);
|
||||
|
||||
if (!empty($resTriggers)) {
|
||||
foreach ($resTriggers as $trigger) {
|
||||
echo ">> The \"" . $trigger['PRO_TITLE'] . "\" process has a trigger called: \"" . $trigger['TRI_TITLE'] . "\" that contains UNION queries. Review the code to discard incompatibilities with MySQL5.7." . PHP_EOL;
|
||||
}
|
||||
} else {
|
||||
echo ">> No MySQL 5.7 incompatibilities in triggers found for this workspace." . PHP_EOL;
|
||||
}
|
||||
|
||||
$resDynaforms = $obj->checkIncompatibilityDynaforms($processesToCheck);
|
||||
|
||||
if (!empty($resDynaforms)) {
|
||||
foreach ($resDynaforms as $dynaform) {
|
||||
echo ">> The \"" . $dynaform['PRO_TITLE'] . "\" process has a dynaform called: \"" . $dynaform['DYN_TITLE'] . "\" that contains UNION queries. Review the code to discard incompatibilities with MySQL5.7." . PHP_EOL;
|
||||
}
|
||||
} else {
|
||||
echo ">> No MySQL 5.7 incompatibilities in dynaforms found for this workspace." . PHP_EOL;
|
||||
}
|
||||
|
||||
$resVariables = $obj->checkIncompatibilityVariables($processesToCheck);
|
||||
|
||||
if (!empty($resVariables)) {
|
||||
foreach ($resVariables as $variable) {
|
||||
echo ">> The \"" . $variable['PRO_TITLE'] . "\" process has a variable called: \"" . $variable['VAR_NAME'] . "\" that contains UNION queries. Review the code to discard incompatibilities with MySQL5.7." . PHP_EOL;
|
||||
}
|
||||
} else {
|
||||
echo ">> No MySQL 5.7 incompatibilities in variables found for this workspace." . PHP_EOL;
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ class ActionsByEmailCoreClass extends PMPlugin
|
||||
}
|
||||
|
||||
if ($email != '') {
|
||||
$subject = G::replaceDataField( $configuration['ABE_SUBJECT_FIELD'], $caseFields['APP_DATA'] );
|
||||
$subject = G::replaceDataField( $configuration['ABE_SUBJECT_FIELD'], $caseFields['APP_DATA'], 'mysql', false );
|
||||
if($subject == ''){
|
||||
$subject = $caseFields['APP_TITLE'];
|
||||
}
|
||||
|
||||
@@ -628,7 +628,7 @@ class Cases
|
||||
$task = TaskPeer::retrieveByPk($currentDelegations[$r]->getTasUid());
|
||||
$caseLabel = $task->$getTasDef();
|
||||
if ($caseLabel != '') {
|
||||
$appLabel = G::replaceDataField($caseLabel, $aAppData);
|
||||
$appLabel = G::replaceDataField($caseLabel, $aAppData, 'mysql', false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -686,7 +686,7 @@ class Cases
|
||||
//Get the case title
|
||||
$tasDefTitle = trim($row['TAS_DEF_TITLE']);
|
||||
if (!empty($tasDefTitle) && !$flagTitle) {
|
||||
$newAppProperty = G::replaceDataField($tasDefTitle, $lastFieldsCase);
|
||||
$newAppProperty = G::replaceDataField($tasDefTitle, $lastFieldsCase, 'mysql', false);
|
||||
$res['APP_TITLE'] = $newAppProperty;
|
||||
if (!(isset($currentValue) && ($currentValue == $tasDefTitle))) {
|
||||
$newValues['APP_TITLE'] = $newAppProperty;
|
||||
@@ -696,7 +696,7 @@ class Cases
|
||||
//Get the case description
|
||||
$tasDefDescription = trim($row['TAS_DEF_DESCRIPTION']);
|
||||
if (!empty($tasDefDescription) && !$flagDescription) {
|
||||
$newAppProperty = G::replaceDataField($tasDefDescription, $lastFieldsCase);
|
||||
$newAppProperty = G::replaceDataField($tasDefDescription, $lastFieldsCase, 'mysql', false);
|
||||
$res['APP_DESCRIPTION'] = $newAppProperty;
|
||||
if (!(isset($currentValue) && ($currentValue == $tasDefDescription))) {
|
||||
$newValues['APP_DESCRIPTION'] = $newAppProperty;
|
||||
@@ -5441,7 +5441,7 @@ class Cases
|
||||
switch ($typeSend) {
|
||||
case 'LAST':
|
||||
if (isset($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE']) && $aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'] != '') {
|
||||
$sSubject = G::replaceDataField($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'], $arrayData);
|
||||
$sSubject = G::replaceDataField($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'], $arrayData, 'mysql', false);
|
||||
} else {
|
||||
$sSubject = G::LoadTranslation('ID_MESSAGE_SUBJECT_DERIVATION');
|
||||
}
|
||||
@@ -5526,7 +5526,7 @@ class Cases
|
||||
break;
|
||||
case 'RECEIVE':
|
||||
if (isset($aTaskInfo['TAS_RECEIVE_SUBJECT_MESSAGE']) && $aTaskInfo['TAS_RECEIVE_SUBJECT_MESSAGE'] != '') {
|
||||
$sSubject = G::replaceDataField($aTaskInfo['TAS_RECEIVE_SUBJECT_MESSAGE'], $arrayData);
|
||||
$sSubject = G::replaceDataField($aTaskInfo['TAS_RECEIVE_SUBJECT_MESSAGE'], $arrayData, 'mysql', false);
|
||||
} else {
|
||||
$sSubject = G::LoadTranslation('ID_MESSAGE_SUBJECT_DERIVATION');
|
||||
}
|
||||
@@ -5674,7 +5674,7 @@ class Cases
|
||||
) {
|
||||
@copy(PATH_TPL . "mails" . PATH_SEP . G::LoadTranslation('ID_UNASSIGNED_MESSAGE'), $fileTemplate);
|
||||
}
|
||||
$body2 = G::replaceDataField(file_get_contents($fileTemplate), $arrayData2);
|
||||
$body2 = G::replaceDataField(file_get_contents($fileTemplate), $arrayData2, 'mysql', false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1750,7 +1750,7 @@ function PMFGenerateOutputDocument ($outputID, $sApplication = null, $index = nu
|
||||
//The $_GET['UID'] variable is used when a process executes.
|
||||
//$_GET['UID']=($aOD['OUT_DOC_VERSIONING'])?$_GET['UID']:$aOD['OUT_DOC_UID'];
|
||||
//$sUID = ($aOD['OUT_DOC_VERSIONING'])?$_GET['UID']:$aOD['OUT_DOC_UID'];
|
||||
$sFilename = preg_replace( '[^A-Za-z0-9_]', '_', G::replaceDataField( $aOD['OUT_DOC_FILENAME'], $Fields['APP_DATA'] ) );
|
||||
$sFilename = preg_replace( '[^A-Za-z0-9_]', '_', G::replaceDataField( $aOD['OUT_DOC_FILENAME'], $Fields['APP_DATA'], 'mysql', false ) );
|
||||
require_once 'classes/model/AppFolder.php';
|
||||
require_once 'classes/model/AppDocument.php';
|
||||
|
||||
|
||||
@@ -706,7 +706,7 @@ class PMScript
|
||||
try {
|
||||
$cnn = Propel::getConnection($varInfo["VAR_DBCONNECTION"]);
|
||||
$stmt = $cnn->createStatement();
|
||||
$sql = G::replaceDataField($varInfo["VAR_SQL"], $this->aFields);
|
||||
$sql = G::replaceDataField($varInfo["VAR_SQL"], $this->aFields, 'mysql', false);
|
||||
$rs = $stmt->executeQuery($sql, \ResultSet::FETCHMODE_NUM);
|
||||
while ($rs->next()) {
|
||||
$row = $rs->getRow();
|
||||
|
||||
@@ -1735,7 +1735,7 @@ class AppCacheView extends BaseAppCacheView
|
||||
$arrayAppField = $app->Load($appcvAppUid);
|
||||
|
||||
$appTitle = (!empty($appTitle))? $appTitle : "#" . $arrayAppField["APP_NUMBER"];
|
||||
$appTitleNew = G::replaceDataField($appTitle, unserialize($arrayAppField["APP_DATA"]));
|
||||
$appTitleNew = G::replaceDataField($appTitle, unserialize($arrayAppField["APP_DATA"]), 'mysql', false);
|
||||
|
||||
if (isset($arrayAppField["APP_TITLE"]) && $arrayAppField["APP_TITLE"] != $appTitleNew) {
|
||||
//Updating the value in content, where...
|
||||
|
||||
@@ -145,8 +145,7 @@ class AppFolder extends BaseAppFolder
|
||||
|
||||
$oApplication = new Application();
|
||||
$appFields = $oApplication->Load( $sessionID );
|
||||
$folderPathParsed = G::replaceDataField( $folderPath, $appFields );
|
||||
$folderPathParsed = G::replaceDataField( $folderPath, unserialize( $appFields['APP_DATA'] ) );
|
||||
$folderPathParsed = G::replaceDataField( $folderPath, unserialize( $appFields['APP_DATA'] ), 'mysql', false );
|
||||
$folderPathParsedArray = explode( "/", $folderPathParsed );
|
||||
$folderRoot = "/"; //Always starting from Root
|
||||
foreach ($folderPathParsedArray as $folderName) {
|
||||
@@ -174,8 +173,7 @@ class AppFolder extends BaseAppFolder
|
||||
|
||||
$oApplication = new Application();
|
||||
$appFields = $oApplication->Load( $sessionID );
|
||||
$fileTagsParsed = G::replaceDataField( $fileTags, $appFields );
|
||||
$fileTagsParsed = G::replaceDataField( $fileTags, unserialize( $appFields['APP_DATA'] ) );
|
||||
$fileTagsParsed = G::replaceDataField( $fileTags, unserialize( $appFields['APP_DATA'] ), 'mysql', false );
|
||||
return $fileTagsParsed;
|
||||
}
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ class AppNotes extends BaseAppNotes
|
||||
$configNoteNotification['subject'] = G::LoadTranslation('ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION') . " @#APP_TITLE ";
|
||||
//Define the body for the notification
|
||||
$configNoteNotification['body'] = $this->getBodyCaseNote($authorName, $noteContent);
|
||||
$body = nl2br(G::replaceDataField($configNoteNotification['body'], $fieldCase));
|
||||
$body = nl2br(G::replaceDataField($configNoteNotification['body'], $fieldCase, 'mysql', false));
|
||||
|
||||
$users = new Users();
|
||||
$recipientsArray = explode(",", $noteRecipients);
|
||||
@@ -229,7 +229,7 @@ class AppNotes extends BaseAppNotes
|
||||
$appUid,
|
||||
$delIndex,
|
||||
WsBase::MESSAGE_TYPE_CASE_NOTE,
|
||||
G::replaceDataField($configNoteNotification['subject'], $fieldCase),
|
||||
G::replaceDataField($configNoteNotification['subject'], $fieldCase, 'mysql', false),
|
||||
G::buildFrom($configuration, $from),
|
||||
$to,
|
||||
$body,
|
||||
|
||||
@@ -34,7 +34,7 @@ class ListInbox extends BaseListInbox implements ListInterface
|
||||
if (isset($data['APP_TITLE'])) {
|
||||
$oCase = new Cases();
|
||||
$aData = $oCase->loadCase($data["APP_UID"]);
|
||||
$data['APP_TITLE'] = G::replaceDataField($data['APP_TITLE'], $aData['APP_DATA']);
|
||||
$data['APP_TITLE'] = G::replaceDataField($data['APP_TITLE'], $aData['APP_DATA'], 'mysql', false);
|
||||
}
|
||||
if (!empty($data['PRO_UID']) && empty($data['PRO_ID'])) {
|
||||
$p = new Process();
|
||||
@@ -124,7 +124,7 @@ class ListInbox extends BaseListInbox implements ListInterface
|
||||
if (isset($data['APP_TITLE'])) {
|
||||
$oCase = new Cases();
|
||||
$aData = $oCase->loadCase($data["APP_UID"]);
|
||||
$data['APP_TITLE'] = G::replaceDataField($data['APP_TITLE'], $aData['APP_DATA']);
|
||||
$data['APP_TITLE'] = G::replaceDataField($data['APP_TITLE'], $aData['APP_DATA'], 'mysql', false);
|
||||
}
|
||||
if ($isSelfService) {
|
||||
$listParticipatedLast = new ListParticipatedLast();
|
||||
|
||||
@@ -746,7 +746,13 @@ class Process extends BaseProcess
|
||||
return $aProcesses;
|
||||
}
|
||||
|
||||
public function getCasesCountForProcess($pro_uid)
|
||||
/**
|
||||
* This returns the number of cases for the process.
|
||||
* @param string $pro_uid
|
||||
* @return integer
|
||||
* @see ProcessMaker\Project\Bpmn::canRemove()
|
||||
*/
|
||||
public static function getCasesCountForProcess($pro_uid)
|
||||
{
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn('COUNT(*) AS TOTAL_CASES');
|
||||
|
||||
@@ -7475,6 +7475,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
|
||||
|
||||
@@ -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_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') ,
|
||||
|
||||
@@ -23,7 +23,7 @@ $aFields = $oCase->loadCase($appUid);
|
||||
foreach ($G_FORM->fields as $key => $val) {
|
||||
if ($fieldName == $val->name) {
|
||||
if ($G_FORM->fields[$key]->sql != null) {
|
||||
$sqlQuery = G::replaceDataField($G_FORM->fields[$key]->sql, $aFields ["APP_DATA"]);
|
||||
$sqlQuery = G::replaceDataField($G_FORM->fields[$key]->sql, $aFields ["APP_DATA"], 'mysql', false);
|
||||
}
|
||||
//$coma = "";
|
||||
//$data1 = "";
|
||||
|
||||
@@ -1108,7 +1108,7 @@ class Consolidated
|
||||
foreach ($G_FORM->fields as $key => $val) {
|
||||
if ($fieldName == $val->name) {
|
||||
if ($G_FORM->fields[$key]->sql != "") {
|
||||
$sqlQuery = G::replaceDataField($G_FORM->fields[$key]->sql, $aFields ["APP_DATA"]);
|
||||
$sqlQuery = G::replaceDataField($G_FORM->fields[$key]->sql, $aFields ["APP_DATA"], 'mysql', false);
|
||||
}
|
||||
if ((is_array($val->options)) && (!empty($val->options))) {
|
||||
foreach ($val->options as $key1 => $val1) {
|
||||
|
||||
@@ -522,7 +522,7 @@ class EmailEvent
|
||||
$emailTo,
|
||||
'',
|
||||
'',
|
||||
G::replaceDataField($arrayData[5], $arrayApplicationData['APP_DATA']),
|
||||
G::replaceDataField($arrayData[5], $arrayApplicationData['APP_DATA'], 'mysql', false),
|
||||
$contentFile['prf_filename'],
|
||||
[],
|
||||
[],
|
||||
|
||||
@@ -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 = [])
|
||||
{
|
||||
@@ -812,7 +814,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) {
|
||||
|
||||
@@ -9,6 +9,7 @@ use Faker;
|
||||
use G;
|
||||
use GzipFile;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Foundation\Http\Kernel;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use InputFilter;
|
||||
use InstallerModule;
|
||||
@@ -1629,5 +1630,21 @@ class System
|
||||
{
|
||||
return !empty(self::getServerHostname()) ? self::getServerHostname() : 'processmaker.com';
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize laravel database configuration
|
||||
* @see workflow/engine/bin/tasks/cliWorkspaces.php->check_queries_incompatibilities()
|
||||
*/
|
||||
public static function initLaravel()
|
||||
{
|
||||
config(['database.connections.workflow.host' => DB_HOST]);
|
||||
config(['database.connections.workflow.database' => DB_NAME]);
|
||||
config(['database.connections.workflow.username' => DB_USER]);
|
||||
config(['database.connections.workflow.password' => DB_PASS]);
|
||||
|
||||
app()->useStoragePath(realpath(PATH_DATA));
|
||||
app()->make(Kernel::class)->bootstrap();
|
||||
restore_error_handler();
|
||||
}
|
||||
}
|
||||
// end System class
|
||||
|
||||
@@ -66,4 +66,16 @@ class Dynaform extends Model
|
||||
->where('DYNAFORM.DYN_UID', '!=', $dynUid)
|
||||
->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to filter an specific process
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param string $columns
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeProcess($query, string $proUID)
|
||||
{
|
||||
return $query->where('PRO_UID', $proUID);
|
||||
}
|
||||
}
|
||||
|
||||
27
workflow/engine/src/ProcessMaker/Model/ProcessVariables.php
Normal file
27
workflow/engine/src/ProcessMaker/Model/ProcessVariables.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProcessVariables extends Model
|
||||
{
|
||||
// Set our table name
|
||||
protected $table = 'PROCESS_VARIABLES';
|
||||
// No timestamps
|
||||
public $timestamps = false;
|
||||
//primary key
|
||||
protected $primaryKey = 'VAR_UID';
|
||||
|
||||
/**
|
||||
* Scope a query to filter an specific process
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param string $columns
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeProcess($query, string $proUID)
|
||||
{
|
||||
return $query->where('PRJ_UID', $proUID);
|
||||
}
|
||||
}
|
||||
27
workflow/engine/src/ProcessMaker/Model/Triggers.php
Normal file
27
workflow/engine/src/ProcessMaker/Model/Triggers.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Triggers extends Model
|
||||
{
|
||||
// Set our table name
|
||||
protected $table = 'TRIGGERS';
|
||||
// No timestamps
|
||||
public $timestamps = false;
|
||||
//primary key
|
||||
protected $primaryKey = 'TRI_UID';
|
||||
|
||||
/**
|
||||
* Scope a query to filter an specific process
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param string $columns
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeProcess($query, string $proUID)
|
||||
{
|
||||
return $query->where('PRO_UID', $proUID);
|
||||
}
|
||||
}
|
||||
110
workflow/engine/src/ProcessMaker/Validation/MySQL57.php
Normal file
110
workflow/engine/src/ProcessMaker/Validation/MySQL57.php
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Validation;
|
||||
|
||||
use ProcessMaker\Model\Dynaform;
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Model\ProcessVariables;
|
||||
use ProcessMaker\Model\Triggers;
|
||||
|
||||
class MySQL57
|
||||
{
|
||||
const REGEX = '/(?i)(select|\$).*?UNION.*?(select|\$).*?/ms';
|
||||
|
||||
/**
|
||||
* Checks the queries inside triggers that could have possible incompatibilities with MySQL 5.7
|
||||
*
|
||||
* @see workflow/engine/bin/tasks/cliWorkspaces.php->check_queries_incompatibilities()
|
||||
* @param array $processes
|
||||
* @return array
|
||||
*/
|
||||
public function checkIncompatibilityTriggers($processes)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
foreach ($processes as $process) {
|
||||
$triggerQuery = Triggers::query()->select();
|
||||
//Call the scope method to filter by process
|
||||
$triggerQuery->process($process['PRO_UID']);
|
||||
$triggers = $triggerQuery->get()->values()->toArray();
|
||||
foreach ($triggers as $trigger) {
|
||||
$resultIncompatibility = $this->analyzeQuery($trigger['TRI_WEBBOT']);
|
||||
if ($resultIncompatibility) {
|
||||
$aux = array_merge($process, $trigger);
|
||||
array_push($result, $aux);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the queries inside dynaforms that could have possible incompatibilities with MySQL 5.7
|
||||
*
|
||||
* @see workflow/engine/bin/tasks/cliWorkspaces.php->check_queries_incompatibilities()
|
||||
* @param array $processes
|
||||
* @return array
|
||||
*/
|
||||
public function checkIncompatibilityDynaforms($processes)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
foreach ($processes as $process) {
|
||||
$dynaformQuery = Dynaform::query()->select();
|
||||
//Call the scope method to filter by process
|
||||
$dynaformQuery->process($process['PRO_UID']);
|
||||
$dynaforms = $dynaformQuery->get()->values()->toArray();
|
||||
foreach ($dynaforms as $dynaform) {
|
||||
$resultIncompatibility = $this->analyzeQuery($dynaform['DYN_CONTENT']);
|
||||
if ($resultIncompatibility) {
|
||||
$aux = array_merge($process, $dynaform);
|
||||
array_push($result, $aux);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the queries inside variables that could have possible incompatibilities with MySQL 5.7
|
||||
*
|
||||
* @see workflow/engine/bin/tasks/cliWorkspaces.php->check_queries_incompatibilities()
|
||||
* @param array $processes
|
||||
* @return array
|
||||
*/
|
||||
public function checkIncompatibilityVariables($processes)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
foreach ($processes as $process) {
|
||||
$variablesQuery = ProcessVariables::query()->select();
|
||||
//Call the scope method to filter by process
|
||||
$variablesQuery->process($process['PRO_UID']);
|
||||
$variables = $variablesQuery->get()->values()->toArray();
|
||||
foreach ($variables as $variable) {
|
||||
$resultIncompatibility = $this->analyzeQuery($variable['VAR_SQL']);
|
||||
if ($resultIncompatibility) {
|
||||
$aux = array_merge($process, $variable);
|
||||
array_push($result, $aux);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Analyze the query using the regular expression
|
||||
*
|
||||
* @param string $query
|
||||
* @return bool
|
||||
*/
|
||||
public function analyzeQuery($query)
|
||||
{
|
||||
preg_match_all($this::REGEX, $query, $matches, PREG_SET_ORDER, 0);
|
||||
|
||||
return !empty($matches);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,7 @@
|
||||
<link rel="stylesheet" href="/lib/pmdynaform/libs/font-awesome-4.6.3/css/font-awesome.min.css">
|
||||
<link rel="stylesheet" href="/lib/pmdynaform/libs/select2/select2.min.css">
|
||||
<link rel="stylesheet" href="/lib/pmdynaform/libs/select2/select2-bootstrap.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="/lib/pmdynaform/libs/moment/moment.min.js"></script>
|
||||
@@ -24,6 +25,7 @@
|
||||
<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/respondjs/respond.min.js"></script>
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/bootstrap-notify-3.1.3/bootstrap-notify.min.js"></script>
|
||||
</head>
|
||||
<body style="height:100%">
|
||||
<div id="container" style="height:100%;display:none;"></div>
|
||||
|
||||
Reference in New Issue
Block a user