From f20b3dd48a28a8d67e2915f581ef02136de53d9a Mon Sep 17 00:00:00 2001 From: Gustavo Adolfo Cruz Laura Date: Sat, 2 Apr 2016 10:57:56 -0400 Subject: [PATCH 1/2] MT-85: The same validation has been added to the keep uid process. --- .../Migrator/GranularImporter.php | 13 ++- workflow/engine/templates/processes/main.js | 83 +++++++++++++------ 2 files changed, 61 insertions(+), 35 deletions(-) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularImporter.php b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularImporter.php index d256a4286..0f71e166d 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularImporter.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/Migrator/GranularImporter.php @@ -182,16 +182,13 @@ class GranularImporter * @return bool * @throws \Exception */ - public function validateImportData($objectList, $generateUid = false) + public function validateImportData($objectList) { try { - - if ($generateUid) { - if (count($objectList) !== count($this->exportObjects->getObjectsList())) { - $exception = new ImportException(); - $exception->setNameException(\G::LoadTranslation('ID_PROCESS_DEFINITION_INCOMPLETE')); - throw($exception); - } + 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) { diff --git a/workflow/engine/templates/processes/main.js b/workflow/engine/templates/processes/main.js index 7537024d7..437d6494a 100755 --- a/workflow/engine/templates/processes/main.js +++ b/workflow/engine/templates/processes/main.js @@ -8,6 +8,9 @@ var processesGrid, winDesigner, newTypeProcess, affectedGroups, + exportButton, + exportMenu, + exportComponent, processObjectsArray; /** @@ -23,6 +26,56 @@ importProcessGlobal.isGranularImport = false; importProcessGlobal.objectGranularImport; importProcessGlobal.objectsToImport = []; +exportButton = { + id: "export", + disabled: true, + text: _("ID_EXPORT"), + iconCls: "silk-add", + icon: "/images/export.png", + handler: function () { + exportProcess(); + } +}; +/*----------------------------------********---------------------------------*/ +/**Begin enterprise export component**/ +exportMenu = { + xtype: "tbsplit", + id: "export", + disabled: true, + text: _("ID_EXPORT"), + iconCls: "silk-add", + icon: "/images/export.png", + menu: [ + { + text: _("ID_NORMAL_EXPORT"), + iconCls: "silk-add", + icon: "", + handler: function () + { + exportProcess(); + } + }, { + text: _("ID_GRANULAR_EXPORT"), + iconCls: "silk-add", + icon: "", + handler: function () + { + exportImportProcessObjects('export'); + } + } + ] +}; +/**End enterprise export component**/ +/*----------------------------------********---------------------------------*/ + +exportComponent = exportButton; + +/*----------------------------------********---------------------------------*/ +/**Begin enterprise component assignment**/ +exportComponent = exportMenu; +/**End enterprise component assignment**/ +/*----------------------------------********---------------------------------*/ + new Ext.KeyMap(document, { key: Ext.EventObject.F5, fn: function(keycode, e) { @@ -355,33 +408,9 @@ Ext.onReady(function(){ handler:deleteProcess },{ xtype: 'tbseparator' - },{ - xtype: "tbsplit", - id: "export", - disabled: true, - text: _("ID_EXPORT"), - iconCls: "silk-add", - icon: "/images/export.png", - menu: [ - { - text: _("ID_NORMAL_EXPORT"), - iconCls: "silk-add", - icon: "", - handler: function () - { - exportProcess(); - } - }, { - text: _("ID_GRANULAR_EXPORT"), - iconCls: "silk-add", - icon: "", - handler: function () - { - exportImportProcessObjects('export'); - } - } - ] - },{ + }, + exportComponent + ,{ text: _('ID_IMPORT'), iconCls: 'silk-add', icon: '/images/import.gif', From 92fadecf9b372b09377f7c1a89e2a2263de1c847 Mon Sep 17 00:00:00 2001 From: Gustavo Adolfo Cruz Laura Date: Sat, 2 Apr 2016 11:05:12 -0400 Subject: [PATCH 2/2] MT-85: The same validation has been added to the keep uid process. --- .../src/ProcessMaker/Importer/Importer.php | 2 +- workflow/engine/templates/processes/main.js | 83 ++++++------------- 2 files changed, 28 insertions(+), 57 deletions(-) diff --git a/workflow/engine/src/ProcessMaker/Importer/Importer.php b/workflow/engine/src/ProcessMaker/Importer/Importer.php index 26ca21058..438bfff06 100755 --- a/workflow/engine/src/ProcessMaker/Importer/Importer.php +++ b/workflow/engine/src/ProcessMaker/Importer/Importer.php @@ -234,7 +234,7 @@ abstract class Importer $granularObj = new \ProcessMaker\BusinessModel\Migrator\GranularImporter(); $newObjectArray = $objectsToImport; $projectUid = $this->importData['tables']['bpmn']["project"][0]["prj_uid"]; - $processGranulate = $granularObj->validateImportData($objectsToImport, $generateUid); + $processGranulate = $granularObj->validateImportData($objectsToImport); if($generateUid){ $result = $granularObj->regenerateAllUids($this->importData, $generateUid); $this->importData = $result['data']; diff --git a/workflow/engine/templates/processes/main.js b/workflow/engine/templates/processes/main.js index 437d6494a..7537024d7 100755 --- a/workflow/engine/templates/processes/main.js +++ b/workflow/engine/templates/processes/main.js @@ -8,9 +8,6 @@ var processesGrid, winDesigner, newTypeProcess, affectedGroups, - exportButton, - exportMenu, - exportComponent, processObjectsArray; /** @@ -26,56 +23,6 @@ importProcessGlobal.isGranularImport = false; importProcessGlobal.objectGranularImport; importProcessGlobal.objectsToImport = []; -exportButton = { - id: "export", - disabled: true, - text: _("ID_EXPORT"), - iconCls: "silk-add", - icon: "/images/export.png", - handler: function () { - exportProcess(); - } -}; -/*----------------------------------********---------------------------------*/ -/**Begin enterprise export component**/ -exportMenu = { - xtype: "tbsplit", - id: "export", - disabled: true, - text: _("ID_EXPORT"), - iconCls: "silk-add", - icon: "/images/export.png", - menu: [ - { - text: _("ID_NORMAL_EXPORT"), - iconCls: "silk-add", - icon: "", - handler: function () - { - exportProcess(); - } - }, { - text: _("ID_GRANULAR_EXPORT"), - iconCls: "silk-add", - icon: "", - handler: function () - { - exportImportProcessObjects('export'); - } - } - ] -}; -/**End enterprise export component**/ -/*----------------------------------********---------------------------------*/ - -exportComponent = exportButton; - -/*----------------------------------********---------------------------------*/ -/**Begin enterprise component assignment**/ -exportComponent = exportMenu; -/**End enterprise component assignment**/ -/*----------------------------------********---------------------------------*/ - new Ext.KeyMap(document, { key: Ext.EventObject.F5, fn: function(keycode, e) { @@ -408,9 +355,33 @@ Ext.onReady(function(){ handler:deleteProcess },{ xtype: 'tbseparator' - }, - exportComponent - ,{ + },{ + xtype: "tbsplit", + id: "export", + disabled: true, + text: _("ID_EXPORT"), + iconCls: "silk-add", + icon: "/images/export.png", + 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', icon: '/images/import.gif',