Merge remote-tracking branch 'upstream/MT-10' into MT-10

This commit is contained in:
Gustavo Adolfo Cruz Laura
2016-03-28 14:49:40 -04:00
13 changed files with 157 additions and 28 deletions

View File

@@ -3131,6 +3131,50 @@ class Processes
}
}
/**
* @param $sProUid
* @return mixed
* @throws Exception
*/
public function getReportTables($sProUid)
{
try {
$additionalTables = new AdditionalTables();
$getalldditionalTables = $additionalTables->getReportTables($sProUid);
return $getalldditionalTables;
} catch (Exception $oError) {
throw $oError;
}
}
/**
* @param $sProUid
* @return mixed
* @throws Exception
*/
public function getReportTablesVar($sProUid)
{
try {
$fieldsReportTables = array();
$additionalTables = new AdditionalTables();
$getalldditionalTables = $additionalTables->getReportTables($sProUid);
foreach ($getalldditionalTables as $row) {
$additionalTables->setAddTabUid($row['ADD_TAB_UID']);
$fieldsAdditionalTables = $additionalTables->getFields();
foreach ($fieldsAdditionalTables as $rowField) {
$rowField['ADD_TAB_UID'] = $row['ADD_TAB_UID'];
array_push($fieldsReportTables, $rowField);
}
}
return $fieldsReportTables;
} catch (Exception $oError) {
throw $oError;
}
}
/**
* Get Report Tables Vars Rows for a Process
*
@@ -4045,6 +4089,29 @@ class Processes
}
}
/**
* Create if the new Files Managers does not exist
*
* @param string $processUid Unique id of Process
* @param array $arrayData Data
*
* return void
*/
public function addNewFilesManager($processUid, array $arrayData)
{
try {
$filesManager = new \ProcessMaker\BusinessModel\FilesManager();
foreach ($arrayData as $value) {
if(!$filesManager->existsProcessFile($value['PRF_UID'])){
$filesManager->addProcessFilesManagerInDb($value);
}
}
} catch (Exception $e) {
throw $e;
}
}
/**
* @param array $arrayData
* @throws Exception

View File

@@ -964,6 +964,31 @@ class AdditionalTables extends BaseAdditionalTables
}
}
/**
* @param $proUid
* @return array
*/
public function getReportTables($proUid)
{
$reportTables = array();
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID);
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION);
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TYPE);
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TAG);
$oCriteria->addSelectColumn(AdditionalTablesPeer::PRO_UID);
$oCriteria->addSelectColumn(AdditionalTablesPeer::DBS_UID);
$oCriteria->add(AdditionalTablesPeer::PRO_UID, $proUid, Criteria::EQUAL);
$dt = ContentPeer::doSelectRS($oCriteria);
$dt->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($dt->next()) {
$row = $dt->getRow();
array_push($reportTables, $row);
}
return $reportTables;
}
public function getAll($start = 0, $limit = 20, $filter = '', $process = null)
{
$oCriteria = new Criteria('workflow');

View File

@@ -33,9 +33,7 @@ try {
}
if (\BpmnProject::exists($_GET["pro_uid"]) && isset($_GET['objects'])) {
$_GET["objects"] = \G::json_decode($_GET['objects']);
$exportObjects = new \ProcessMaker\BusinessModel\Migrator\ExportObjects();
$getListObject = \G::json_decode($exportObjects->objectList());
if(sizeof($getListObject->data) === sizeof($_GET['objects'])){
if(sizeof($_GET['objects']) == 0 || '' == trim($_GET['objects']) ){
$exporter = new ProcessMaker\Exporter\XmlExporter($_GET["pro_uid"]);
$getProjectName = $exporter->truncateName($exporter->getProjectName(),false);

View File

@@ -250,13 +250,13 @@ 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']);
$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']);
}

View File

@@ -66,8 +66,8 @@ class AssignmentRulesMigrator implements Importable, Exportable
{
try {
$oAssignRules = new \StdClass();
$oAssignRules->tasks = $this->processes->getTaskRows($prj_uid);
$oAssignRules->taskusers = $this->processes->getTaskUserRows($oAssignRules->tasks);
$oAssignRulesTasks = $this->processes->getTaskRows($prj_uid);
$oAssignRules->taskusers = $this->processes->getTaskUserRows($oAssignRulesTasks);
$result = array(
'workflow-definition' => (array)$oAssignRules

View File

@@ -32,7 +32,7 @@ class FilesMigrator implements Importable, Exportable
try {
$aTable = $data['TABLE'];
foreach ($aTable as $value) {
if ($value['PRF_EDITABLE'] !== 1) {
if ($value['PRF_EDITABLE'] === '0') {
if ($replace) {
$this->processes->createFilesManager($value['PRO_UID'], array($value));
} else {
@@ -92,7 +92,7 @@ class FilesMigrator implements Importable, Exportable
$fileHandler = new FileHandler();
$arrayPublicFileToExclude = $fileHandler->getFilesToExclude($prj_uid);
$workflowFile = $fileHandler->getTemplatesOrPublicFiles($prj_uid, $arrayPublicFileToExclude, 'public');
$workflowFile = $fileHandler->getTemplatesOrPublicFiles($prj_uid, $arrayPublicFileToExclude, 'PUBLIC');
$result = array(
'workflow-definition' => (array)$oData,

View File

@@ -148,7 +148,7 @@ class GranularImporter
$objClass = $this->factory->create($data['name']);
if (is_object($objClass)) {
$dataImport = $data['data'][$data['name']];
$replace = ($data['value'] == 'merge') ? true : false;
$replace = ($data['value'] == 'replace') ? true : false;
$migratorData = $objClass->import($dataImport, $replace);
}
}

View File

@@ -68,10 +68,8 @@ class ProcessDefinitionMigrator implements Importable, Exportable
$bpmnStruct["LANESET"] = \BpmnLaneset::getAll($prj_uid);
$bpmnStruct["PARTICIPANT"] = \BpmnParticipant::getAll($prj_uid);
$bpmnStruct["PROCESS"] = \BpmnProcess::getAll($prj_uid);
$bpmnStruct["PROJECT"] = array(\BpmnProjectPeer::retrieveByPK($prj_uid)->toArray());
$oData = new \StdClass();
$oData->process = $this->processes->getProcessRow($prj_uid, false);
$oData->tasks = $this->processes->getTaskRows($prj_uid);
$oDataTask = new \StdClass();
@@ -83,7 +81,6 @@ class ProcessDefinitionMigrator implements Importable, Exportable
$oData->steps = $this->processes->getStepRows($prj_uid);
$oData->groupwfs = $this->processes->getGroupwfRows($oDataTask->taskusers);
$oData->steptriggers = $this->processes->getStepTriggerRows($oData->tasks);
$oData->reportTablesVars = $this->processes->getReportTablesVarsRows($prj_uid);
$oData->subProcess = $this->processes->getSubProcessRow($prj_uid);
$oData->caseTracker = $this->processes->getCaseTrackerRow($prj_uid);
$oData->caseTrackerObject = $this->processes->getCaseTrackerObjectRow($prj_uid);

View File

@@ -56,7 +56,8 @@ class ReportTablesMigrator implements Importable, Exportable
{
try {
$oData = new \StdClass();
$oData->reportTables = $this->processes->getReportTablesRows($prj_uid);
$oData->reportTables = $this->processes->getReportTables($prj_uid);
$oData->reportTablesVars = $this->processes->getReportTablesVar($prj_uid);
$result = array(
'workflow-definition' => (array)$oData

View File

@@ -32,7 +32,7 @@ class TemplatesMigrator implements Importable, Exportable
try {
$aTable = $data['TABLE'];
foreach ($aTable as $value) {
if ($value['PRF_EDITABLE'] === 1) {
if ($value['PRF_EDITABLE'] === '1') {
if ($replace) {
$this->processes->createFilesManager($value['PRO_UID'], array($value));
} else {
@@ -43,7 +43,7 @@ class TemplatesMigrator implements Importable, Exportable
$aPath = $data['PATH'];
foreach ($aPath as $target => $files) {
$basePath = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'mailTemplates' . PATH_SEP;
if (strtoupper($target) === 'TEMPLATES') {
if (strtoupper($target) === 'TEMPLATE') {
foreach ($files as $file) {
$filename = $basePath . ((isset($file["file_path"])) ? $file["file_path"] : $file["filepath"]);
$path = dirname($filename);

View File

@@ -58,9 +58,7 @@ class TriggersMigrator implements Importable, Exportable
{
try {
$oData = new \StdClass();
$oDataTasks = $this->processes->getTaskRows($prj_uid);
$oData->triggers = $this->processes->getTriggerRows($prj_uid);
$oData->steptriggers = $this->processes->getStepTriggerRows($oDataTasks);
$result = array(
'workflow-definition' => (array)$oData

View File

@@ -173,8 +173,12 @@ abstract class Importer
if($objectsToImport === ''){
$this->removeProject();
} else {
if(in_array('PROCESSDEFINITION', $objectsToImport)){
$this->removeProject();
$granularObj = new \ProcessMaker\BusinessModel\Migrator\GranularImporter();
$objectList = $granularObj->loadObjectsListSelected($this->importData, $objectsToImport);
foreach ($objectList as $rowObject) {
if($rowObject['name'] === 'PROCESSDEFINITION'){
$this->removeProject();
}
}
}
$name = $this->currentProcessTitle;

View File

@@ -356,14 +356,31 @@ Ext.onReady(function(){
},{
xtype: 'tbseparator'
},{
xtype: "tbsplit",
id: "export",
disabled: true,
text: _("ID_EXPORT"),
iconCls: "silk-add",
icon: "/images/export.png",
handler: function () {
exportImportProcessObjects('export');
}
menu: [
{
text: _("ID_NORMAL_EXPORT"),
iconCls: "silk-add",
icon: "",
handler: function ()
{
exportProcess();
}
},{
text: _("ID_GRANULAR_EXPORT"),
iconCls: "silk-add",
icon: "",
handler: function ()
{
exportImportProcessObjects('export');
}
}
]
},{
text: _('ID_IMPORT'),
iconCls: 'silk-add',
@@ -519,9 +536,27 @@ Ext.onReady(function(){
{
text: _("ID_EXPORT"),
icon: "/images/export.png",
handler: function ()
{
exportImportProcessObjects('export');
menu: {
showSeparator: false,
items: [
{
text: _("ID_NORMAL_EXPORT"),
iconCls: "silk-add",
icon: "",
handler: function ()
{
exportProcess();
}
},{
text: _("ID_GRANULAR_EXPORT"),
iconCls: "silk-add",
icon: "",
handler: function ()
{
exportImportProcessObjects('export');
}
}
]
}
},
{
@@ -922,7 +957,9 @@ function exportProcess() {
var record = processesGrid.getSelectionModel().getSelections();
if(record.length == 1) {
Ext.getCmp('exportProcessObjectsWindow').close();
if(Ext.getCmp('exportProcessObjectsWindow')) {
Ext.getCmp('exportProcessObjectsWindow').close();
}
var myMask = new Ext.LoadMask(Ext.getBody(), {msg: _("ID_LOADING")});
var proUid = record[0].get("PRO_UID");
@@ -2088,6 +2125,8 @@ function openWindowIfIE(pathDesigner) {
Ext.getCmp('windowBpmnOptionWindow').close();
if (Ext.getCmp('changeOrKeepUidsWindow'))
Ext.getCmp('changeOrKeepUidsWindow').close();
if (Ext.getCmp('exportProcessObjectsWindow'))
Ext.getCmp('exportProcessObjectsWindow').close();
processesGrid.store.reload();
nameTab = PM.Sessions.getCookie('PM-TabPrimary') + '_winDesigner';
if (winDesigner && winDesigner.closed === false) {