HOR-3351
This commit is contained in:
@@ -39,7 +39,8 @@ try {
|
|||||||
if (sizeof($_GET['objects']) == 0) {
|
if (sizeof($_GET['objects']) == 0) {
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
$exporter = new ProcessMaker\Exporter\XmlExporter($_GET["pro_uid"]);
|
$exporter = new ProcessMaker\Exporter\XmlExporter($_GET["pro_uid"]);
|
||||||
$getProjectName = $exporter->truncateName($exporter->getProjectName(), false);
|
$projectName = $exporter->getProjectName();
|
||||||
|
$getProjectName = $exporter->truncateName($projectName, false);
|
||||||
|
|
||||||
$version = ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx") + 1;
|
$version = ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx") + 1;
|
||||||
$outputFilename = sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx");
|
$outputFilename = sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx");
|
||||||
@@ -48,8 +49,10 @@ try {
|
|||||||
}else{
|
}else{
|
||||||
$granularExporter = new \ProcessMaker\BusinessModel\Migrator\GranularExporter($_GET['pro_uid']);
|
$granularExporter = new \ProcessMaker\BusinessModel\Migrator\GranularExporter($_GET['pro_uid']);
|
||||||
$outputFilename = $granularExporter->export($_GET['objects']);
|
$outputFilename = $granularExporter->export($_GET['objects']);
|
||||||
|
$projectName = $granularExporter->getProjectName();
|
||||||
}
|
}
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
G::auditLog('ExportProcess','Export process "' . $projectName . '"');
|
||||||
} else {
|
} else {
|
||||||
$oProcess = new Processes();
|
$oProcess = new Processes();
|
||||||
$proFields = $oProcess->serializeProcess($_GET["pro_uid"]);
|
$proFields = $oProcess->serializeProcess($_GET["pro_uid"]);
|
||||||
@@ -57,6 +60,7 @@ try {
|
|||||||
$outputFilename = $result["FILENAME"];
|
$outputFilename = $result["FILENAME"];
|
||||||
|
|
||||||
rename($outputDir . $outputFilename . "tpm", $outputDir . $outputFilename);
|
rename($outputDir . $outputFilename . "tpm", $outputDir . $outputFilename);
|
||||||
|
G::auditLog('ExportProcess','Export process "' . $result["PRO_TITLE"] . '"');
|
||||||
}
|
}
|
||||||
$response->file_hash = base64_encode($outputFilename);
|
$response->file_hash = base64_encode($outputFilename);
|
||||||
$response->success = true;
|
$response->success = true;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class GranularExporter
|
|||||||
protected $generator;
|
protected $generator;
|
||||||
protected $data;
|
protected $data;
|
||||||
protected $prjuid;
|
protected $prjuid;
|
||||||
|
protected $prjName = '';
|
||||||
/**
|
/**
|
||||||
* GranularExporter constructor.
|
* GranularExporter constructor.
|
||||||
*/
|
*/
|
||||||
@@ -60,6 +61,7 @@ class GranularExporter
|
|||||||
$objectList = func_get_args()[0];
|
$objectList = func_get_args()[0];
|
||||||
$bpmnProject = Project\Bpmn::load($this->prjuid);
|
$bpmnProject = Project\Bpmn::load($this->prjuid);
|
||||||
$projectData = $bpmnProject->getProject();
|
$projectData = $bpmnProject->getProject();
|
||||||
|
$this->prjName = $projectData['PRJ_NAME'];
|
||||||
$getProjectName = $this->publisher->truncateName($projectData['PRJ_NAME'], false);
|
$getProjectName = $this->publisher->truncateName($projectData['PRJ_NAME'], false);
|
||||||
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
|
||||||
$version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx2") + 1;
|
$version = \ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx2") + 1;
|
||||||
@@ -184,4 +186,12 @@ class GranularExporter
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Get the project name
|
||||||
|
*/
|
||||||
|
public function getProjectName()
|
||||||
|
{
|
||||||
|
return $this->prjName;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -163,6 +163,9 @@ class Project extends Api
|
|||||||
PATH_SEP . $outputFilename;
|
PATH_SEP . $outputFilename;
|
||||||
$httpStream = new HttpStream();
|
$httpStream = new HttpStream();
|
||||||
$fileExtension = pathinfo($outputFilename, PATHINFO_EXTENSION);
|
$fileExtension = pathinfo($outputFilename, PATHINFO_EXTENSION);
|
||||||
|
|
||||||
|
\G::auditLog('ExportProcess','Export process "' . $granularExporter->getProjectName() . '"');
|
||||||
|
|
||||||
$httpStream->loadFromFile($outputFilename);
|
$httpStream->loadFromFile($outputFilename);
|
||||||
$httpStream->setHeader("Content-Type", "application/xml; charset=UTF-8");
|
$httpStream->setHeader("Content-Type", "application/xml; charset=UTF-8");
|
||||||
$httpStream->send();
|
$httpStream->send();
|
||||||
@@ -188,6 +191,8 @@ class Project extends Api
|
|||||||
$httpStream = new \ProcessMaker\Util\IO\HttpStream();
|
$httpStream = new \ProcessMaker\Util\IO\HttpStream();
|
||||||
$fileExtension = pathinfo($outputFilename, PATHINFO_EXTENSION);
|
$fileExtension = pathinfo($outputFilename, PATHINFO_EXTENSION);
|
||||||
|
|
||||||
|
\G::auditLog('ExportProcess','Export process "' . $exporter->getProjectName() . '"');
|
||||||
|
|
||||||
$httpStream->loadFromFile($outputFilename);
|
$httpStream->loadFromFile($outputFilename);
|
||||||
$httpStream->setHeader("Content-Type", "application/xml; charset=UTF-8");
|
$httpStream->setHeader("Content-Type", "application/xml; charset=UTF-8");
|
||||||
$httpStream->send();
|
$httpStream->send();
|
||||||
|
|||||||
Reference in New Issue
Block a user