add use library

remove use library
This commit is contained in:
hjonathan
2017-08-08 17:43:33 -04:00
parent e5337fb071
commit 5da1478fdb
2 changed files with 8 additions and 6 deletions

View File

@@ -34,7 +34,7 @@ use \ResultSet as ResultSet;
use \BpmnFlow; use \BpmnFlow;
use \G; use \G;
use ProcessMaker\Util\Common; use ProcessMaker\Util\Common;
use ProcessMaker\Exception; use \Exception;
/** /**
* Class Bpmn * Class Bpmn
@@ -432,9 +432,8 @@ class Bpmn extends Handler
if (isset($activity)) { if (isset($activity)) {
$activity->delete(); $activity->delete();
BpmnFlow::removeAllRelated($actUid); BpmnFlow::removeAllRelated($actUid);
} else { } else {
throw new \Exception(G::LoadTranslation("ID_ACTIVITY_DOES_NOT_EXIST", array("act_uid", $actUid))); throw new Exception(G::LoadTranslation("ID_ACTIVITY_DOES_NOT_EXIST", array("act_uid", $actUid)));
} }
self::log("Remove Activity Success!"); self::log("Remove Activity Success!");
} catch (\Exception $e) { } catch (\Exception $e) {

View File

@@ -3,6 +3,9 @@ namespace ProcessMaker\Services\Api\Project;
use \ProcessMaker\Services\Api; use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException; use \Luracast\Restler\RestException;
use ProcessMaker\Project\Adapter\BpmnWorkflow;
use ProcessMaker\BusinessModel\Task;
use \Exception;
/** /**
* Project\Activity Api Controller * Project\Activity Api Controller
@@ -147,19 +150,19 @@ class Activity extends Api
public function doDeleteProjectActivity($prj_uid, $act_uid) public function doDeleteProjectActivity($prj_uid, $act_uid)
{ {
try { try {
$task = new \ProcessMaker\BusinessModel\Task(); $task = new Task();
$task->setFormatFieldNameInUppercase(false); $task->setFormatFieldNameInUppercase(false);
$task->setArrayParamException(array("taskUid" => "act_uid")); $task->setArrayParamException(array("taskUid" => "act_uid"));
$response = $task->hasPendingCases(array("act_uid" => $act_uid, "case_type" => "assigned")); $response = $task->hasPendingCases(array("act_uid" => $act_uid, "case_type" => "assigned"));
if ($response->result !== false) { if ($response->result !== false) {
$project = new \ProcessMaker\Project\Adapter\BpmnWorkflow(); $project = new BpmnWorkflow();
$prj = $project->load($prj_uid); $prj = $project->load($prj_uid);
$prj->removeActivity($act_uid); $prj->removeActivity($act_uid);
} else { } else {
throw new RestException(403, $response->message); throw new RestException(403, $response->message);
} }
} catch (\Exception $e) { } catch (Exception $e) {
$resCode = $e->getCode() == 0 ? Api::STAT_APP_EXCEPTION : $e->getCode(); $resCode = $e->getCode() == 0 ? Api::STAT_APP_EXCEPTION : $e->getCode();
throw new RestException($resCode, $e->getMessage()); throw new RestException($resCode, $e->getMessage());
} }