MT-28 fices for import

This commit is contained in:
dheeyi
2016-03-24 12:48:58 -04:00
parent 1f9c3ae84f
commit c4d803b710
3 changed files with 10 additions and 6 deletions

View File

@@ -163,19 +163,20 @@ class GranularImporter
/**
* @param $objectList
* @param bool|false $generateUid
* @return array
* @return array|bool
*/
public function validateImportData($objectList, $generateUid = false)
{
try {
if($generateUid == null){
if($generateUid){
foreach ($objectList as $rowObject) {
if($rowObject['name'] === 'PROCESSDEFINITION' && $rowObject['value'] == "replace"){
return true;
}
}
return false;
}
return false;
return true;
} catch (ExportException $e) {
return array(
'success' => false,

View File

@@ -30,7 +30,7 @@ class ProcessDefinitionMigrator implements Importable, Exportable
if ($replace) {
$this->bpmn->createFromStruct($data, false);
} else {
$this->bpmn->updateFromStruct($data['PRJ_UID'], $data, false);
$this->bpmn->updateFromStruct($data['prj_uid'], $data, false);
}
} catch (\Exception $e) {
return $e->getMessage();

View File

@@ -216,12 +216,15 @@ abstract class Importer
if ($objectsToImport !== '') {
$granularObj = new \ProcessMaker\BusinessModel\Migrator\GranularImporter();
$objectList = $granularObj->loadObjectsListSelected($this->importData, $objectsToImport);
$processGranulate = $granularObj->validateImportData($objectList, $generateUidFromJs);
$processGranulate = $granularObj->validateImportData($objectList, $generateUid);
if (sizeof($objectList) > 0 && $processGranulate) {
$granularObj->import($objectList);
return $this->importData['tables']['bpmn']["project"][0]["prj_uid"];
}else{
return new \Exception('ERROR MERGE/REPLACE ERROR');
throw new \Exception('Select definition of process and replace option',
self::IMPORTED_PROJECT_DOES_NOT_EXISTS
);
return new \Exception();
}
}