Merge remote-tracking branch 'upstream/3.0.1.7-Gmail' into BY-237
Conflicts: workflow/engine/methods/cases/cases_Derivate.php
This commit is contained in:
@@ -41,7 +41,7 @@ class FilesManager
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function getProcessFilesManagerPath($sProcessUID, $path)
|
||||
public function getProcessFilesManagerPath($sProcessUID, $path, $getContent = true)
|
||||
{
|
||||
try {
|
||||
$checkPath = substr($path, -1);
|
||||
@@ -85,7 +85,10 @@ class FilesManager
|
||||
}
|
||||
foreach ($aFiles as $aFile) {
|
||||
$arrayFileUid = $this->getFileManagerUid($sDirectory.$aFile['FILE']);
|
||||
$fcontent = file_get_contents($sDirectory.$aFile['FILE']);
|
||||
$fcontent = "";
|
||||
if ($getContent === true) {
|
||||
$fcontent = file_get_contents($sDirectory . $aFile['FILE']);
|
||||
}
|
||||
$fileUid = $arrayFileUid["PRF_UID"];
|
||||
if ($fileUid != null) {
|
||||
$oProcessFiles = \ProcessFilesPeer::retrieveByPK($fileUid);
|
||||
@@ -243,6 +246,11 @@ class FilesManager
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $aData
|
||||
* @throws Exception
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function addProcessFilesManagerInDb($aData)
|
||||
{
|
||||
try {
|
||||
@@ -250,13 +258,32 @@ class FilesManager
|
||||
$aData = array_change_key_case($aData, CASE_UPPER);
|
||||
$oProcessFiles->fromArray($aData, \BasePeer::TYPE_FIELDNAME);
|
||||
|
||||
$path = $aData['PRF_PATH'];
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
$path = str_replace("/", DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR, $path);
|
||||
}
|
||||
|
||||
$path = explode(DIRECTORY_SEPARATOR,$path);
|
||||
$fileDirectory = $path[count($path)-3];
|
||||
|
||||
switch ($fileDirectory) {
|
||||
case 'mailTemplates':
|
||||
$sDirectory = PATH_DATA_MAILTEMPLATES . $aData['PRO_UID'] . PATH_SEP . basename($aData['PRF_PATH']);
|
||||
break;
|
||||
case 'public':
|
||||
$sDirectory = PATH_DATA_PUBLIC . $aData['PRO_UID'] . PATH_SEP . basename($aData['PRF_PATH']);
|
||||
break;
|
||||
default:
|
||||
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array($aData['PRF_PATH'])));
|
||||
break;
|
||||
}
|
||||
|
||||
$oProcessFiles->setPrfPath($sDirectory);
|
||||
|
||||
if($this->existsProcessFile($aData['PRF_UID'])) {
|
||||
$sPkProcessFiles = \G::generateUniqueID();
|
||||
$oProcessFiles->setPrfUid($sPkProcessFiles);
|
||||
|
||||
$sDirectory = PATH_DATA_MAILTEMPLATES . $aData['PRO_UID'] . PATH_SEP . basename($aData['PRF_PATH']);
|
||||
$oProcessFiles->setPrfPath($sDirectory);
|
||||
|
||||
$emailEvent = new \ProcessMaker\BusinessModel\EmailEvent();
|
||||
$emailEvent->updatePrfUid($aData['PRF_UID'], $sPkProcessFiles, $aData['PRO_UID']);
|
||||
}
|
||||
@@ -267,6 +294,30 @@ class FilesManager
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $aData
|
||||
* @throws Exception
|
||||
*/
|
||||
public function updateProcessFilesManagerInDb($aData)
|
||||
{
|
||||
try {
|
||||
//update database
|
||||
if ($this->existsProcessFile($aData['prf_uid'])) {
|
||||
$aData = array_change_key_case($aData, CASE_UPPER);
|
||||
$oProcessFiles = \ProcessFilesPeer::retrieveByPK($aData['PRF_UID']);
|
||||
$sDate = date('Y-m-d H:i:s');
|
||||
$oProcessFiles->setPrfUpdateDate($sDate);
|
||||
$oProcessFiles->setProUid($aData['PRO_UID']);
|
||||
$oProcessFiles->setPrfPath($aData['PRF_PATH']);
|
||||
$oProcessFiles->save();
|
||||
} else {
|
||||
$this->addProcessFilesManagerInDb($aData);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function existsProcessFile($prfUid)
|
||||
{
|
||||
try {
|
||||
@@ -506,7 +557,7 @@ class FilesManager
|
||||
if ($path == '') {
|
||||
throw new \Exception(\G::LoadTranslation("ID_INVALID_VALUE_FOR", array('prf_uid')));
|
||||
}
|
||||
$sFile = end(explode("/",$path));
|
||||
$sFile = end(explode("/",str_replace('\\', '/',$path)));
|
||||
$sPath = str_replace($sFile,'',$path);
|
||||
$sSubDirectory = substr(str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))),0,-1);
|
||||
$sMainDirectory = str_replace(substr($sPath, strpos($sPath, $sProcessUID)),'', $sPath);
|
||||
|
||||
@@ -193,6 +193,19 @@ class InputDocument
|
||||
$flagAssigned = true;
|
||||
$arrayData[] = \G::LoadTranslation("ID_PROCESS_PERMISSIONS");
|
||||
}
|
||||
|
||||
//Variables
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_UID);
|
||||
$criteria->add(\ProcessVariablesPeer::INP_DOC_UID, $inputDocumentUid);
|
||||
|
||||
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
$flagAssigned = true;
|
||||
$arrayData[] = \G::LoadTranslation("ID_VARIABLES");
|
||||
}
|
||||
|
||||
//Return
|
||||
return array($flagAssigned, $arrayData);
|
||||
|
||||
@@ -2,10 +2,23 @@
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Light;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use G;
|
||||
|
||||
class NotificationDevice
|
||||
{
|
||||
|
||||
|
||||
public function checkMobileNotifications()
|
||||
{
|
||||
$conf = \System::getSystemConfiguration('', '', SYS_SYS);
|
||||
$activeNotifications = true;
|
||||
if (isset($conf['mobileNotifications'])) {
|
||||
$activeNotifications = $conf['mobileNotifications'] == 1 ? true : false;
|
||||
}
|
||||
return $activeNotifications;
|
||||
}
|
||||
|
||||
/**
|
||||
* Post Create register device with userUid
|
||||
*
|
||||
@@ -135,7 +148,7 @@ class NotificationDevice
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception(\Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
throw new \Exception($e->getMessage(), Api::STAT_APP_EXCEPTION);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
@@ -229,8 +242,9 @@ class NotificationDevice
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception(\Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
throw new \Exception($e->getMessage(), Api::STAT_APP_EXCEPTION);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
/**
|
||||
* The assignment rules migrator class.
|
||||
* The container class that stores the import and export rules for assignment rules.
|
||||
*
|
||||
* Class AssignmentRulesMigrator
|
||||
* @package ProcessMaker\BusinessModel\Migrator
|
||||
*/
|
||||
|
||||
class AssignmentRulesMigrator implements Importable, Exportable
|
||||
{
|
||||
protected $processes;
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* AssignmentRulesMigrator constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->processes = new \Processes();
|
||||
$this->className = 'Assignment Rules';
|
||||
}
|
||||
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param $replace
|
||||
* @throws ImportException
|
||||
*/
|
||||
public function import($data, $replace)
|
||||
{
|
||||
try {
|
||||
if ($replace) {
|
||||
$this->processes->createTaskRows($data['tasks']);
|
||||
$this->processes->addNewGroupRow($data['groupwfs']);
|
||||
$this->processes->removeTaskUserRows($data['tasks']);
|
||||
$this->processes->createTaskUserRows($data['taskusers']);
|
||||
} else {
|
||||
$this->processes->addNewTaskRows($data['tasks']);
|
||||
$this->processes->addNewGroupRow($data['groupwfs']);
|
||||
$this->processes->addNewTaskUserRows($data['taskusers']);
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ImportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterImport($data)
|
||||
{
|
||||
// TODO: Implement afterImport() method.
|
||||
}
|
||||
|
||||
public function beforeExport()
|
||||
{
|
||||
// TODO: Implement beforeExport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $prj_uid
|
||||
* @return array
|
||||
* @throws ExportException
|
||||
*/
|
||||
public function export($prj_uid)
|
||||
{
|
||||
try {
|
||||
$oAssignRules = new \StdClass();
|
||||
$oAssignRules->tasks = $this->processes->getTaskRows($prj_uid);
|
||||
$oAssignRules->taskusers = $this->processes->getTaskUserRows($oAssignRules->tasks);
|
||||
//groups - task
|
||||
$oDataTaskUsers = $this->processes->getTaskUserRows($oAssignRules->tasks);
|
||||
$oAssignRules->groupwfs = $this->processes->getGroupwfRows($oDataTaskUsers);
|
||||
|
||||
$result = array(
|
||||
'workflow-definition' => (array)$oAssignRules
|
||||
);
|
||||
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ExportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterExport()
|
||||
{
|
||||
// TODO: Implement afterExport() method.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
class DBConnectionMigrator implements Importable, Exportable
|
||||
{
|
||||
protected $processes;
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* DBConnectionMigrator constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->processes = new \Processes();
|
||||
$this->className = 'DB Connection';
|
||||
}
|
||||
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param $replace
|
||||
* @throws ImportException
|
||||
*/
|
||||
public function import($data, $replace)
|
||||
{
|
||||
try {
|
||||
if ($replace) {
|
||||
$this->processes->createDBConnectionsRows($data);
|
||||
} else {
|
||||
$this->processes->addNewDBConnectionsRows($data);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ImportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterImport($data)
|
||||
{
|
||||
// TODO: Implement afterImport() method.
|
||||
}
|
||||
|
||||
public function beforeExport()
|
||||
{
|
||||
// TODO: Implement beforeExport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $prj_uid
|
||||
* @return array
|
||||
* @throws ExportException
|
||||
*/
|
||||
public function export($prj_uid)
|
||||
{
|
||||
try {
|
||||
$oData = new \StdClass();
|
||||
$oData->dbconnections = $this->processes->getDBConnectionsRows($prj_uid);
|
||||
|
||||
$result = array(
|
||||
'workflow-definition' => (array)$oData
|
||||
);
|
||||
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ExportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterExport()
|
||||
{
|
||||
// TODO: Implement afterExport() method.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
class DynaformsMigrator implements Importable, Exportable
|
||||
{
|
||||
protected $processes;
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* DynaformsMigrator constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->processes = new \Processes();
|
||||
$this->className = 'Dynaforms';
|
||||
}
|
||||
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param $replace
|
||||
* @throws ImportException
|
||||
*/
|
||||
public function import($data, $replace)
|
||||
{
|
||||
try {
|
||||
if ($replace) {
|
||||
$this->processes->createDynaformRows($data);
|
||||
} else {
|
||||
$this->processes->addNewDynaformRows($data);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ImportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterImport($data)
|
||||
{
|
||||
// TODO: Implement afterImport() method.
|
||||
}
|
||||
|
||||
public function beforeExport()
|
||||
{
|
||||
// TODO: Implement beforeExport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $prj_uid
|
||||
* @return array
|
||||
* @throws ExportException
|
||||
*/
|
||||
public function export($prj_uid)
|
||||
{
|
||||
try {
|
||||
$oData = new \StdClass();
|
||||
$oData->steps = $this->processes->getStepRowsByElement($prj_uid,'DYNAFORM');
|
||||
$oData->dynaforms = $this->processes->getDynaformRows($prj_uid);
|
||||
$result = array(
|
||||
'workflow-definition' => (array)$oData
|
||||
);
|
||||
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ExportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterExport()
|
||||
{
|
||||
// TODO: Implement afterExport() method.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
|
||||
class ExportException extends \Exception
|
||||
{
|
||||
protected $nameException;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getNameException()
|
||||
{
|
||||
return $this->nameException;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $nameException
|
||||
*/
|
||||
public function setNameException($nameException)
|
||||
{
|
||||
$this->nameException = $nameException;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
class ExportObjects
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $objectsList = array(
|
||||
'Process Definition',
|
||||
'Assignment Rules',
|
||||
'Variables',
|
||||
'Dynaforms',
|
||||
'Input Documents',
|
||||
'Output Documents',
|
||||
'Triggers',
|
||||
'Report Tables',
|
||||
'Templates',
|
||||
'Files',
|
||||
'DB Connection',
|
||||
'Permissions',
|
||||
'Supervisors',
|
||||
'Supervisors Objects'
|
||||
);
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getObjectsList()
|
||||
{
|
||||
return $this->objectsList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $objectsList
|
||||
*/
|
||||
public function setObjectsList($objectsList)
|
||||
{
|
||||
$this->objectsList = $objectsList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $objectsEnable
|
||||
* @return mixed|string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function objectList($objectsEnable = '')
|
||||
{
|
||||
$grid = [];
|
||||
try {
|
||||
$aObjectsEnable = explode('|', $objectsEnable);
|
||||
foreach ($this->objectsList as $key => $val) {
|
||||
$grid[] = array(
|
||||
'OBJECT_ID' => $key+1,
|
||||
'OBJECT_NAME' => $val,
|
||||
'OBJECT_ACTION' => 1,
|
||||
'OBJECT_ENABLE' => in_array(strtoupper(str_replace(' ', '',$val)), $aObjectsEnable)
|
||||
);
|
||||
}
|
||||
|
||||
$r = new \stdclass();
|
||||
$r->data = $grid;
|
||||
|
||||
return \G::json_encode($r);
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $idObject
|
||||
* @return mixed
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getObjectName($idObject)
|
||||
{
|
||||
try {
|
||||
return (str_replace(' ', '', $this->objectsList[$idObject - 1]));
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $objects
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function mapObjectList($objects)
|
||||
{
|
||||
try {
|
||||
$mapObjectList = array();
|
||||
foreach ($objects as $objectId) {
|
||||
array_push($mapObjectList, strtoupper(str_replace(' ', '', $this->objectsList[$objectId - 1])));
|
||||
}
|
||||
return $mapObjectList;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $objects
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getIdObjectList($objects)
|
||||
{
|
||||
try {
|
||||
$idObjectList = array();
|
||||
foreach ($this->objectsList as $key => $val) {
|
||||
$key++;
|
||||
foreach ($objects as $row) {
|
||||
if(strtoupper(str_replace(' ', '', $this->objectsList[$key - 1])) === $row){
|
||||
array_push($idObjectList, $key);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $idObjectList;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
// Declare the interface 'Exportable'
|
||||
interface Exportable
|
||||
{
|
||||
public function beforeExport();
|
||||
public function export($prj_uid);
|
||||
public function afterExport();
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
use ProcessMaker\Util;
|
||||
|
||||
class FileHandler
|
||||
{
|
||||
/**
|
||||
* @param $prj_uid
|
||||
* @return array
|
||||
*/
|
||||
public function getFilesToExclude($prj_uid)
|
||||
{
|
||||
try {
|
||||
$arrayPublicFileToExclude = array("wsClient.php");
|
||||
$criteria = new \Criteria("workflow");
|
||||
$criteria->addSelectColumn(\WebEntryPeer::WE_DATA);
|
||||
$criteria->add(\WebEntryPeer::PRO_UID, $prj_uid, \Criteria::EQUAL);
|
||||
$criteria->add(\WebEntryPeer::WE_METHOD, "WS", \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \WebEntryPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
$arrayPublicFileToExclude[] = $row["WE_DATA"];
|
||||
$arrayPublicFileToExclude[] = preg_replace("/^(.+)\.php$/", "$1Post.php", $row["WE_DATA"]);
|
||||
}
|
||||
|
||||
return $arrayPublicFileToExclude;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
\Logger::log($e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $prj_uid
|
||||
* @param $arrayPublicFileToExclude
|
||||
* @param $target
|
||||
* @return array
|
||||
*/
|
||||
public function getTemplatesOrPublicFiles($prj_uid, $arrayPublicFileToExclude = array(), $target)
|
||||
{
|
||||
$workflowFile = array();
|
||||
$workspaceTargetDir = ($target === 'PUBLIC') ? 'public' : 'mailTemplates';
|
||||
$workspaceDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP;
|
||||
|
||||
$templatesDir = $workspaceDir . $workspaceTargetDir . PATH_SEP . $prj_uid;
|
||||
$templatesFiles = Util\Common::rglob("$templatesDir/*", 0, true);
|
||||
|
||||
foreach ($templatesFiles as $templatesFile) {
|
||||
if (is_dir($templatesFile)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$filename = basename($templatesFile);
|
||||
|
||||
if ($target == "PUBLIC" && in_array($filename, $arrayPublicFileToExclude)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$workflowFile[$target][] = array(
|
||||
"filename" => $filename,
|
||||
"filepath" => $prj_uid . PATH_SEP . $filename,
|
||||
"file_content" => file_get_contents($templatesFile)
|
||||
);
|
||||
}
|
||||
return $workflowFile;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
use ProcessMaker\Util;
|
||||
use \ProcessMaker\BusinessModel\Migrator\FileHandler;
|
||||
|
||||
class FilesMigrator implements Importable, Exportable
|
||||
{
|
||||
protected $processes;
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* FilesMigrator constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->processes = new \Processes();
|
||||
$this->className = 'Public Files';
|
||||
}
|
||||
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param $replace
|
||||
* @throws ImportException
|
||||
*/
|
||||
public function import($data, $replace)
|
||||
{
|
||||
try {
|
||||
$aTable = $data['TABLE'];
|
||||
foreach ($aTable as $value) {
|
||||
if ($value['PRF_EDITABLE'] === '0') {
|
||||
if ($replace) {
|
||||
$this->processes->createFilesManager($value['PRO_UID'], array($value));
|
||||
} else {
|
||||
$this->processes->addNewFilesManager($value['PRO_UID'], array($value));
|
||||
}
|
||||
}
|
||||
}
|
||||
$aPath = $data['PATH'];
|
||||
foreach ($aPath as $target => $files) {
|
||||
$basePath = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP;
|
||||
if (strtoupper($target) === 'PUBLIC') {
|
||||
foreach ($files as $file) {
|
||||
$filename = $basePath . ((isset($file["file_path"])) ? $file["file_path"] : $file["filepath"]);
|
||||
$path = dirname($filename);
|
||||
if (!is_dir($path)) {
|
||||
Util\Common::mk_dir($path, 0775);
|
||||
}
|
||||
if (file_exists($filename)) {
|
||||
if ($replace) {
|
||||
file_put_contents($filename, $file["file_content"]);
|
||||
}
|
||||
} else {
|
||||
file_put_contents($filename, $file["file_content"]);
|
||||
}
|
||||
|
||||
|
||||
@chmod($filename, 0775);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ImportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterImport($data)
|
||||
{
|
||||
// TODO: Implement afterImport() method.
|
||||
}
|
||||
|
||||
public function beforeExport()
|
||||
{
|
||||
// TODO: Implement beforeExport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $prj_uid
|
||||
* @return array
|
||||
* @throws ExportException
|
||||
*/
|
||||
public function export($prj_uid)
|
||||
{
|
||||
try {
|
||||
$oData = new \StdClass();
|
||||
$oData->filesManager = $this->processes->getFilesManager($prj_uid, 'public');
|
||||
|
||||
$fileHandler = new FileHandler();
|
||||
$arrayPublicFileToExclude = $fileHandler->getFilesToExclude($prj_uid);
|
||||
$workflowFile = $fileHandler->getTemplatesOrPublicFiles($prj_uid, $arrayPublicFileToExclude, 'PUBLIC');
|
||||
|
||||
$result = array(
|
||||
'workflow-definition' => (array)$oData,
|
||||
'workflow-files' => $workflowFile
|
||||
);
|
||||
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ExportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterExport()
|
||||
{
|
||||
// TODO: Implement afterExport() method.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
use ProcessMaker\Project;
|
||||
|
||||
class GranularExporter
|
||||
{
|
||||
|
||||
protected $factory;
|
||||
protected $publisher;
|
||||
protected $generator;
|
||||
protected $data;
|
||||
protected $prjuid;
|
||||
/**
|
||||
* GranularExporter constructor.
|
||||
*/
|
||||
public function __construct($prj_uid)
|
||||
{
|
||||
$this->prjuid = $prj_uid;
|
||||
$this->factory = new MigratorFactory();
|
||||
$this->generator = new PMXGenerator();
|
||||
$this->publisher = new PMXPublisher();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $objectList
|
||||
* @return array|string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function export($objectList)
|
||||
{
|
||||
try {
|
||||
$exportObject = new ExportObjects();
|
||||
$objectList = $exportObject->mapObjectList($objectList);
|
||||
$this->beforeExport($objectList);
|
||||
foreach ($objectList as $data) {
|
||||
$migrator = $this->factory->create($data);
|
||||
$migratorData = $migrator->export($this->prjuid);
|
||||
$this->mergeData($migratorData);
|
||||
}
|
||||
return $this->publish();
|
||||
} catch (ExportException $e) {
|
||||
return array(
|
||||
'success' => false,
|
||||
'message' => $e->getMessage()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
protected function beforeExport()
|
||||
{
|
||||
$objectList = func_get_args()[0];
|
||||
$bpmnProject = Project\Bpmn::load($this->prjuid);
|
||||
$projectData = $bpmnProject->getProject();
|
||||
$getProjectName = $this->publisher->truncateName($projectData['PRJ_NAME'], false);
|
||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||
$version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx2") + 1;
|
||||
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx2");
|
||||
|
||||
$bpnmDefinition = array(
|
||||
'ACTIVITY' => [],
|
||||
'ARTIFACT' => [],
|
||||
'BOUND' => [],
|
||||
'DATA' => [],
|
||||
'DIAGRAM' => [],
|
||||
'DOCUMENTATION' => [],
|
||||
'EXTENSION' => [],
|
||||
'FLOW' => [],
|
||||
'GATEWAY' => [],
|
||||
'LANE' => [],
|
||||
'LANESET' => [],
|
||||
'PARTICIPANT' => [],
|
||||
'PROCESS' => [],
|
||||
'PROJECT' => array(\BpmnProjectPeer::retrieveByPK($this->prjuid)->toArray())
|
||||
);
|
||||
$workflowDefinition = array(
|
||||
'process' => array(\Processes::getProcessRow($this->prjuid, false)),
|
||||
'tasks' => [],
|
||||
'routes' => [],
|
||||
'lanes' => [],
|
||||
'gateways' => [],
|
||||
'inputs' => [],
|
||||
'outputs' => [],
|
||||
'dynaforms' => [],
|
||||
'steps' => [],
|
||||
'triggers' => [],
|
||||
'taskusers' => [],
|
||||
'groupwfs' => [],
|
||||
'steptriggers' => [],
|
||||
'dbconnections' => [],
|
||||
'reportTables' => [],
|
||||
'reportTablesVars' => [],
|
||||
'stepSupervisor' => [],
|
||||
'objectPermissions' => [],
|
||||
'subProcess' => [],
|
||||
'caseTracker' => [],
|
||||
'caseTrackerObject' => [],
|
||||
'stage' => [],
|
||||
'fieldCondition' => [],
|
||||
'event' => [],
|
||||
'caseScheduler' => [],
|
||||
'processCategory' => [],
|
||||
'taskExtraProperties' => [],
|
||||
'processUser' => [],
|
||||
'processVariables' => [],
|
||||
'webEntry' => [],
|
||||
'webEntryEvent' => [],
|
||||
'messageType' => [],
|
||||
'messageTypeVariable' => [],
|
||||
'messageEventDefinition' => [],
|
||||
'scriptTask' => [],
|
||||
'timerEvent' => [],
|
||||
'emailEvent' => []
|
||||
);
|
||||
$data = array(
|
||||
'bpmn-definition' => $bpnmDefinition,
|
||||
'workflow-definition' => $workflowDefinition,
|
||||
'workflow-files' => []
|
||||
);
|
||||
|
||||
$data["filename"] = $outputFilename;
|
||||
$data["version"] = "3.1";
|
||||
$data["container"] = "ProcessMaker-Project";
|
||||
$data["metadata"] = array(
|
||||
"vendor_version" => \System::getVersion(),
|
||||
"vendor_version_code" => "Michelangelo",
|
||||
"export_timestamp" => date("U"),
|
||||
"export_datetime" => date("Y-m-d\TH:i:sP"),
|
||||
"export_server_addr" => isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"].":".$_SERVER["SERVER_PORT"] : "Unknown",
|
||||
"export_server_os" => PHP_OS ,
|
||||
"export_server_php_version" => PHP_VERSION_ID,
|
||||
);
|
||||
$data["metadata"]["workspace"] = defined("SYS_SYS") ? SYS_SYS : "Unknown";
|
||||
$data["metadata"]["name"] = $projectData['PRJ_NAME'];
|
||||
$data["metadata"]["uid"] = $projectData['PRJ_UID'];
|
||||
$data["metadata"]["export_version"] = $version;
|
||||
$data["metadata"]["export_objects"] = implode('|', $objectList);
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $migratorData
|
||||
*/
|
||||
protected function mergeData($migratorData)
|
||||
{
|
||||
$migratorData = $this->verifyConsistenceData($migratorData);
|
||||
$this->data = array_merge_recursive($this->data, $migratorData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $migratorData
|
||||
* @return mixed
|
||||
*/
|
||||
protected function verifyConsistenceData($migratorData)
|
||||
{
|
||||
//verifying data consistency group
|
||||
if (isset($migratorData['workflow-definition']['groupwfs'])) {
|
||||
foreach ($this->data['workflow-definition']['groupwfs'] as $rowGroup) {
|
||||
foreach ($migratorData['workflow-definition']['groupwfs'] as $key => $row) {
|
||||
if ($rowGroup['GRP_UID'] == $row['GRP_UID']) {
|
||||
array_splice($migratorData['workflow-definition']['groupwfs'], $key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $migratorData;
|
||||
}
|
||||
|
||||
public function publish()
|
||||
{
|
||||
return $this->publisher->publish(
|
||||
$this->data['filename'],
|
||||
$this->generator->generate(
|
||||
$this->data
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
<?php
|
||||
/**
|
||||
* Description of Granular Importer
|
||||
*
|
||||
*/
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
use ProcessMaker\Importer\XmlImporter;
|
||||
use ProcessMaker\Project\Adapter;
|
||||
|
||||
class GranularImporter
|
||||
{
|
||||
|
||||
protected $factory;
|
||||
protected $data;
|
||||
/**
|
||||
* GranularImporter constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->factory = new MigratorFactory();
|
||||
$this->bpmn = new Adapter\BpmnWorkflow();
|
||||
$this->exportObjects = new ExportObjects();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param $aGranular
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function loadObjectsListSelected($data, $aGranular)
|
||||
{
|
||||
$listObjectGranular = array();
|
||||
$this->exportObjects = new ExportObjects();
|
||||
//create structure
|
||||
foreach ($aGranular as $key => $rowObject) {
|
||||
array_push($listObjectGranular, array("name" => strtoupper($this->exportObjects->getObjectName
|
||||
($rowObject->id)), "data" => "", "value" => $rowObject->action));
|
||||
}
|
||||
//add data
|
||||
foreach ($listObjectGranular as $key => $rowObject) {
|
||||
$listObjectGranular[$key]['data'] = $this->addObjectData($listObjectGranular[$key]['name'], $data);
|
||||
}
|
||||
return $listObjectGranular;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $nameObject
|
||||
* @param $data
|
||||
* @return array
|
||||
*/
|
||||
public function addObjectData($nameObject, $data)
|
||||
{
|
||||
$objectList = array();
|
||||
switch ($nameObject) {
|
||||
case 'PROCESSDEFINITION':
|
||||
$objectList['PROCESSDEFINITION']['bpmn'] = isset($data['tables']['bpmn']) ? $this->structureBpmnData
|
||||
($data['tables']['bpmn']) : '';
|
||||
$objectList['PROCESSDEFINITION']['workflow'] = isset($data['tables']['workflow']) ?
|
||||
$data['tables']['workflow'] : '';
|
||||
break;
|
||||
case 'ASSIGNMENTRULES':
|
||||
$objectList['ASSIGNMENTRULES']['tasks'] = isset($data['tables']['workflow']['tasks']) ?
|
||||
$data['tables']['workflow']['tasks'] : [];
|
||||
$objectList['ASSIGNMENTRULES']['taskusers'] = isset($data['tables']['workflow']['taskusers']) ?
|
||||
$data['tables']['workflow']['taskusers'] : [];
|
||||
$objectList['ASSIGNMENTRULES']['groupwfs'] = isset($data['tables']['workflow']['groupwfs']) ?
|
||||
$data['tables']['workflow']['groupwfs'] : [];
|
||||
break;
|
||||
case 'VARIABLES':
|
||||
$objectList['VARIABLES'] = isset($data['tables']['workflow']['processVariables']) ?
|
||||
$data['tables']['workflow']['processVariables'] : '';
|
||||
break;
|
||||
case 'DYNAFORMS':
|
||||
$objectList['DYNAFORMS'] = isset($data['tables']['workflow']['dynaforms']) ?
|
||||
$data['tables']['workflow']['dynaforms'] : '';
|
||||
break;
|
||||
case 'INPUTDOCUMENTS':
|
||||
$objectList['INPUTDOCUMENTS'] = isset($data['tables']['workflow']['inputs']) ?
|
||||
$data['tables']['workflow']['inputs'] : '';
|
||||
break;
|
||||
case 'OUTPUTDOCUMENTS':
|
||||
$objectList['OUTPUTDOCUMENTS'] = isset($data['tables']['workflow']['outputs']) ?
|
||||
$data['tables']['workflow']['outputs'] : '';
|
||||
break;
|
||||
case 'TRIGGERS':
|
||||
$objectList['TRIGGERS'] = isset($data['tables']['workflow']['triggers']) ?
|
||||
$data['tables']['workflow']['triggers'] : '';
|
||||
break;
|
||||
case 'TEMPLATES':
|
||||
$objectList['TEMPLATES']['TABLE'] = isset($data['tables']['workflow']['filesManager']) ?
|
||||
$data['tables']['workflow']['filesManager'] : '';
|
||||
$objectList['TEMPLATES']['PATH'] = isset($data['files']['workflow']) ? $data['files']['workflow'] : '';
|
||||
break;
|
||||
case 'FILES':
|
||||
$objectList['FILES']['TABLE'] = isset($data['tables']['workflow']['filesManager']) ?
|
||||
$data['tables']['workflow']['filesManager'] : '';
|
||||
$objectList['FILES']['PATH'] = isset($data['files']['workflow']) ? $data['files']['workflow'] : '';
|
||||
break;
|
||||
case 'DBCONNECTION':
|
||||
case 'DBCONNECTIONS':
|
||||
$objectList['DBCONNECTION'] = isset($data['tables']['workflow']['dbconnections']) ?
|
||||
$data['tables']['workflow']['dbconnections'] : '';
|
||||
break;
|
||||
case 'PERMISSIONS':
|
||||
$objectList['PERMISSIONS']['objectPermissions'] = isset($data['tables']['workflow']['objectPermissions']) ?
|
||||
$data['tables']['workflow']['objectPermissions'] : '';
|
||||
$objectList['PERMISSIONS']['groupwfs'] = isset($data['tables']['workflow']['groupwfs']) ?
|
||||
$data['tables']['workflow']['groupwfs'] : '';
|
||||
break;
|
||||
case 'SUPERVISORS':
|
||||
$objectList['SUPERVISORS']['processUser'] = isset($data['tables']['workflow']['processUser']) ?
|
||||
$data['tables']['workflow']['processUser'] : '';
|
||||
$objectList['SUPERVISORS']['groupwfs'] = isset($data['tables']['workflow']['groupwfs']) ?
|
||||
$data['tables']['workflow']['groupwfs'] : '';
|
||||
break;
|
||||
case 'SUPERVISORSOBJECTS':
|
||||
$objectList['SUPERVISORSOBJECTS'] = isset($data['tables']['workflow']['stepSupervisor']) ?
|
||||
$data['tables']['workflow']['stepSupervisor'] : '';
|
||||
break;
|
||||
case 'REPORTTABLES':
|
||||
$objectList['REPORTTABLES']['reportTablesDefinition'] = isset($data['tables']['workflow']['reportTablesDefinition']) ?
|
||||
$data['tables']['workflow']['reportTablesDefinition'] : [];
|
||||
$objectList['REPORTTABLES']['reportTablesFields'] = isset($data['tables']['workflow']['reportTablesFields']) ?
|
||||
$data['tables']['workflow']['reportTablesFields'] : [];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return $objectList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the structure from File
|
||||
*/
|
||||
public function structureBpmnData(array $tables)
|
||||
{
|
||||
$project = $tables["project"][0];
|
||||
$diagram = $tables["diagram"][0];
|
||||
$diagram["activities"] = (isset($tables["activity"])) ? $tables["activity"] : array();
|
||||
$diagram["artifacts"] = (isset($tables["artifact"])) ? $tables["artifact"] : array();
|
||||
$diagram["events"] = (isset($tables["event"])) ? $tables["event"] : array();
|
||||
$diagram["flows"] = (isset($tables["flow"])) ? $tables["flow"] : array();
|
||||
$diagram["gateways"] = (isset($tables["gateway"])) ? $tables["gateway"] : array();
|
||||
$diagram["data"] = (isset($tables["data"])) ? $tables["data"] : array();
|
||||
$diagram["participants"] = (isset($tables["participant"])) ? $tables["participant"] : array();
|
||||
$diagram["laneset"] = (isset($tables["laneset"])) ? $tables["laneset"] : array();
|
||||
$diagram["lanes"] = (isset($tables["lane"])) ? $tables["lane"] : array();
|
||||
$project["diagrams"] = array($diagram);
|
||||
$project["prj_author"] = isset($this->data["usr_uid"]) ? $this->data["usr_uid"] : "00000000000000000000000000000001";
|
||||
$project["process"] = $tables["process"][0];
|
||||
return $project;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $objectList
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function import($objectList)
|
||||
{
|
||||
try {
|
||||
$objectList = $this->reorderImportOrder($objectList);
|
||||
foreach ($objectList as $data) {
|
||||
$objClass = $this->factory->create($data['name']);
|
||||
if (is_object($objClass)) {
|
||||
$dataImport = $data['data'][$data['name']];
|
||||
$replace = ($data['value'] == 'replace') ? true : false;
|
||||
$migratorData = $objClass->import($dataImport, $replace);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ImportException('Please review your current process definition
|
||||
for missing elements, it\'s recommended that a new process should be exported
|
||||
with all the elements.');
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $objectList
|
||||
* @param bool $generateUid
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function validateImportData($objectList, $option)
|
||||
{
|
||||
try {
|
||||
if (XmlImporter::IMPORT_OPTION_OVERWRITE !== $option) {
|
||||
if (count($objectList) !== count($this->exportObjects->getObjectsList())) {
|
||||
$exception = new ImportException();
|
||||
$exception->setNameException(\G::LoadTranslation('ID_PROCESS_DEFINITION_INCOMPLETE'));
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* It's very important to import the elements in the right order, if not
|
||||
* chaos will be unleashed, God forgive us all.
|
||||
* @param $objectList
|
||||
*/
|
||||
public function reorderImportOrder($objectList)
|
||||
{
|
||||
$arrangeList = array(
|
||||
0 => 12,
|
||||
1 => 13,
|
||||
2 => 0,
|
||||
3 => 1,
|
||||
4 => 2,
|
||||
5 => 3,
|
||||
6 => 4,
|
||||
7 => 5,
|
||||
8 => 6,
|
||||
9 => 7,
|
||||
10 => 8,
|
||||
11 => 9,
|
||||
12 => 10,
|
||||
13 => 11
|
||||
);
|
||||
$orderedList = array();
|
||||
foreach ($arrangeList as $objectOrder => $executionOrder) {
|
||||
if (!empty($objectList[$objectOrder])) {
|
||||
$orderedList[$executionOrder] = $objectList[$objectOrder];
|
||||
}
|
||||
}
|
||||
ksort($orderedList);
|
||||
return $orderedList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $objectList
|
||||
* @param array $data
|
||||
* @return data
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function regenerateAllUids($data, $generateUid = true)
|
||||
{
|
||||
try {
|
||||
$newData = array();
|
||||
$arrayBpmnTables = $data["tables"]["bpmn"];
|
||||
$arrayWorkflowTables = $data["tables"]["workflow"];
|
||||
$arrayWorkflowFiles = $data["files"]["workflow"];
|
||||
$result = $this->bpmn->createFromStruct($this->structureBpmnData($arrayBpmnTables), $generateUid);
|
||||
$projectUidOld = $arrayBpmnTables["project"][0]["prj_uid"];
|
||||
$projectUid = ($generateUid)? $result[0]["new_uid"] : $result;
|
||||
if ($generateUid) {
|
||||
$result[0]["object"] = "project";
|
||||
$result[0]["old_uid"] = $projectUidOld;
|
||||
$result[0]["new_uid"] = $projectUid;
|
||||
|
||||
$workflow = new \ProcessMaker\Project\Workflow();
|
||||
|
||||
list($arrayWorkflowTables, $arrayWorkflowFiles) = $workflow->updateDataUidByArrayUid($arrayWorkflowTables, $arrayWorkflowFiles, $result);
|
||||
}
|
||||
$newData['tables']['workflow'] = $arrayWorkflowTables;
|
||||
$newData['files']['workflow'] = $arrayWorkflowFiles;
|
||||
|
||||
return array(
|
||||
'data' => $newData,
|
||||
'new_uid' => $projectUid);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
|
||||
class ImportException extends \Exception
|
||||
{
|
||||
protected $nameException;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getNameException()
|
||||
{
|
||||
return $this->nameException;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $nameException
|
||||
*/
|
||||
public function setNameException($nameException)
|
||||
{
|
||||
$this->nameException = $nameException;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
// Declare the interface 'Importable'
|
||||
interface Importable
|
||||
{
|
||||
public function beforeImport($data);
|
||||
public function import($data, $replace);
|
||||
public function afterImport($data);
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
class InputDocumentsMigrator implements Importable, Exportable
|
||||
{
|
||||
protected $processes;
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* InputDocumentsMigrator constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->processes = new \Processes();
|
||||
$this->className = 'InputDocument';
|
||||
}
|
||||
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param $replace
|
||||
* @throws ImportException
|
||||
*/
|
||||
public function import($data, $replace)
|
||||
{
|
||||
try {
|
||||
if ($replace) {
|
||||
$this->processes->createInputRows($data);
|
||||
} else {
|
||||
$this->processes->addNewInputRows($data);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ImportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterImport($data)
|
||||
{
|
||||
// TODO: Implement afterImport() method.
|
||||
}
|
||||
|
||||
public function beforeExport()
|
||||
{
|
||||
// TODO: Implement beforeExport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $prj_uid
|
||||
* @return array
|
||||
* @throws ExportException
|
||||
*/
|
||||
public function export($prj_uid)
|
||||
{
|
||||
try {
|
||||
$oData = new \StdClass();
|
||||
$oData->steps = $this->processes->getStepRowsByElement($prj_uid,'INPUT_DOCUMENT');
|
||||
$oData->inputs = $this->processes->getInputRows($prj_uid);
|
||||
|
||||
$result = array(
|
||||
'workflow-definition' => (array)$oData
|
||||
);
|
||||
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ExportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterExport()
|
||||
{
|
||||
// TODO: Implement afterExport() method.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
|
||||
class MigratorFactory
|
||||
{
|
||||
public function create($classname)
|
||||
{
|
||||
$class = new NullMigrator();
|
||||
switch (strtoupper($classname)) {
|
||||
case 'ASSIGNMENTRULES':
|
||||
$class = new AssignmentRulesMigrator();
|
||||
break;
|
||||
case 'FILES':
|
||||
$class = new FilesMigrator();
|
||||
break;
|
||||
case 'DBCONNECTION':
|
||||
case 'DBCONNECTIONS':
|
||||
$class = new DBConnectionMigrator();
|
||||
break;
|
||||
case 'DYNAFORMS':
|
||||
$class = new DynaformsMigrator();
|
||||
break;
|
||||
case 'INPUTDOCUMENTS':
|
||||
$class = new InputDocumentsMigrator();
|
||||
break;
|
||||
case 'OUTPUTDOCUMENTS':
|
||||
$class = new OutputDocumentsMigrator();
|
||||
break;
|
||||
case 'PROCESSDEFINITION':
|
||||
$class = new ProcessDefinitionMigrator();
|
||||
break;
|
||||
case 'REPORTTABLES':
|
||||
$class = new ReportTablesMigrator();
|
||||
break;
|
||||
case 'SUPERVISORS':
|
||||
$class = new SupervisorsMigrator();
|
||||
break;
|
||||
case 'SUPERVISORSOBJECTS':
|
||||
$class = new SupervisorsObjectsMigrator();
|
||||
break;
|
||||
case 'TEMPLATES':
|
||||
$class = new TemplatesMigrator();
|
||||
break;
|
||||
case 'TRIGGERS':
|
||||
$class = new TriggersMigrator();
|
||||
break;
|
||||
case 'VARIABLES':
|
||||
$class = new VariablesMigrator();
|
||||
break;
|
||||
case 'PERMISSIONS':
|
||||
$class = new PermissionsMigrator();
|
||||
break;
|
||||
}
|
||||
return $class;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
|
||||
class NullMigrator implements Importable, Exportable
|
||||
{
|
||||
public function beforeExport()
|
||||
{
|
||||
// TODO: Implement beforeExport() method.
|
||||
}
|
||||
|
||||
public function export($prj_uid)
|
||||
{
|
||||
// TODO: Implement export() method.
|
||||
}
|
||||
|
||||
public function afterExport()
|
||||
{
|
||||
// TODO: Implement afterExport() method.
|
||||
}
|
||||
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
public function import($data, $replace)
|
||||
{
|
||||
// TODO: Implement import() method.
|
||||
}
|
||||
|
||||
public function afterImport($data)
|
||||
{
|
||||
// TODO: Implement afterImport() method.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
class OutputDocumentsMigrator implements Importable, Exportable
|
||||
{
|
||||
protected $processes;
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* OutputDocumentsMigrator constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->processes = new \Processes();
|
||||
$this->className = 'OutputDocument';
|
||||
}
|
||||
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param $replace
|
||||
* @throws ImportException
|
||||
*/
|
||||
public function import($data, $replace)
|
||||
{
|
||||
try {
|
||||
if ($replace) {
|
||||
$this->processes->createOutputRows($data);
|
||||
} else {
|
||||
$this->processes->addNewOutputRows($data);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ImportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterImport($data)
|
||||
{
|
||||
// TODO: Implement afterImport() method.
|
||||
}
|
||||
|
||||
public function beforeExport()
|
||||
{
|
||||
// TODO: Implement beforeExport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $prj_uid
|
||||
* @return array
|
||||
* @throws ExportException
|
||||
*/
|
||||
public function export($prj_uid)
|
||||
{
|
||||
try {
|
||||
$oData = new \StdClass();
|
||||
$oData->steps = $this->processes->getStepRowsByElement($prj_uid,'OUTPUT_DOCUMENT');
|
||||
$oData->outputs = $this->processes->getOutputRows($prj_uid);
|
||||
|
||||
$result = array(
|
||||
'workflow-definition' => (array)$oData
|
||||
);
|
||||
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ExportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterExport()
|
||||
{
|
||||
// TODO: Implement afterExport() method.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
/**
|
||||
* Class PMXGenerator
|
||||
* This class generates the a PMX class based on the data passed on the generate method.
|
||||
*
|
||||
* @package ProcessMaker\BusinessModel\Migrator
|
||||
*/
|
||||
|
||||
class PMXGenerator
|
||||
{
|
||||
|
||||
/**
|
||||
* @var \DOMElement
|
||||
*/
|
||||
protected $rootNode;
|
||||
/**
|
||||
* @var \DOMDocument
|
||||
*/
|
||||
protected $domDocument;
|
||||
|
||||
/**
|
||||
* PMXPublisher constructor.
|
||||
* @param $domDocument
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->domDocument = new \DOMDocument("1.0", "utf-8");
|
||||
$this->domDocument->formatOutput = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a PMX xml string based on the $data passed along.
|
||||
*
|
||||
* @param $data
|
||||
* @return string
|
||||
*/
|
||||
public function generate($data)
|
||||
{
|
||||
$rootNode = $this->domDocument->createElement($data['container']);
|
||||
$rootNode->setAttribute("version", $data['version']);
|
||||
$this->domDocument->appendChild($rootNode);
|
||||
|
||||
$metadata = $data["metadata"];
|
||||
$metadataNode = $this->domDocument->createElement("metadata");
|
||||
|
||||
foreach ($metadata as $key => $value) {
|
||||
$metaNode = $this->domDocument->createElement("meta");
|
||||
$metaNode->setAttribute("key", $key);
|
||||
$metaNode->appendChild($this->getTextNode($value));
|
||||
$metadataNode->appendChild($metaNode);
|
||||
}
|
||||
|
||||
$rootNode->appendChild($metadataNode);
|
||||
|
||||
$dbData = array("BPMN" => $data["bpmn-definition"], "workflow" => $data["workflow-definition"]);
|
||||
foreach ($dbData as $sectionName => $sectionData) {
|
||||
$dataNode = $this->domDocument->createElement("definition");
|
||||
$dataNode->setAttribute("class", $sectionName);
|
||||
|
||||
foreach ($sectionData as $elementName => $elementData) {
|
||||
$elementNode = $this->domDocument->createElement("table");
|
||||
$elementNode->setAttribute("name", $elementName);
|
||||
|
||||
foreach ($elementData as $recordData) {
|
||||
$recordNode = $this->domDocument->createElement("record");
|
||||
if(is_array($recordData)){
|
||||
$recordData = array_change_key_case($recordData, CASE_LOWER);
|
||||
|
||||
foreach ($recordData as $key => $value) {
|
||||
if (is_object($value) || is_array($value)) {
|
||||
$value = serialize($value);
|
||||
}
|
||||
$columnNode = $this->domDocument->createElement($key);
|
||||
$columnNode->appendChild($this->getTextNode($value));
|
||||
$recordNode->appendChild($columnNode);
|
||||
}
|
||||
|
||||
$elementNode->appendChild($recordNode);
|
||||
}
|
||||
}
|
||||
|
||||
$dataNode->appendChild($elementNode);
|
||||
}
|
||||
|
||||
$rootNode->appendChild($dataNode);
|
||||
}
|
||||
|
||||
$workflowFilesNode = $this->domDocument->createElement("workflow-files");
|
||||
|
||||
foreach ($data["workflow-files"] as $elementName => $elementData) {
|
||||
foreach ($elementData as $fileData) {
|
||||
$fileNode = $this->domDocument->createElement("file");
|
||||
$fileNode->setAttribute("target", strtolower($elementName));
|
||||
|
||||
$filenameNode = $this->domDocument->createElement("file_name");
|
||||
$filenameNode->appendChild($this->getTextNode($fileData["filename"]));
|
||||
$fileNode->appendChild($filenameNode);
|
||||
|
||||
$filepathNode = $this->domDocument->createElement("file_path");
|
||||
$filepathNode->appendChild($this->domDocument->createCDATASection($fileData["filepath"]));
|
||||
$fileNode->appendChild($filepathNode);
|
||||
|
||||
$fileContentNode = $this->domDocument->createElement("file_content");
|
||||
$fileContentNode->appendChild($this->domDocument->createCDATASection(base64_encode($fileData["file_content"])));
|
||||
$fileNode->appendChild($fileContentNode);
|
||||
|
||||
$workflowFilesNode->appendChild($fileNode);
|
||||
}
|
||||
}
|
||||
$rootNode->appendChild($workflowFilesNode);
|
||||
return $this->domDocument->saveXML($rootNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
private function getTextNode($value)
|
||||
{
|
||||
if (empty($value) || preg_match('/^[\w\s\.\-]+$/', $value, $match)) {
|
||||
return $this->domDocument->createTextNode($value);
|
||||
} else {
|
||||
return $this->domDocument->createCDATASection($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
use ProcessMaker\Util;
|
||||
|
||||
class PMXPublisher
|
||||
{
|
||||
public function publish($filename, $data)
|
||||
{
|
||||
$parentDir = dirname($filename);
|
||||
|
||||
if (! is_dir($parentDir)) {
|
||||
Util\Common::mk_dir($parentDir, 0775);
|
||||
}
|
||||
|
||||
$outputFile = $this->truncateName($filename);
|
||||
|
||||
file_put_contents($outputFile, $data);
|
||||
@chmod($outputFile, 0755);
|
||||
|
||||
return basename($outputFile);
|
||||
}
|
||||
|
||||
public function truncateName($outputFile, $dirName = true)
|
||||
{
|
||||
$limit = 200;
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
$limit = 150;
|
||||
}
|
||||
if ($dirName) {
|
||||
if (strlen(basename($outputFile)) >= $limit) {
|
||||
$lastPos = strrpos(basename($outputFile), '.');
|
||||
$fileName = substr(basename($outputFile), 0, $lastPos);
|
||||
$newFileName = str_replace(".", "_", $fileName);
|
||||
$newFileName = str_replace(" ", "_", $fileName);
|
||||
$excess = strlen($newFileName) - $limit;
|
||||
$newFileName = substr($newFileName, 0, strlen($newFileName) - $excess);
|
||||
$newOutputFile = str_replace($fileName, $newFileName, $outputFile);
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
$newOutputFile = str_replace("/", DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, $newOutputFile);
|
||||
}
|
||||
$outputFile = $newOutputFile;
|
||||
}
|
||||
} else {
|
||||
$outputFile = str_replace(".", "_", $outputFile);
|
||||
$outputFile = str_replace(" ", "_", $outputFile);
|
||||
if (strlen($outputFile) >= $limit) {
|
||||
$excess = strlen($outputFile) - $limit;
|
||||
$newFileName = substr($outputFile, 0, strlen($outputFile) - $excess);
|
||||
$outputFile = $newFileName;
|
||||
}
|
||||
}
|
||||
return $outputFile;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
|
||||
class PermissionsMigrator implements Importable, Exportable
|
||||
{
|
||||
protected $processes;
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* PermissionsMigrator constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->processes = new \Processes();
|
||||
$this->className = 'Permissions';
|
||||
}
|
||||
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param $replace
|
||||
* @throws ImportException
|
||||
*/
|
||||
public function import($data, $replace)
|
||||
{
|
||||
try {
|
||||
if ($replace) {
|
||||
$this->processes->createObjectPermissionsRows($data['objectPermissions']);
|
||||
$this->processes->addNewGroupRow($data['groupwfs']);
|
||||
} else {
|
||||
$this->processes->addNewObjectPermissionRows($data['objectPermissions']);
|
||||
$this->processes->addNewGroupRow($data['groupwfs']);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ImportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterImport($data)
|
||||
{
|
||||
// TODO: Implement afterImport() method.
|
||||
}
|
||||
|
||||
public function beforeExport()
|
||||
{
|
||||
// TODO: Implement beforeExport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $prj_uid
|
||||
* @return array
|
||||
* @throws ExportException
|
||||
*/
|
||||
public function export($prj_uid)
|
||||
{
|
||||
try {
|
||||
$processData = new \StdClass();
|
||||
$processData->process = $this->processes->getProcessRow($prj_uid, false);
|
||||
$processData->tasks = $this->processes->getTaskRows($prj_uid);
|
||||
$processData->routes = $this->processes->getRouteRows($prj_uid);
|
||||
$processData->lanes = $this->processes->getLaneRows($prj_uid);
|
||||
$processData->gateways = $this->processes->getGatewayRows($prj_uid);
|
||||
$processData->steps = $this->processes->getStepRows($prj_uid);
|
||||
$processData->taskusers = $this->processes->getTaskUserRows($processData->tasks);
|
||||
$processData->groupwfs = $this->processes->getGroupwfRows($processData->taskusers);
|
||||
$processData->steptriggers = $this->processes->getStepTriggerRows($processData->tasks);
|
||||
$processData->reportTablesVars = $this->processes->getReportTablesVarsRows($prj_uid);
|
||||
|
||||
$oData = new \StdClass();
|
||||
$oData->objectPermissions = $this->processes->getObjectPermissionRows($prj_uid, $processData);
|
||||
//groups - permissions
|
||||
$oData->groupwfs = $this->processes->getGroupwfRows($oData->objectPermissions);
|
||||
|
||||
|
||||
$result = array(
|
||||
'workflow-definition' => (array)$oData
|
||||
);
|
||||
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ExportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterExport()
|
||||
{
|
||||
// TODO: Implement afterExport() method.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
use ProcessMaker\Project\Adapter;
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
|
||||
class ProcessDefinitionMigrator implements Importable, Exportable
|
||||
{
|
||||
protected $bpmn;
|
||||
protected $processes;
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* ProcessDefinitionMigrator constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->bpmn = new Adapter\BpmnWorkflow();
|
||||
$this->processes = new \Processes();
|
||||
$this->className = 'ProcessDefinition';
|
||||
}
|
||||
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param $replace
|
||||
* @throws ImportException
|
||||
*/
|
||||
public function import($data, $replace)
|
||||
{
|
||||
try {
|
||||
//Bpmn elements
|
||||
$pjrUid = $this->bpmn->createFromStruct($data['bpmn'], false);
|
||||
//Import workflow elements
|
||||
$this->afterImport($data);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ImportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @throws ImportException
|
||||
*/
|
||||
public function afterImport($data)
|
||||
{
|
||||
try {
|
||||
//Workflow elements
|
||||
$this->processes->updateProcessRow($data['workflow']['process']);
|
||||
$this->processes->createTaskRows($data['workflow']['tasks']);
|
||||
$this->processes->createTaskUserRows($data['workflow']['taskusers']);
|
||||
$this->processes->createRouteRows($data['workflow']['routes']);
|
||||
$this->processes->createLaneRows($data['workflow']['lanes']);
|
||||
$this->processes->createGatewayRows($data['workflow']['gateways']);
|
||||
$this->processes->createStepRows($data['workflow']['steps']);
|
||||
$this->processes->createStepTriggerRows($data['workflow']['steptriggers']);
|
||||
$this->processes->createSubProcessRows($data['workflow']['subProcess']);
|
||||
$this->processes->createCaseTrackerRows($data['workflow']['caseTracker']);
|
||||
$this->processes->createCaseTrackerObjectRows($data['workflow']['caseTrackerObject']);
|
||||
$this->processes->createStageRows($data['workflow']['stage']);
|
||||
$this->processes->createFieldCondition($data['workflow']['fieldCondition'], $data['workflow']['dynaforms']);
|
||||
$this->processes->createEventRows($data['workflow']['event']);
|
||||
$this->processes->createCaseSchedulerRows($data['workflow']['caseScheduler']);
|
||||
$this->processes->createProcessCategoryRow($data['workflow']['processCategory']);
|
||||
$this->processes->createTaskExtraPropertiesRows($data['workflow']['taskExtraProperties']);
|
||||
$this->processes->createWebEntry($data['workflow']['process']['PRO_UID'], $data['workflow']['process']['PRO_CREATE_USER'], $data['workflow']['webEntry']);
|
||||
$this->processes->createWebEntryEvent($data['workflow']['process']['PRO_UID'], $data['workflow']['process']['PRO_CREATE_USER'], $data['workflow']['webEntryEvent']);
|
||||
$this->processes->createMessageType($data['workflow']['messageType']);
|
||||
$this->processes->createMessageTypeVariable($data['workflow']['messageTypeVariable']);
|
||||
$this->processes->createMessageEventDefinition($data['workflow']['process']['PRO_UID'], $data['workflow']['messageEventDefinition']);
|
||||
$this->processes->createScriptTask($data['workflow']['process']['PRO_UID'], $data['workflow']['scriptTask']);
|
||||
$this->processes->createTimerEvent($data['workflow']['process']['PRO_UID'], $data['workflow']['timerEvent']);
|
||||
$this->processes->createEmailEvent($data['workflow']['process']['PRO_UID'], $data['workflow']['emailEvent']);
|
||||
$this->processes->createActionsByEmail($data['workflow']['process']['PRO_UID'], $data['workflow']['abeConfiguration']);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ImportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function beforeExport()
|
||||
{
|
||||
// TODO: Implement beforeExport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $prj_uid
|
||||
* @return array
|
||||
* @throws ExportException
|
||||
*/
|
||||
public function export($prj_uid)
|
||||
{
|
||||
try {
|
||||
$bpmnStruct["ACTIVITY"] = \BpmnActivity::getAll($prj_uid);
|
||||
$bpmnStruct["ARTIFACT"] = \BpmnArtifact::getAll($prj_uid);
|
||||
$bpmnStruct["BOUND"] = \BpmnBound::getAll($prj_uid);
|
||||
$bpmnStruct["DATA"] = \BpmnData::getAll($prj_uid);
|
||||
$bpmnStruct["DIAGRAM"] = \BpmnDiagram::getAll($prj_uid);
|
||||
$bpmnStruct["DOCUMENTATION"] = array();
|
||||
$bpmnStruct["EVENT"] = \BpmnEvent::getAll($prj_uid);
|
||||
$bpmnStruct["EXTENSION"] = array();
|
||||
$bpmnStruct["FLOW"] = \BpmnFlow::getAll($prj_uid, null, null, "", CASE_UPPER, false);
|
||||
$bpmnStruct["GATEWAY"] = \BpmnGateway::getAll($prj_uid);
|
||||
$bpmnStruct["LANE"] = \BpmnLane::getAll($prj_uid);
|
||||
$bpmnStruct["LANESET"] = \BpmnLaneset::getAll($prj_uid);
|
||||
$bpmnStruct["PARTICIPANT"] = \BpmnParticipant::getAll($prj_uid);
|
||||
$bpmnStruct["PROCESS"] = \BpmnProcess::getAll($prj_uid);
|
||||
|
||||
$oData = new \StdClass();
|
||||
$oData->tasks = $this->processes->getTaskRows($prj_uid);
|
||||
$oData->taskusers = $this->processes->getTaskUserRows($oData->tasks);
|
||||
$oData->routes = $this->processes->getRouteRows($prj_uid);
|
||||
$oData->lanes = $this->processes->getLaneRows($prj_uid);
|
||||
$oData->gateways = $this->processes->getGatewayRows($prj_uid);
|
||||
$oData->subProcess = $this->processes->getSubProcessRow($prj_uid);
|
||||
$oData->caseTracker = $this->processes->getCaseTrackerRow($prj_uid);
|
||||
$oData->caseTrackerObject = $this->processes->getCaseTrackerObjectRow($prj_uid);
|
||||
$oData->stage = $this->processes->getStageRow($prj_uid);
|
||||
$oData->fieldCondition = $this->processes->getFieldCondition($prj_uid);
|
||||
$oData->event = $this->processes->getEventRow($prj_uid);
|
||||
$oData->caseScheduler = $this->processes->getCaseSchedulerRow($prj_uid);
|
||||
$oData->processCategory = $this->processes->getProcessCategoryRow($prj_uid);
|
||||
$oData->taskExtraProperties = $this->processes->getTaskExtraPropertiesRows($prj_uid);
|
||||
$oData->webEntry = $this->processes->getWebEntries($prj_uid);
|
||||
$oData->webEntryEvent = $this->processes->getWebEntryEvents($prj_uid);
|
||||
$oData->messageType = $this->processes->getMessageTypes($prj_uid);
|
||||
$oData->messageTypeVariable = $this->processes->getMessageTypeVariables($prj_uid);
|
||||
$oData->messageEventDefinition = $this->processes->getMessageEventDefinitions($prj_uid);
|
||||
$oData->steps = $this->processes->getStepRows($prj_uid);
|
||||
$oData->steptriggers = $this->processes->getStepTriggerRows($oData->tasks);
|
||||
$oData->scriptTask = $this->processes->getScriptTasks($prj_uid);
|
||||
$oData->timerEvent = $this->processes->getTimerEvents($prj_uid);
|
||||
$oData->emailEvent = $this->processes->getEmailEvent($prj_uid);
|
||||
$oData->abeConfiguration = $this->processes->getActionsByEmail($prj_uid);
|
||||
$oData->processUser = $this->processes->getProcessUser($prj_uid);
|
||||
$oData->process["PRO_TYPE_PROCESS"] = "PUBLIC";
|
||||
|
||||
$result = array(
|
||||
'bpmn-definition' => (array)$bpmnStruct,
|
||||
'workflow-definition' => (array)$oData
|
||||
);
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ExportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function afterExport()
|
||||
{
|
||||
// TODO: Implement afterExport() method.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
class ReportTablesMigrator implements Importable, Exportable
|
||||
{
|
||||
protected $processes;
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* ReportTablesMigrator constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->processes = new \Processes();
|
||||
$this->className = 'ReportTables';
|
||||
}
|
||||
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param $replace
|
||||
* @throws ImportException
|
||||
*/
|
||||
public function import($data, $replace)
|
||||
{
|
||||
try {
|
||||
$reportTable = new \ProcessMaker\BusinessModel\ReportTable();
|
||||
$arrayTableSchema = [];
|
||||
$arrayTablesToExclude = [];
|
||||
$processUid = '';
|
||||
|
||||
foreach ($data['reportTablesDefinition'] as $value) {
|
||||
$arrayTable = $value;
|
||||
|
||||
$processUid = $arrayTable['PRO_UID'];
|
||||
|
||||
$arrayField = [];
|
||||
|
||||
foreach ($data['reportTablesFields'] as $value2) {
|
||||
if ($value2['ADD_TAB_UID'] == $arrayTable['ADD_TAB_UID']) {
|
||||
unset($value2['ADD_TAB_UID']);
|
||||
|
||||
$arrayField[] = $value2;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($arrayField)) {
|
||||
$arrayTable['FIELDS'] = $arrayField;
|
||||
|
||||
$arrayTableSchema[] = $arrayTable;
|
||||
|
||||
//$replace: true //Delete all tables and create it again
|
||||
//$replace: false //Only create the tables that do not exist
|
||||
if (!$replace) {
|
||||
$additionalTable = new \AdditionalTables();
|
||||
|
||||
if ($additionalTable->loadByName($arrayTable['ADD_TAB_NAME']) !== false) {
|
||||
$arrayTablesToExclude[] = $arrayTable['ADD_TAB_NAME'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($arrayTableSchema)) {
|
||||
$errors = $reportTable->createStructureOfTables(
|
||||
$arrayTableSchema, [], $processUid, false, true, $arrayTablesToExclude
|
||||
);
|
||||
|
||||
if ($errors != '') {
|
||||
throw new \Exception($errors);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ImportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterImport($data)
|
||||
{
|
||||
// TODO: Implement afterImport() method.
|
||||
}
|
||||
|
||||
public function beforeExport()
|
||||
{
|
||||
// TODO: Implement beforeExport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $prj_uid
|
||||
* @return array
|
||||
* @throws ExportException
|
||||
*/
|
||||
public function export($prj_uid)
|
||||
{
|
||||
try {
|
||||
$oData = new \StdClass();
|
||||
|
||||
$oData->reportTablesDefinition = $this->processes->getReportTables($prj_uid);
|
||||
$oData->reportTablesFields = $this->processes->getReportTablesVar($prj_uid);
|
||||
|
||||
$result = array(
|
||||
'workflow-definition' => (array)$oData
|
||||
);
|
||||
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ExportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterExport()
|
||||
{
|
||||
// TODO: Implement afterExport() method.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
|
||||
class SupervisorsMigrator implements Importable, Exportable
|
||||
{
|
||||
protected $processes;
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* SupervisorsMigrator constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->processes = new \Processes();
|
||||
$this->className = 'Supervisor';
|
||||
}
|
||||
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param $replace
|
||||
* @throws ImportException
|
||||
*/
|
||||
public function import($data, $replace)
|
||||
{
|
||||
try {
|
||||
if ($replace) {
|
||||
$this->processes->createProcessUser($data['processUser']);
|
||||
$this->processes->addNewGroupRow($data['groupwfs']);
|
||||
} else {
|
||||
$this->processes->addNewProcessUser($data['processUser']);
|
||||
$this->processes->addNewGroupRow($data['groupwfs']);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ImportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterImport($data)
|
||||
{
|
||||
// TODO: Implement afterImport() method.
|
||||
}
|
||||
|
||||
public function beforeExport()
|
||||
{
|
||||
// TODO: Implement beforeExport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $prj_uid
|
||||
* @return array
|
||||
* @throws ExportException
|
||||
*/
|
||||
public function export($prj_uid)
|
||||
{
|
||||
try {
|
||||
$oData = new \StdClass();
|
||||
$oData->processUser = $this->processes->getProcessUser($prj_uid);
|
||||
//groups - supervisor
|
||||
$oData->groupwfs = $this->processes->getGroupwfRows($oData->processUser);
|
||||
|
||||
|
||||
$result = array(
|
||||
'workflow-definition' => (array)$oData
|
||||
);
|
||||
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ExportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterExport()
|
||||
{
|
||||
// TODO: Implement afterExport() method.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
|
||||
class SupervisorsObjectsMigrator implements Importable, Exportable
|
||||
{
|
||||
protected $processes;
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* SupervisorsObjectsMigrator constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->processes = new \Processes();
|
||||
$this->className = 'Supervisor Object';
|
||||
}
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param $replace
|
||||
* @throws ImportException
|
||||
*/
|
||||
public function import($data, $replace)
|
||||
{
|
||||
try {
|
||||
if ($replace) {
|
||||
$this->processes->createStepSupervisorRows($data);
|
||||
} else {
|
||||
$this->processes->updateStepSupervisorRows($data);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ImportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterImport($data)
|
||||
{
|
||||
// TODO: Implement afterImport() method.
|
||||
}
|
||||
|
||||
public function beforeExport()
|
||||
{
|
||||
// TODO: Implement beforeExport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $prj_uid
|
||||
* @return array
|
||||
* @throws ExportException
|
||||
*/
|
||||
public function export($prj_uid)
|
||||
{
|
||||
try {
|
||||
$oData = new \StdClass();
|
||||
$oData->stepSupervisor = $this->processes->getStepSupervisorRows($prj_uid);
|
||||
|
||||
$result = array(
|
||||
'workflow-definition' => (array)$oData
|
||||
);
|
||||
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ExportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterExport()
|
||||
{
|
||||
// TODO: Implement afterExport() method.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
use ProcessMaker\Util;
|
||||
|
||||
|
||||
class TemplatesMigrator implements Importable, Exportable
|
||||
{
|
||||
protected $processes;
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* TemplatesMigrator constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->processes = new \Processes();
|
||||
$this->className = 'Templates';
|
||||
}
|
||||
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param $replace
|
||||
* @throws ImportException
|
||||
*/
|
||||
public function import($data, $replace)
|
||||
{
|
||||
try {
|
||||
$aTable = $data['TABLE'];
|
||||
foreach ($aTable as $value) {
|
||||
if ($value['PRF_EDITABLE'] === '1') {
|
||||
if ($replace) {
|
||||
$this->processes->createFilesManager($value['PRO_UID'], array($value));
|
||||
} else {
|
||||
$this->processes->addNewFilesManager($value['PRO_UID'], array($value));
|
||||
}
|
||||
}
|
||||
}
|
||||
$aPath = $data['PATH'];
|
||||
foreach ($aPath as $target => $files) {
|
||||
$basePath = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'mailTemplates' . PATH_SEP;
|
||||
if (strtoupper($target) === 'TEMPLATE') {
|
||||
foreach ($files as $file) {
|
||||
$filename = $basePath . ((isset($file["file_path"])) ? $file["file_path"] : $file["filepath"]);
|
||||
$path = dirname($filename);
|
||||
|
||||
if (!is_dir($path)) {
|
||||
Util\Common::mk_dir($path, 0775);
|
||||
}
|
||||
|
||||
if (file_exists($filename)) {
|
||||
if ($replace) {
|
||||
file_put_contents($filename, $file["file_content"]);
|
||||
}
|
||||
} else {
|
||||
file_put_contents($filename, $file["file_content"]);
|
||||
}
|
||||
@chmod($filename, 0775);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ImportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function afterImport($data)
|
||||
{
|
||||
// TODO: Implement afterImport() method.
|
||||
}
|
||||
|
||||
public function beforeExport()
|
||||
{
|
||||
// TODO: Implement beforeExport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $prj_uid
|
||||
* @return array
|
||||
* @throws ExportException
|
||||
*/
|
||||
public function export($prj_uid)
|
||||
{
|
||||
try {
|
||||
$oData = new \StdClass();
|
||||
$arrayExcludeFile = array();
|
||||
$oData->filesManager = $this->processes->getFilesManager($prj_uid, 'template');
|
||||
|
||||
$fileHandler = new FileHandler();
|
||||
$workflowFile = $fileHandler->getTemplatesOrPublicFiles($prj_uid, $arrayExcludeFile, 'template');
|
||||
|
||||
$result = array(
|
||||
'workflow-definition' => (array)$oData,
|
||||
'workflow-files' => $workflowFile
|
||||
);
|
||||
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
throw new ExportException($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function afterExport()
|
||||
{
|
||||
// TODO: Implement afterExport() method.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||
|
||||
class TriggersMigrator implements Importable, Exportable
|
||||
{
|
||||
protected $processes;
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* TriggersMigrator constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->processes = new \Processes();
|
||||
$this->className = 'Triggers';
|
||||
}
|
||||
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param $replace
|
||||
* @throws ImportException
|
||||
*/
|
||||
public function import($data, $replace)
|
||||
{
|
||||
try {
|
||||
if ($replace) {
|
||||
$this->processes->createTriggerRows($data);
|
||||
} else {
|
||||
$this->processes->addNewTriggerRows($data);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ImportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterImport($data)
|
||||
{
|
||||
// TODO: Implement afterImport() method.
|
||||
}
|
||||
|
||||
public function beforeExport()
|
||||
{
|
||||
// TODO: Implement beforeExport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $prj_uid
|
||||
* @return array
|
||||
* @throws ExportException
|
||||
*/
|
||||
public function export($prj_uid)
|
||||
{
|
||||
try {
|
||||
$oData = new \StdClass();
|
||||
$tasks = $this->processes->getTaskRows($prj_uid);
|
||||
$oData->steptriggers = $this->processes->getStepTriggerRows($tasks);
|
||||
$oData->triggers = $this->processes->getTriggerRows($prj_uid);
|
||||
|
||||
$result = array(
|
||||
'workflow-definition' => (array)$oData
|
||||
);
|
||||
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ExportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterExport()
|
||||
{
|
||||
// TODO: Implement afterExport() method.
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\BusinessModel\Migrator;
|
||||
|
||||
/**
|
||||
* Class VariablesMigrator
|
||||
* @package ProcessMaker\BusinessModel\Migrator
|
||||
*/
|
||||
|
||||
class VariablesMigrator implements Importable, Exportable
|
||||
{
|
||||
protected $processes;
|
||||
protected $className;
|
||||
|
||||
/**
|
||||
* VariablesMigrator constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->processes = new \Processes();
|
||||
$this->className = 'Variables';
|
||||
}
|
||||
|
||||
/**
|
||||
* beforeImport hook
|
||||
* @param $data
|
||||
*/
|
||||
public function beforeImport($data)
|
||||
{
|
||||
// TODO: Implement beforeImport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param $replace
|
||||
* @throws ImportException
|
||||
*/
|
||||
public function import($data, $replace)
|
||||
{
|
||||
try {
|
||||
if ($replace) {
|
||||
$this->processes->createProcessVariables($data);
|
||||
} else {
|
||||
$this->processes->updateProcessVariables($data);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ImportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to launch after the import process has just finished
|
||||
* @param $data
|
||||
*/
|
||||
public function afterImport($data)
|
||||
{
|
||||
// TODO: Implement afterImport() method.
|
||||
}
|
||||
|
||||
|
||||
public function beforeExport()
|
||||
{
|
||||
// TODO: Implement beforeExport() method.
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $prj_uid
|
||||
* @return array
|
||||
* @throws ExportException
|
||||
*/
|
||||
public function export($prj_uid)
|
||||
{
|
||||
try {
|
||||
$oData = new \StdClass();
|
||||
$oData->processVariables = $this->processes->getProcessVariables($prj_uid);
|
||||
|
||||
$result = array(
|
||||
'workflow-definition' => (array)$oData
|
||||
);
|
||||
|
||||
return $result;
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$exception = new ExportException($e->getMessage());
|
||||
$exception->setNameException($this->className);
|
||||
throw($exception);
|
||||
}
|
||||
}
|
||||
|
||||
public function afterExport()
|
||||
{
|
||||
// TODO: Implement afterExport() method.
|
||||
}
|
||||
}
|
||||
@@ -538,20 +538,42 @@ class Process
|
||||
|
||||
$trigger = new \ProcessMaker\BusinessModel\Trigger();
|
||||
|
||||
/**
|
||||
* Try catch block is added to escape the exception and continue editing
|
||||
* the properties of the process, otherwise there is no way to edit
|
||||
* the properties that the exception is thrown: trigger nonexistent.
|
||||
* The same goes for the similar blocks.
|
||||
*/
|
||||
if (isset($arrayData["PRO_TRI_DELETED"]) && $arrayData["PRO_TRI_DELETED"] . "" != "") {
|
||||
$trigger->throwExceptionIfNotExistsTrigger($arrayData["PRO_TRI_DELETED"], $processUid, $this->arrayFieldNameForException["processTriDeleted"]);
|
||||
try {
|
||||
$trigger->throwExceptionIfNotExistsTrigger($arrayData["PRO_TRI_DELETED"], $processUid, $this->arrayFieldNameForException["processTriDeleted"]);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($arrayData["PRO_TRI_CANCELED"]) && $arrayData["PRO_TRI_CANCELED"] . "" != "") {
|
||||
$trigger->throwExceptionIfNotExistsTrigger($arrayData["PRO_TRI_CANCELED"], $processUid, $this->arrayFieldNameForException["processTriCanceled"]);
|
||||
try {
|
||||
$trigger->throwExceptionIfNotExistsTrigger($arrayData["PRO_TRI_CANCELED"], $processUid, $this->arrayFieldNameForException["processTriCanceled"]);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($arrayData["PRO_TRI_PAUSED"]) && $arrayData["PRO_TRI_PAUSED"] . "" != "") {
|
||||
$trigger->throwExceptionIfNotExistsTrigger($arrayData["PRO_TRI_PAUSED"], $processUid, $this->arrayFieldNameForException["processTriPaused"]);
|
||||
try {
|
||||
$trigger->throwExceptionIfNotExistsTrigger($arrayData["PRO_TRI_PAUSED"], $processUid, $this->arrayFieldNameForException["processTriPaused"]);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($arrayData["PRO_TRI_REASSIGNED"]) && $arrayData["PRO_TRI_REASSIGNED"] . "" != "") {
|
||||
$trigger->throwExceptionIfNotExistsTrigger($arrayData["PRO_TRI_REASSIGNED"], $processUid, $this->arrayFieldNameForException["processTriReassigned"]);
|
||||
try {
|
||||
$trigger->throwExceptionIfNotExistsTrigger($arrayData["PRO_TRI_REASSIGNED"], $processUid, $this->arrayFieldNameForException["processTriReassigned"]);
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($arrayData["PRO_PARENT"])) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user