* Add api for close bug and confirm bug.

This commit is contained in:
zhengrunyu
2022-03-30 10:01:28 +08:00
committed by hufangzhou
parent 1bc250a4b3
commit c047d2b422
6 changed files with 94 additions and 4 deletions
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* The bug close entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
**/
class bugCloseEntry extends Entry
{
/**
* POST method.
*
* @param int $bugID
* @access public
* @return void
*/
public function post($bugID)
{
$story = $this->loadModel('bug')->getByID($bugID);
$fields = 'comment';
$this->batchSetPost($fields);
$control = $this->loadController('bug', 'close');
$control->close($bugID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$bug = $this->bug->getByID($bugID);
$this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList'));
}
}
+40
View File
@@ -0,0 +1,40 @@
<?php
/**
* The bug confirm entry point of ZenTaoPMS.
*
* @copyright Copyright 2009-2021 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package entries
* @version 1
* @link http://www.zentao.net
*/
class bugConfirmEntry extends Entry
{
/**
* POST method.
*
* @param int $bugID
* @access public
* @return void
**/
public function post($bugID)
{
$bug = $this->loadModel('bug')->getById($bugID);
$fields = 'assignedTo,mailto,comment,pri,type';
$this->batchSetPost($fields);
$control = $this->loadController('bug', 'confirmBug');
$control->confirmBug($bugID);
$data = $this->getData();
if(!$data) return $this->send400('error');
if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message);
$bug = $this->bug->getById($bugID);
$this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList'));
}
}
+1 -1
View File
@@ -61,7 +61,7 @@ class storyEntry extends Entry
foreach($executionTasks as $task)
{
if(!isset($data->data->executions->{$task->execution})) continue;
$storyTasks[] = $this->filterFields($task, 'id,name,type,status');
$storyTasks[] = $this->filterFields($task, 'id,name,type,status,assignedTo');
}
}
$story->tasks = $storyTasks;
+1 -1
View File
@@ -20,7 +20,7 @@ class storyAssignToEntry extends Entry
*/
public function post($storyID)
{
$task = $this->loadModel('story')->getByID($storyID);
$story = $this->loadModel('story')->getByID($storyID);
$fields = 'assignedTo';
$this->batchSetPost($fields);
+3
View File
@@ -60,6 +60,9 @@ $routes['/projects/:id/bugs'] = 'projectBugs';
$routes['/executions/:id/bugs'] = 'executionBugs';
$routes['/bugs'] = 'bugs';
$routes['/bugs/:id'] = 'bug';
$routes['/bugs/:id/close'] = 'bugClose';
$routes['/bugs/:id/assign'] = 'bugAssign';
$routes['/bugs/:id/confirm'] = 'bugConfirm';
$routes['/programs/:id/projects'] = 'projects';
$routes['/products/:id/projects'] = 'productProjects';
+9 -2
View File
@@ -1259,7 +1259,14 @@ class bug extends control
return print(js::closeModal('parent.parent'));
}
}
return print(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent'));
if(defined('RUN_MODE') && RUN_MODE == 'api')
{
return $this->send(array('status' => 'success', 'data' => $bugID));
}
else
{
return print(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent'));
}
}
if($this->app->tab == 'project')
@@ -1710,7 +1717,7 @@ class bug extends control
}
if(defined('RUN_MODE') && RUN_MODE == 'api')
{
return print(array('status' => 'success', 'data' => $bugID));
return $this->send(array('status' => 'success', 'data' => $bugID));
}
else
{