MT-28
This commit is contained in:
@@ -236,7 +236,8 @@ if (isset($_POST["PRO_FILENAME"]) &&
|
||||
$importer->setSourceFile(PATH_DOCUMENT . "input" . PATH_SEP . $_POST["PRO_FILENAME"]);
|
||||
|
||||
try {
|
||||
$prjUid = $importer->import($option, $optionGroup, null, $granularImport,$granularOptions);
|
||||
$objectsToImport = G::json_decode($_POST['objectsToImport']);
|
||||
$prjUid = $importer->import($option, $optionGroup, null, $objectsToImport);
|
||||
|
||||
G::LoadClass( 'Process' );
|
||||
$oProcess = new Process();
|
||||
|
||||
@@ -138,7 +138,8 @@ class GranularImporter
|
||||
}
|
||||
|
||||
/**
|
||||
* import
|
||||
* @param $objectList
|
||||
* @return array
|
||||
*/
|
||||
public function import($objectList)
|
||||
{
|
||||
@@ -158,4 +159,28 @@ class GranularImporter
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $objectList
|
||||
* @param bool|false $generateUid
|
||||
* @return array
|
||||
*/
|
||||
public function validateImportData($objectList, $generateUid = false)
|
||||
{
|
||||
try {
|
||||
if($generateUid == null){
|
||||
foreach ($objectList as $rowObject) {
|
||||
if($rowObject['name'] === 'PROCESSDEFINITION' && $rowObject['value'] == "replace"){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch (ExportException $e) {
|
||||
return array(
|
||||
'success' => false,
|
||||
'message' => $e->getMessage()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,10 +216,14 @@ abstract class Importer
|
||||
if ($objectsToImport !== '') {
|
||||
$granularObj = new \ProcessMaker\BusinessModel\Migrator\GranularImporter();
|
||||
$objectList = $granularObj->loadObjectsListSelected($this->importData, $objectsToImport);
|
||||
if (sizeof($objectList) > 0) {
|
||||
$processGranulate = $granularObj->validateImportData($objectList, $generateUidFromJs);
|
||||
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');
|
||||
}
|
||||
return $this->importData['tables']['bpmn']["project"][0]["prj_uid"];
|
||||
|
||||
}
|
||||
|
||||
$result = $this->doImport($generateUid);
|
||||
|
||||
Reference in New Issue
Block a user