Fix conflict

This commit is contained in:
Julio Cesar Laura Avendaño
2019-07-05 12:15:52 -04:00
54 changed files with 4153 additions and 1700 deletions

View File

@@ -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'];
}

View File

@@ -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);
}
}

View File

@@ -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;
}
}
/**

View File

@@ -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';

View File

@@ -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();

View File

@@ -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...

View File

@@ -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;
}

View File

@@ -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,

View File

@@ -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();

View File

@@ -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');