MT-28 fices for import
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user