Solving conflicts
This commit is contained in:
@@ -138,26 +138,28 @@ class Validator
|
||||
/**
|
||||
* Validate pro_uid
|
||||
*
|
||||
* @param string $pro_uid , Uid for process
|
||||
* @param string $proUid , Uid for process
|
||||
* @param string $nameField . Name of field for message
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return string
|
||||
* @return int
|
||||
*/
|
||||
static public function proUid($pro_uid, $nameField = 'pro_uid')
|
||||
static public function proUid($proUid, $nameField = 'pro_uid')
|
||||
{
|
||||
$pro_uid = trim($pro_uid);
|
||||
if ($pro_uid == '') {
|
||||
$proUid = trim($proUid);
|
||||
if (empty($proUid)) {
|
||||
throw (new Exception(G::LoadTranslation("ID_PROCESS_NOT_EXIST", array($nameField, ''))));
|
||||
}
|
||||
$oProcess = new \Process();
|
||||
if (!($oProcess->exists($pro_uid))) {
|
||||
throw (new Exception(G::LoadTranslation("ID_PROCESS_NOT_EXIST", array($nameField, $pro_uid))));
|
||||
$process = new \Process();
|
||||
$proId = 0;
|
||||
if (!($process->exists($proUid))) {
|
||||
throw (new Exception(G::LoadTranslation("ID_PROCESS_NOT_EXIST", array($nameField, $proUid))));
|
||||
} else {
|
||||
$proId = $process->load($proUid)['PRO_ID'];
|
||||
}
|
||||
return $pro_uid;
|
||||
|
||||
return $proId;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,106 +7,92 @@ use Cases as ClassesCases;
|
||||
use Exception;
|
||||
use G;
|
||||
use PmDynaform;
|
||||
|
||||
use ProcessMaker\Model\ProcessVariables;
|
||||
use ProcessMaker\Util\Common;
|
||||
|
||||
class Variable
|
||||
{
|
||||
private $variableTypes = ['string', 'integer', 'float', 'boolean', 'datetime', 'grid', 'array', 'file', 'multiplefile', 'object'];
|
||||
public static $varTypesValues = [
|
||||
'string' => 1,
|
||||
'integer' => 2,
|
||||
'float' => 3,
|
||||
'boolean' => 4,
|
||||
'datetime' => 5,
|
||||
'grid' => 6,
|
||||
'array' => 7,
|
||||
'file' => 8,
|
||||
'multiplefile' => 9,
|
||||
'object' => 10
|
||||
];
|
||||
|
||||
/**
|
||||
* Create Variable for a Process
|
||||
*
|
||||
* @param string $processUid Unique id of Process
|
||||
* @param string $proUid Unique id of Process
|
||||
* @param array $arrayData Data
|
||||
*
|
||||
* @return array, return data of the new Variable created
|
||||
* @throws Exception
|
||||
*/
|
||||
public function create($processUid, array $arrayData)
|
||||
public function create($proUid, array $arrayData)
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
Validator::proUid($processUid, '$prj_uid');
|
||||
$attributes = [];
|
||||
// Verify the process
|
||||
$proId = Validator::proUid($proUid, '$prj_uid');
|
||||
$attributes["PRJ_UID"] = $proUid;
|
||||
$attributes["PRO_ID"] = $proId;
|
||||
// Get the unique varUid
|
||||
$varUid = Common::generateUID();
|
||||
$attributes["VAR_UID"] = $varUid;
|
||||
// Get the attributes
|
||||
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||
$this->existsName($processUid, $arrayData["VAR_NAME"], "");
|
||||
$this->throwExceptionFieldDefinition($arrayData);
|
||||
|
||||
//Create
|
||||
$cnn = \Propel::getConnection("workflow");
|
||||
try {
|
||||
$variable = new \ProcessVariables();
|
||||
$sPkProcessVariables = \ProcessMaker\Util\Common::generateUID();
|
||||
|
||||
$variable->setVarUid($sPkProcessVariables);
|
||||
$variable->setPrjUid($processUid);
|
||||
|
||||
if ($variable->validate()) {
|
||||
$cnn->begin();
|
||||
|
||||
if (isset($arrayData["VAR_NAME"])) {
|
||||
$variable->setVarName($arrayData["VAR_NAME"]);
|
||||
} else {
|
||||
throw new Exception(G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('$var_name')));
|
||||
}
|
||||
if (isset($arrayData["VAR_FIELD_TYPE"])) {
|
||||
$arrayData["VAR_FIELD_TYPE"] = $this->validateVarFieldType($arrayData["VAR_FIELD_TYPE"]);
|
||||
$variable->setVarFieldType($arrayData["VAR_FIELD_TYPE"]);
|
||||
} else {
|
||||
throw new Exception(G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('$var_field_type')));
|
||||
}
|
||||
if (isset($arrayData["VAR_FIELD_SIZE"])) {
|
||||
$variable->setVarFieldSize($arrayData["VAR_FIELD_SIZE"]);
|
||||
}
|
||||
if (isset($arrayData["VAR_LABEL"])) {
|
||||
$variable->setVarLabel($arrayData["VAR_LABEL"]);
|
||||
} else {
|
||||
throw new Exception(G::LoadTranslation("ID_CAN_NOT_BE_NULL", array('$var_label')));
|
||||
}
|
||||
if (isset($arrayData["VAR_DBCONNECTION"])) {
|
||||
$variable->setVarDbconnection($arrayData["VAR_DBCONNECTION"]);
|
||||
} else {
|
||||
$variable->setVarDbconnection("");
|
||||
}
|
||||
if (isset($arrayData["VAR_SQL"])) {
|
||||
$variable->setVarSql($arrayData["VAR_SQL"]);
|
||||
} else {
|
||||
$variable->setVarSql("");
|
||||
}
|
||||
if (isset($arrayData["VAR_NULL"])) {
|
||||
$variable->setVarNull($arrayData["VAR_NULL"]);
|
||||
} else {
|
||||
$variable->setVarNull(0);
|
||||
}
|
||||
if (isset($arrayData["VAR_DEFAULT"])) {
|
||||
$variable->setVarDefault($arrayData["VAR_DEFAULT"]);
|
||||
}
|
||||
if (isset($arrayData["VAR_ACCEPTED_VALUES"])) {
|
||||
$encodeAcceptedValues = G::json_encode($arrayData["VAR_ACCEPTED_VALUES"]);
|
||||
$variable->setVarAcceptedValues($encodeAcceptedValues);
|
||||
}
|
||||
if (isset($arrayData["INP_DOC_UID"])) {
|
||||
$variable->setInpDocUid($arrayData["INP_DOC_UID"]);
|
||||
}
|
||||
$variable->save();
|
||||
$cnn->commit();
|
||||
} else {
|
||||
$msg = "";
|
||||
|
||||
foreach ($variable->getValidationFailures() as $validationFailure) {
|
||||
$msg = $msg . (($msg != "") ? "\n" : "") . $validationFailure->getMessage();
|
||||
}
|
||||
|
||||
throw new Exception(G::LoadTranslation("ID_RECORD_CANNOT_BE_CREATED") . "\n" . $msg);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$cnn->rollback();
|
||||
|
||||
throw $e;
|
||||
// Validate properties that cannot be empty
|
||||
if (!empty($arrayData["VAR_NAME"])) {
|
||||
$attributes["VAR_NAME"] = $arrayData["VAR_NAME"];
|
||||
} else {
|
||||
throw new Exception(G::LoadTranslation("ID_CAN_NOT_BE_NULL", ['$var_name']));
|
||||
}
|
||||
|
||||
//Return
|
||||
$variable = $this->getVariable($processUid, $sPkProcessVariables);
|
||||
|
||||
if (!empty($arrayData["VAR_FIELD_TYPE"])) {
|
||||
$attributes["VAR_FIELD_TYPE"] = $this->validateVarFieldType($arrayData["VAR_FIELD_TYPE"]);
|
||||
$attributes["VAR_FIELD_TYPE_ID"] = self::$varTypesValues[$arrayData["VAR_FIELD_TYPE"]];
|
||||
} else {
|
||||
throw new Exception(G::LoadTranslation("ID_CAN_NOT_BE_NULL", ['$var_field_type']));
|
||||
}
|
||||
if (!empty($arrayData["VAR_LABEL"])) {
|
||||
$attributes["VAR_LABEL"] = $arrayData["VAR_LABEL"];
|
||||
} else {
|
||||
throw new Exception(G::LoadTranslation("ID_CAN_NOT_BE_NULL", ['$var_label']));
|
||||
}
|
||||
if (!empty($arrayData["VAR_FIELD_SIZE"])) {
|
||||
$attributes["VAR_FIELD_SIZE"] = $arrayData["VAR_FIELD_SIZE"];
|
||||
}
|
||||
if (!empty($arrayData["VAR_DBCONNECTION"])) {
|
||||
$attributes["VAR_DBCONNECTION"] = $arrayData["VAR_DBCONNECTION"];
|
||||
}
|
||||
if (!empty($arrayData["VAR_SQL"])) {
|
||||
$attributes["VAR_SQL"] = $arrayData["VAR_SQL"];
|
||||
}
|
||||
if (!empty($arrayData["VAR_NULL"])) {
|
||||
$attributes["VAR_NULL"] = $arrayData["VAR_NULL"];
|
||||
}
|
||||
if (!empty($arrayData["VAR_DEFAULT"])) {
|
||||
$attributes["VAR_DEFAULT"] = $arrayData["VAR_DEFAULT"];
|
||||
}
|
||||
if (!empty($arrayData["VAR_ACCEPTED_VALUES"])) {
|
||||
$attributes["VAR_ACCEPTED_VALUES"] = G::json_encode($arrayData["VAR_ACCEPTED_VALUES"]);
|
||||
}
|
||||
if (!empty($arrayData["INP_DOC_UID"])) {
|
||||
$attributes["INP_DOC_UID"] = $arrayData["INP_DOC_UID"];
|
||||
}
|
||||
// Additional validations over the data
|
||||
$this->existsName($proUid, $arrayData["VAR_NAME"], "");
|
||||
$this->throwExceptionFieldDefinition($arrayData);
|
||||
// Register the new variable
|
||||
$processVariables = ProcessVariables::create($attributes);
|
||||
// Return theriable created
|
||||
$variable = $this->getVariable($proUid, $varUid);
|
||||
return $variable;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
@@ -292,7 +278,7 @@ class Variable
|
||||
$arrayVariables = array();
|
||||
while ($aRow = $rsCriteria->getRow()) {
|
||||
$VAR_ACCEPTED_VALUES = G::json_decode($aRow['VAR_ACCEPTED_VALUES'], true);
|
||||
if (count($VAR_ACCEPTED_VALUES)) {
|
||||
if (!empty($VAR_ACCEPTED_VALUES)) {
|
||||
$encodeAcceptedValues = preg_replace_callback("/\\\\u([a-f0-9]{4})/", function ($m) {
|
||||
return iconv('UCS-4LE', 'UTF-8', pack('V', hexdec('U' . $m[1])));
|
||||
}, G::json_encode($VAR_ACCEPTED_VALUES));
|
||||
@@ -333,64 +319,40 @@ class Variable
|
||||
*/
|
||||
public function getVariables($processUid)
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
Validator::proUid($processUid, '$prj_uid');
|
||||
|
||||
//Get data
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_UID);
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::PRJ_UID);
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_NAME);
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_FIELD_TYPE);
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_FIELD_SIZE);
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_LABEL);
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_DBCONNECTION);
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_SQL);
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_NULL);
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_DEFAULT);
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_ACCEPTED_VALUES);
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::INP_DOC_UID);
|
||||
$criteria->addSelectColumn(\DbSourcePeer::DBS_SERVER);
|
||||
$criteria->addSelectColumn(\DbSourcePeer::DBS_PORT);
|
||||
$criteria->addSelectColumn(\DbSourcePeer::DBS_DATABASE_NAME);
|
||||
$criteria->addSelectColumn(\DbSourcePeer::DBS_TYPE);
|
||||
$criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL);
|
||||
$criteria->addJoin(\ProcessVariablesPeer::VAR_DBCONNECTION, \DbSourcePeer::DBS_UID . " AND " . \DbSourcePeer::PRO_UID . " = '" . $processUid . "'", \Criteria::LEFT_JOIN);
|
||||
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$rsCriteria->next();
|
||||
$arrayVariables = array();
|
||||
while ($aRow = $rsCriteria->getRow()) {
|
||||
$VAR_ACCEPTED_VALUES = G::json_decode($aRow['VAR_ACCEPTED_VALUES'], true);
|
||||
if (count($VAR_ACCEPTED_VALUES)) {
|
||||
$encodeAcceptedValues = preg_replace_callback("/\\\\u([a-f0-9]{4})/", function ($m) {
|
||||
return iconv('UCS-4LE', 'UTF-8', pack('V', hexdec($m[1])));
|
||||
}, G::json_encode($VAR_ACCEPTED_VALUES));
|
||||
} else {
|
||||
$encodeAcceptedValues = $aRow['VAR_ACCEPTED_VALUES'];
|
||||
}
|
||||
|
||||
$arrayVariables[] = array('var_uid' => $aRow['VAR_UID'],
|
||||
'prj_uid' => $aRow['PRJ_UID'],
|
||||
'var_name' => $aRow['VAR_NAME'],
|
||||
'var_field_type' => $aRow['VAR_FIELD_TYPE'],
|
||||
'var_field_size' => (int)$aRow['VAR_FIELD_SIZE'],
|
||||
'var_label' => $aRow['VAR_LABEL'],
|
||||
'var_dbconnection' => $aRow['VAR_DBCONNECTION'] === 'none' ? 'workflow' : $aRow['VAR_DBCONNECTION'],
|
||||
'var_dbconnection_label' => $aRow['DBS_SERVER'] !== null ? '[' . $aRow['DBS_SERVER'] . ':' . $aRow['DBS_PORT'] . '] ' . $aRow['DBS_TYPE'] . ': ' . $aRow['DBS_DATABASE_NAME'] : 'PM Database',
|
||||
'var_sql' => $aRow['VAR_SQL'],
|
||||
'var_null' => (int)$aRow['VAR_NULL'],
|
||||
'var_default' => $aRow['VAR_DEFAULT'],
|
||||
'var_accepted_values' => $encodeAcceptedValues,
|
||||
'inp_doc_uid' => $aRow['INP_DOC_UID']);
|
||||
$rsCriteria->next();
|
||||
//Verify data
|
||||
$proId = Validator::proUid($processUid, '$prj_uid');
|
||||
$variables = ProcessVariables::getVariables($proId);
|
||||
$arrayVariables = [];
|
||||
foreach ($variables as $var) {
|
||||
$varAcceptedValues = G::json_decode($var['VAR_ACCEPTED_VALUES'], true);
|
||||
if (count($varAcceptedValues)) {
|
||||
$encodeAcceptedValues = preg_replace_callback("/\\\\u([a-f0-9]{4})/", function ($m) {
|
||||
return iconv('UCS-4LE', 'UTF-8', pack('V', hexdec($m[1])));
|
||||
}, G::json_encode($varAcceptedValues));
|
||||
} else {
|
||||
$encodeAcceptedValues = $var['VAR_ACCEPTED_VALUES'];
|
||||
}
|
||||
//Return
|
||||
return $arrayVariables;
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
$dbconnectionLabel = !is_null($var['DBS_SERVER']) ?
|
||||
'[' . $var['DBS_SERVER'] . ':' . $var['DBS_PORT'] . '] ' . $var['DBS_TYPE'] . ': ' . $var['DBS_DATABASE_NAME'] : 'PM Database';
|
||||
$arrayVariables[] = [
|
||||
'var_uid' => $var['VAR_UID'],
|
||||
'prj_uid' => $var['PRJ_UID'],
|
||||
'var_name' => $var['VAR_NAME'],
|
||||
'var_field_type' => $var['VAR_FIELD_TYPE'],
|
||||
'var_field_size' => (int)$var['VAR_FIELD_SIZE'],
|
||||
'var_label' => $var['VAR_LABEL'],
|
||||
'var_dbconnection' => $var['VAR_DBCONNECTION'] === 'none' ? 'workflow' : $var['VAR_DBCONNECTION'],
|
||||
'var_dbconnection_label' => !is_null($var['DBS_SERVER']) ?
|
||||
'[' . $var['DBS_SERVER'] . ':' . $var['DBS_PORT'] . '] ' . $var['DBS_TYPE'] . ': ' . $var['DBS_DATABASE_NAME'] : 'PM Database',
|
||||
'var_sql' => $var['VAR_SQL'],
|
||||
'var_null' => (int)$var['VAR_NULL'],
|
||||
'var_default' => $var['VAR_DEFAULT'],
|
||||
'var_accepted_values' => $encodeAcceptedValues,
|
||||
'inp_doc_uid' => $var['INP_DOC_UID']
|
||||
];
|
||||
}
|
||||
|
||||
return $arrayVariables;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -376,9 +376,7 @@ class Installer
|
||||
}
|
||||
|
||||
//ACTIVE ENTERPRISE
|
||||
|
||||
ini_set('max_execution_time', '0');
|
||||
ini_set('memory_limit', '256M');
|
||||
|
||||
$serv = 'http://';
|
||||
if (isset($_SERVER['HTTPS']) && trim($_SERVER['HTTPS']) != '') {
|
||||
|
||||
@@ -36,7 +36,6 @@ class System
|
||||
'debug_time' => 0,
|
||||
'debug_calendar' => 0,
|
||||
'wsdl_cache' => 1,
|
||||
'memory_limit' => "256M",
|
||||
'time_zone' => 'America/New_York',
|
||||
'expiration_year' => '1',
|
||||
'memcached' => 0,
|
||||
@@ -77,7 +76,8 @@ class System
|
||||
'mobile_offline_tables_download_interval' => 24,
|
||||
'highlight_home_folder_enable' => 0,
|
||||
'highlight_home_folder_refresh_time' => 10,
|
||||
'highlight_home_folder_scope' => 'unassigned' // For now only this list is supported
|
||||
'highlight_home_folder_scope' => 'unassigned', // For now only this list is supported
|
||||
'disable_advanced_search_case_title_fulltext' => 0
|
||||
];
|
||||
|
||||
/**
|
||||
@@ -1713,4 +1713,50 @@ class System
|
||||
}
|
||||
return (object) $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse an url with not encoded password that break the native “parse_url” function.
|
||||
* @param string $dsn
|
||||
* @return array
|
||||
*/
|
||||
public static function parseUrlWithNotEncodedPassword(string $dsn): array
|
||||
{
|
||||
$default = [
|
||||
'scheme' => '',
|
||||
'host' => '',
|
||||
'port' => '',
|
||||
'user' => '',
|
||||
'pass' => '',
|
||||
'path' => '',
|
||||
'query' => '',
|
||||
];
|
||||
$separator = "://";
|
||||
$colon = ":";
|
||||
$at = "@";
|
||||
|
||||
$result = explode($separator, $dsn, 2);
|
||||
if (empty($result[0]) || empty($result[1])) {
|
||||
return $default;
|
||||
}
|
||||
$scheme = $result[0];
|
||||
$urlWithoutScheme = $result[1];
|
||||
|
||||
$colonPosition = strpos($urlWithoutScheme, $colon);
|
||||
$user = substr($urlWithoutScheme, 0, $colonPosition);
|
||||
|
||||
$withoutUser = substr($urlWithoutScheme, $colonPosition + 1);
|
||||
$atPosition = strrpos($withoutUser, $at);
|
||||
$pass = substr($urlWithoutScheme, $colonPosition + 1, $atPosition);
|
||||
|
||||
$withoutPass = substr($withoutUser, $atPosition + 1);
|
||||
|
||||
$fixedDsn = $scheme . $separator . $user . $colon . urlencode($pass) . $at . $withoutPass;
|
||||
|
||||
$parseDsn = parse_url($fixedDsn);
|
||||
if ($parseDsn === false) {
|
||||
return $default;
|
||||
}
|
||||
$parseDsn["pass"] = urldecode($parseDsn["pass"]);
|
||||
return $parseDsn;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Importer;
|
||||
|
||||
use Process as ModelProcess;
|
||||
use Processes;
|
||||
use ProcessMaker\BusinessModel\Migrator;
|
||||
use ProcessMaker\BusinessModel\Migrator\ImportException;
|
||||
use ProcessMaker\Model\Process;
|
||||
use ProcessMaker\Model\ProcessVariables;
|
||||
use ProcessMaker\Project;
|
||||
use ProcessMaker\Project\Adapter;
|
||||
use ProcessMaker\Util;
|
||||
@@ -191,7 +193,7 @@ abstract class Importer
|
||||
}
|
||||
//Shouldn't generate new UID for all objects
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if($objectsToImport === ''){
|
||||
if ($objectsToImport === '') {
|
||||
/*----------------------------------********---------------------------------*/
|
||||
try {
|
||||
$this->verifyIfTheProcessHasStartedCases();
|
||||
@@ -333,7 +335,7 @@ abstract class Importer
|
||||
$diagram = $project->getStruct($projectUid);
|
||||
$res = $project->updateFromStruct($projectUid, $diagram);
|
||||
}
|
||||
$this->updateTheProcessOwner($projectUid);
|
||||
$this->updateProcessInformation($projectUid);
|
||||
return $projectUid;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
@@ -342,17 +344,20 @@ abstract class Importer
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
$result = $this->doImport($generateUid);
|
||||
$this->updateTheProcessOwner($result);
|
||||
$this->updateProcessInformation($result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* This updates the process owner.
|
||||
* This updates information related to the process
|
||||
*
|
||||
* @param string $proUid
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function updateTheProcessOwner(string $proUid): void
|
||||
private function updateProcessInformation(string $proUid): void
|
||||
{
|
||||
// Update the process owner
|
||||
$processOwner = $this->data["usr_uid"];
|
||||
|
||||
$currentProcess = $this->getCurrentProcess();
|
||||
@@ -363,6 +368,17 @@ abstract class Importer
|
||||
$process->update([
|
||||
'PRO_CREATE_USER' => $processOwner
|
||||
]);
|
||||
|
||||
// Update the process Variables with the PRO_ID related
|
||||
$process = new ModelProcess();
|
||||
if ($process->processExists($proUid)) {
|
||||
$processRow = $process->load($proUid);
|
||||
$proId = $processRow['PRO_ID'];
|
||||
$processVar = ProcessVariables::where('PRJ_UID', '=', $proUid);
|
||||
$processVar->update([
|
||||
'PRO_ID' => $proId
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -887,7 +903,7 @@ abstract class Importer
|
||||
$this->importData["tables"]["workflow"]["process"] = $this->importData["tables"]["workflow"]["process"][0];
|
||||
|
||||
$result = $this->doImport(true, false);
|
||||
$this->updateTheProcessOwner($result);
|
||||
$this->updateProcessInformation($result);
|
||||
return ['prj_uid' => $result];
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
|
||||
11
workflow/engine/src/ProcessMaker/Model/AppNotes.php
Normal file
11
workflow/engine/src/ProcessMaker/Model/AppNotes.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AppNotes extends Model
|
||||
{
|
||||
protected $table = 'APP_NOTES';
|
||||
public $timestamps = false;
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace ProcessMaker\Model;
|
||||
use G;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use ProcessMaker\Core\System;
|
||||
|
||||
class Delegation extends Model
|
||||
{
|
||||
@@ -229,14 +230,21 @@ class Delegation extends Model
|
||||
$query->join('APPLICATION', function ($join) use ($filterBy, $search, $status, $query) {
|
||||
$join->on('APP_DELEGATION.APP_NUMBER', '=', 'APPLICATION.APP_NUMBER');
|
||||
if ($filterBy == 'APP_TITLE' && $search) {
|
||||
// Cleaning "fulltext" operators in order to avoid unexpected results
|
||||
$search = str_replace(['-', '+', '<', '>', '(', ')', '~', '*', '"'], ['', '', '', '', '', '', '', '', ''], $search);
|
||||
$config = System::getSystemConfiguration();
|
||||
if ((int)$config['disable_advanced_search_case_title_fulltext'] === 0) {
|
||||
// Cleaning "fulltext" operators in order to avoid unexpected results
|
||||
$search = str_replace(['-', '+', '<', '>', '(', ')', '~', '*', '"'],
|
||||
['', '', '', '', '', '', '', '', ''], $search);
|
||||
|
||||
// Build the "fulltext" expression
|
||||
$search = '+"' . preg_replace('/\s+/', '" +"', addslashes($search)) . '"';
|
||||
// Build the "fulltext" expression
|
||||
$search = '+"' . preg_replace('/\s+/', '" +"', addslashes($search)) . '"';
|
||||
|
||||
// Searching using "fulltext" index
|
||||
$join->whereRaw("MATCH(APPLICATION.APP_TITLE) AGAINST('{$search}' IN BOOLEAN MODE)");
|
||||
// Searching using "fulltext" index
|
||||
$join->whereRaw("MATCH(APPLICATION.APP_TITLE) AGAINST('{$search}' IN BOOLEAN MODE)");
|
||||
} else {
|
||||
// Searching using "like" operator
|
||||
$join->where('APPLICATION.APP_TITLE', 'LIKE', "%${search}%");
|
||||
}
|
||||
}
|
||||
// Based on the below, we can further limit the join so that we have a smaller data set based on join criteria
|
||||
switch ($status) {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ProcessVariables extends Model
|
||||
{
|
||||
@@ -10,19 +11,89 @@ class ProcessVariables extends Model
|
||||
protected $table = 'PROCESS_VARIABLES';
|
||||
// No timestamps
|
||||
public $timestamps = false;
|
||||
//primary key
|
||||
// Primary key
|
||||
protected $primaryKey = 'VAR_UID';
|
||||
// The IDs are auto-incrementing
|
||||
public $incrementing = false;
|
||||
/**
|
||||
* The model's default values for attributes.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $attributes = [
|
||||
'VAR_FIELD_SIZE' => 0,
|
||||
'VAR_DBCONNECTION' => '',
|
||||
'VAR_SQL' => '',
|
||||
'VAR_NULL' => 0,
|
||||
'VAR_DEFAULT' => '',
|
||||
'VAR_ACCEPTED_VALUES' => '[]',
|
||||
'INP_DOC_UID' => '',
|
||||
];
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'VAR_UID',
|
||||
'PRJ_UID',
|
||||
'PRO_ID',
|
||||
'VAR_NAME',
|
||||
'VAR_FIELD_TYPE',
|
||||
'VAR_FIELD_TYPE_ID',
|
||||
'VAR_FIELD_SIZE',
|
||||
'VAR_LABEL',
|
||||
'VAR_DBCONNECTION',
|
||||
'VAR_SQL',
|
||||
'VAR_NULL',
|
||||
'VAR_DEFAULT',
|
||||
'VAR_ACCEPTED_VALUES',
|
||||
'INP_DOC_UID'
|
||||
];
|
||||
|
||||
/**
|
||||
* Scope a query to filter an specific process
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param string $columns
|
||||
* @param string $proUid
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeProcess($query, string $proUID)
|
||||
public function scopeProcess($query, string $proUid)
|
||||
{
|
||||
return $query->where('PRJ_UID', $proUID);
|
||||
return $query->where('PRJ_UID', $proUid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope a query to filter an specific process
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param int $proId
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeProcessId($query, int $proId)
|
||||
{
|
||||
return $query->where('PRO_ID', $proId);
|
||||
}
|
||||
/**
|
||||
* Return the variables list
|
||||
*
|
||||
* @param int $proId
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getVariables(int $proId)
|
||||
{
|
||||
$query = ProcessVariables::query()->select();
|
||||
$query->leftJoin('DB_SOURCE', function ($join) {
|
||||
$join->on('DB_SOURCE.PRO_ID', '=', 'PROCESS_VARIABLES.PRO_ID');
|
||||
});
|
||||
$query->where('PROCESS_VARIABLES.PRO_ID', $proId);
|
||||
$results = $query->get();
|
||||
$variablesList = [];
|
||||
$results->each(function ($item, $key) use (&$variablesList) {
|
||||
$variablesList[] = $item->toArray();
|
||||
});
|
||||
|
||||
return $variablesList;
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Util;
|
||||
|
||||
use WsResponse;
|
||||
|
||||
class WsMessageResponse extends WsResponse
|
||||
{
|
||||
private $appMessUid = null;
|
||||
|
||||
/**
|
||||
* Get the appMessUid
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAppMessUid()
|
||||
{
|
||||
return $this->appMessUid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the appMessUid
|
||||
*
|
||||
* @param string $v
|
||||
* @return void
|
||||
*/
|
||||
public function setAppMessUid($v)
|
||||
{
|
||||
$this->appMessUid = $v;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user