* Finish task#42097

This commit is contained in:
zenggang
2021-09-04 11:22:41 +08:00
parent 99a60c1954
commit 7c73fd04ea
2 changed files with 7 additions and 2 deletions
+5 -1
View File
@@ -24,6 +24,7 @@ class riskEntry extends Entry
public function put($riskID)
{
$oldRisk = $this->loadModel('risk')->getByID($riskID);
if(!$oldRisk) return $this->send404();
/* Set $_POST variables. */
$fields = 'source,name,category,strategy,status,impact,probability,rate,identifiedDate,plannedClosedDate,actualClosedDate,resolvedBy,assignedTo,prevention,remedy,resolution';
@@ -32,7 +33,9 @@ class riskEntry extends Entry
$control = $this->loadController('risk', 'edit');
$control->edit($riskID);
$this->getData();
$data = $this->getData();
if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message);
$risk = $this->risk->getByID($riskID);
$this->send(200, $this->format($risk, 'createdDate:time,editedDate:time'));
}
@@ -42,6 +45,7 @@ class riskEntry extends Entry
$control = $this->loadController('risk', 'delete');
$control->delete($riskID, 'true');
$this->getData();
$this->sendSuccess(200, 'success');
}
}
+2 -1
View File
@@ -43,7 +43,8 @@ class risksEntry extends entry
public function post($projectID = 0)
{
if((int)$projectID <= 0) return $this->sendError(400, 'The id of project is wrong.');
$project = $this->loadModel('project')->getByID($projectID);
if(!$project) return $this->send404();
$fields = 'source,name,category,strategy,status,impact,probability,rate,identifiedDate,plannedClosedDate,actualClosedDate,resolvedBy,assignedTo,prevention,remedy,resolution';
$this->batchSetPost($fields);