HOR-477 Error al importar proceso y crear como copia del original

c Maintain process title avoid conflicts during process update.
This commit is contained in:
davidcallizaya
2016-03-20 11:59:19 -04:00
parent 3b26891aa3
commit 3234931bc4

View File

@@ -12,6 +12,11 @@ abstract class Importer
protected $filename = "";
protected $saveDir = "";
protected $metadata = array();
/**
* Title of the process before being updated/deleted.
* @var string
*/
protected $currentProcessTitle = "";
public static $affectedGroups = array();
const IMPORT_OPTION_OVERWRITE = "project.import.override";
@@ -165,7 +170,7 @@ abstract class Importer
case self::IMPORT_OPTION_OVERWRITE:
//Shouldn't generate new UID for all objects
$this->removeProject();
$name = $this->currentProcessTitle;
$generateUid = false;
break;
case self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW:
@@ -278,6 +283,10 @@ abstract class Importer
public function removeProject()
{
/* @var $process \Process */
$process = new \Process();
$process->load($this->metadata["uid"]);
$this->currentProcessTitle = $process->getProTitle();
$project = \ProcessMaker\Project\Adapter\BpmnWorkflow::load($this->metadata["uid"]);
$project->remove(true, false);
}