Merge remote-tracking branch 'upstream/3.0.1.8' into MT-100

This commit is contained in:
dheeyi
2016-04-07 10:17:50 -04:00
6 changed files with 64 additions and 10 deletions

View File

@@ -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 = '';
$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,7 +258,26 @@ class FilesManager
$aData = array_change_key_case($aData, CASE_UPPER);
$oProcessFiles->fromArray($aData, \BasePeer::TYPE_FIELDNAME);
$sDirectory = PATH_DATA_MAILTEMPLATES . $aData['PRO_UID'] . PATH_SEP . basename($aData['PRF_PATH']);
$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'])) {

View File

@@ -36,6 +36,19 @@ class ProcessDefinitionMigrator implements Importable, Exportable
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);
}
}
public function afterImport($data)
{
try {
//Workflow elements
$this->processes->createTaskRows($data['workflow']['tasks']);
$this->processes->createTaskUserRows($data['workflow']['taskusers']);
@@ -70,11 +83,6 @@ class ProcessDefinitionMigrator implements Importable, Exportable
}
}
public function afterImport($data)
{
// TODO: Implement afterImport() method.
}
public function beforeExport()
{
// TODO: Implement beforeExport() method.