Merged in bugfix/PMCORE-3552 (pull request #8330)
PMCORE-3552 Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
committed by
Julio Cesar Laura Avendaño
commit
1ae23462d1
@@ -222,7 +222,7 @@ abstract class Importer
|
||||
foreach ($objectList as $rowObject) {
|
||||
if ($rowObject['name'] === 'PROCESSDEFINITION') {
|
||||
$onlyDiagram = true;
|
||||
$this->removeProject($onlyDiagram);
|
||||
$this->removeProject($onlyDiagram, $objectsToImport);
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
@@ -453,7 +453,14 @@ abstract class Importer
|
||||
$project->setDisabled();
|
||||
}
|
||||
|
||||
public function removeProject($onlyDiagram = false)
|
||||
/**
|
||||
* Remove the project
|
||||
*
|
||||
* @param bool $onlyDiagram
|
||||
* @param array $objectsToImport
|
||||
* @return void
|
||||
*/
|
||||
public function removeProject($onlyDiagram = false, $objectsToImport = [])
|
||||
{
|
||||
/* @var $process \Process */
|
||||
$processes = new \Processes();
|
||||
@@ -464,7 +471,7 @@ abstract class Importer
|
||||
$process->load($this->metadata["uid"]);
|
||||
$this->currentProcessTitle = $process->getProTitle();
|
||||
$project = \ProcessMaker\Project\Adapter\BpmnWorkflow::load($this->metadata["uid"]);
|
||||
$project->remove(true, false, $onlyDiagram);
|
||||
$project->remove(true, false, $onlyDiagram, $objectsToImport);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1248,10 +1248,19 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
}
|
||||
}
|
||||
|
||||
public function remove($flagForceRemoveProject = false, $flagRemoveCases = true, $onlyDiagram = false)
|
||||
/**
|
||||
* Remove Project
|
||||
*
|
||||
* @param bool $flagForceRemoveProject
|
||||
* @param bool $flagRemoveCases
|
||||
* @param bool $onlyDiagram
|
||||
* @param array $objectsToImport
|
||||
* @return void
|
||||
*/
|
||||
public function remove($flagForceRemoveProject = false, $flagRemoveCases = true, $onlyDiagram = false, $objectsToImport = [])
|
||||
{
|
||||
parent::remove($flagForceRemoveProject);
|
||||
$this->wp->remove($flagRemoveCases, $onlyDiagram);
|
||||
$this->wp->remove($flagRemoveCases, $onlyDiagram, $objectsToImport);
|
||||
}
|
||||
|
||||
public static function createFromStruct(array $projectData, $generateUid = true, $allData = null)
|
||||
|
||||
@@ -2,20 +2,21 @@
|
||||
namespace ProcessMaker\Project;
|
||||
|
||||
use Criteria;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use ResultSet;
|
||||
|
||||
use ObjectPermissionPeer;
|
||||
use Process as ClassesProcess;
|
||||
use Tasks;
|
||||
use Task as ClassesTask;
|
||||
use ProcessMaker\Exception;
|
||||
use ProcessMaker\Model\ProcessCategory;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
use ProcessMaker\Util;
|
||||
use ProcessMaker\Util\Common;
|
||||
use ProcessUserPeer;
|
||||
use ReportTables;
|
||||
use ResultSet;
|
||||
use Route;
|
||||
use RoutePeer;
|
||||
|
||||
use ProcessMaker\Model\ProcessCategory;
|
||||
use ProcessMaker\Util\Common;
|
||||
use ProcessMaker\Exception;
|
||||
use ProcessMaker\Util;
|
||||
use ReportTables;
|
||||
use StepSupervisorPeer;
|
||||
use Tasks;
|
||||
use Task as ClassesTask;
|
||||
|
||||
/**
|
||||
* Class Workflow
|
||||
@@ -115,11 +116,20 @@ class Workflow extends Handler
|
||||
$process->update($data);
|
||||
}
|
||||
|
||||
public function remove($flagRemoveCases = true, $onlyDiagram = false)
|
||||
/**
|
||||
* Remove project
|
||||
*
|
||||
* @param bool $flagRemoveCases
|
||||
* @param bool $onlyDiagram
|
||||
* @param array $objectsToImport
|
||||
* @return void
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function remove($flagRemoveCases = true, $onlyDiagram = false, $objectsToImport = [])
|
||||
{
|
||||
try {
|
||||
self::log("Remove Process with uid: {$this->proUid}");
|
||||
$this->deleteProcess($this->proUid, $flagRemoveCases, $onlyDiagram);
|
||||
$this->deleteProcess($this->proUid, $flagRemoveCases, $onlyDiagram, $objectsToImport);
|
||||
self::log("Remove Process Success!");
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
@@ -579,7 +589,17 @@ class Workflow extends Handler
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteProcess($sProcessUID, $flagRemoveCases = true, $onlyDiagram = false)
|
||||
/**
|
||||
* Delete process
|
||||
*
|
||||
* @param string $sProcessUID
|
||||
* @param bool $flagRemoveCases
|
||||
* @param bool $onlyDiagram
|
||||
* @param array $objectsToImport
|
||||
* @return bool
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function deleteProcess($sProcessUID, $flagRemoveCases = true, $onlyDiagram = false, $objectsToImport = [])
|
||||
{
|
||||
try {
|
||||
|
||||
@@ -761,18 +781,24 @@ class Workflow extends Handler
|
||||
$oDataset->next();
|
||||
}
|
||||
}
|
||||
//Delete the supervisors
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(\ProcessUserPeer::PRO_UID, $sProcessUID);
|
||||
\ProcessUserPeer::doDelete($oCriteria);
|
||||
//Delete the object permissions
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(\ObjectPermissionPeer::PRO_UID, $sProcessUID);
|
||||
\ObjectPermissionPeer::doDelete($oCriteria);
|
||||
//Delete the step supervisors
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(\StepSupervisorPeer::PRO_UID, $sProcessUID);
|
||||
\StepSupervisorPeer::doDelete($oCriteria);
|
||||
if (array_search('SUPERVISORS', array_column($objectsToImport, 'id')) !== false || empty($objectsToImport)) {
|
||||
//Delete the supervisors
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(ProcessUserPeer::PRO_UID, $sProcessUID);
|
||||
ProcessUserPeer::doDelete($oCriteria);
|
||||
}
|
||||
if (array_search('PERMISSIONS', array_column($objectsToImport, 'id')) !== false || empty($objectsToImport)) {
|
||||
//Delete the object permissions
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(ObjectPermissionPeer::PRO_UID, $sProcessUID);
|
||||
ObjectPermissionPeer::doDelete($oCriteria);
|
||||
}
|
||||
if (array_search('SUPERVISORSOBJECTS', array_column($objectsToImport, 'id')) !== false || empty($objectsToImport)) {
|
||||
//Delete the step supervisors
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(StepSupervisorPeer::PRO_UID, $sProcessUID);
|
||||
StepSupervisorPeer::doDelete($oCriteria);
|
||||
}
|
||||
//Delete the report tables
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(\ReportTablePeer::PRO_UID, $sProcessUID);
|
||||
|
||||
Reference in New Issue
Block a user