From 2a766d303e32a95716e624f7a524e0d968ae1995 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Mon, 21 Mar 2022 09:45:14 +0800 Subject: [PATCH 1/3] *Fix subtask 400 error. --- api/v1/entries/taskcomponent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/v1/entries/taskcomponent.php b/api/v1/entries/taskcomponent.php index 6921b7e5b1..50b83afef8 100644 --- a/api/v1/entries/taskcomponent.php +++ b/api/v1/entries/taskcomponent.php @@ -20,7 +20,7 @@ class taskComponentEntry extends Entry */ public function post($taskID) { - $fields = 'name,type,assignedTo,parent,estimate,story,module,pri,desc,estStarted,deadline'; + $fields = 'name,color,type,assignedTo,parent,estimate,story,module,pri,desc,estStarted,deadline'; $this->batchSetPost($fields); $fields = explode(',', $fields); From e0afdc8db323c3679e67fee038b9daeb13a4c882 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Mon, 21 Mar 2022 10:03:48 +0800 Subject: [PATCH 2/3] *Delete unneed API. --- api/v1/entries/builds.php | 1 + api/v1/entries/execution.php | 8 ++++++++ api/v1/entries/executionmembers.php | 25 ------------------------ api/v1/entries/executionstories.php | 1 - api/v1/entries/productplans.php | 1 - api/v1/entries/stories.php | 3 +-- api/v1/entries/storyrecall.php | 30 +++++++++++++++++++++++++++++ config/config.php | 2 +- config/routes.php | 1 + 9 files changed, 42 insertions(+), 30 deletions(-) delete mode 100644 api/v1/entries/executionmembers.php create mode 100644 api/v1/entries/storyrecall.php diff --git a/api/v1/entries/builds.php b/api/v1/entries/builds.php index 3709a0463c..e303c9a4e1 100644 --- a/api/v1/entries/builds.php +++ b/api/v1/entries/builds.php @@ -21,6 +21,7 @@ class buildsEntry extends entry public function get($projectID = 0) { if(empty($projectID)) $projectID = $this->param('project', 0); + if(empty($projectID)) return $this->sendError(400, "Need project id."); $control = $this->loadController('project', 'build'); $control->build($projectID, $this->param('type', 'all'), $this->param('param', 0), $this->param('order', 't1.date_desc,t1.id_desc')); diff --git a/api/v1/entries/execution.php b/api/v1/entries/execution.php index 306d6f374b..c5cffb4fc0 100644 --- a/api/v1/entries/execution.php +++ b/api/v1/entries/execution.php @@ -64,6 +64,14 @@ class executionEntry extends Entry { switch($field) { + case 'modules': + $control = $this->loadController('tree', 'browsetask'); + $control->browsetask($executionID); + $data = $this->getData(); + if(isset($data->status) and $data->status == 'success') + { + $execution->modules = $data->data->tree; + } case 'builds': $execution->builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,noterminate,nodone', $executionID, 'execution'); break; diff --git a/api/v1/entries/executionmembers.php b/api/v1/entries/executionmembers.php deleted file mode 100644 index 6b7a680b93..0000000000 --- a/api/v1/entries/executionmembers.php +++ /dev/null @@ -1,25 +0,0 @@ - - * @package entries - * @version 1 - * @link http://www.zentao.net - */ -class executionMembersEntry extends entry -{ - public function get($executionID = 0) - { - if(!$executionID) $executionID = $this->param('execution', 0); - if(empty($executionID)) return $this->sendError(400, 'Need execution id.'); - $members = $this->loadModel('execution')->getTeamMembers($executionID); - if(isset($members)) - { - foreach($members as $member) $result[] = $this->format($member, 'join:date'); - } - return $this->send(200, array('members' => $result)); - } -} diff --git a/api/v1/entries/executionstories.php b/api/v1/entries/executionstories.php index d2f74e1126..4f32cb527c 100644 --- a/api/v1/entries/executionstories.php +++ b/api/v1/entries/executionstories.php @@ -34,7 +34,6 @@ class executionStoriesEntry extends entry $result = array(); foreach($stories as $story) { - $story->name =$story->title; $result[] = $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'); } return $this->send(200, array('page' => $pager->pageID, 'total' => $pager->recTotal, 'limit' => $pager->recPerPage, 'stories' => $result)); diff --git a/api/v1/entries/productplans.php b/api/v1/entries/productplans.php index e903903f4c..f56cf3ae96 100644 --- a/api/v1/entries/productplans.php +++ b/api/v1/entries/productplans.php @@ -36,7 +36,6 @@ class productplansEntry extends entry foreach($plans as $plan) { - $plan->name = $plan->title; if($plan->parent > 0 and isset($result[$plan->parent])) { $parentPlan = $result[$plan->parent]; diff --git a/api/v1/entries/stories.php b/api/v1/entries/stories.php index d92f3ddd6e..9b11c8812a 100644 --- a/api/v1/entries/stories.php +++ b/api/v1/entries/stories.php @@ -35,7 +35,6 @@ class storiesEntry extends entry $result = array(); foreach($stories as $story) { - $story->name =$story->title; if(isset($story->children)) $story->children = array_values((array)$story->children); $result[] = $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'); } @@ -55,7 +54,7 @@ class storiesEntry extends entry if(!$productID and isset($this->requestBody->product)) $productID = $this->requestBody->product; if(!$productID) return $this->sendError(400, 'Need product id.'); - $fields = 'title,spec,verify,reviewer,type,plan,module,moduleOptionMenu,source,sourceNote,category,pri,estimate,mailto,keywords'; + $fields = 'title,spec,verify,reviewer,type,plan,module,moduleOptionMenu,source,sourceNote,category,pri,estimate,mailto,keywords,notifyemail'; $this->batchSetPost($fields); /* If reviewer is not post, set needNotReview. */ diff --git a/api/v1/entries/storyrecall.php b/api/v1/entries/storyrecall.php new file mode 100644 index 0000000000..e21be5918e --- /dev/null +++ b/api/v1/entries/storyrecall.php @@ -0,0 +1,30 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + */ +class storyRecallEntry extends Entry +{ + /** + * Recall method. + * + * @param int $storyID + * @access public + * @return void + */ + public function delete($storyID) + { + $control = $this->loadController('story', 'recall'); + $control->recall($storyID); + + $this->getData(); + $this->sendSuccess(200, 'success'); + } +} + diff --git a/config/config.php b/config/config.php index 6271d1a45d..b6b562c975 100644 --- a/config/config.php +++ b/config/config.php @@ -23,7 +23,7 @@ $config->cookieLife = time() + 2592000; // Cookie的生存时间。The co $config->timezone = 'Asia/Shanghai'; // 时区设置。 The time zone setting, for more see http://www.php.net/manual/en/timezones.php. $config->webRoot = ''; // URL根目录。 The root path of the url. $config->customSession = false; // 是否开启自定义session的存储路径。Whether custom the session save path. -$config->edition = 'open'; // 设置系统的edition,可选值:open|biz|max。Set edition, optional: open|biz|max. +$config->edition = 'max'; // 设置系统的edition,可选值:open|biz|max。Set edition, optional: open|biz|max. /* 框架路由相关设置。Routing settings. */ $config->requestType = 'PATH_INFO'; // 请求类型:PATH_INFO|PATHINFO2|GET。 The request type: PATH_INFO|PATH_INFO2|GET. diff --git a/config/routes.php b/config/routes.php index 7fa774b5af..37c0a8cf4d 100644 --- a/config/routes.php +++ b/config/routes.php @@ -50,6 +50,7 @@ $routes['/stories/:id/active'] = 'storyActive'; $routes['/stories/:id/assign'] = 'storyAssignto'; $routes['/stories/:id/recordEstimate'] = 'storyRecordEstimate'; $routes['/stories/:id/child'] = 'storyChild'; +$routes['/stories/:id/recall'] = 'storyRecall'; $routes['/module/:id/stories'] = 'moduleStories'; From 79ceb87679941e544f9dfd990123edb5b22fe074 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Mon, 21 Mar 2022 10:38:14 +0800 Subject: [PATCH 3/3] Rewrite get stories by execution and module API. --- api/v1/entries/modulestories.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/api/v1/entries/modulestories.php b/api/v1/entries/modulestories.php index 03a29b2f2f..16ac618148 100644 --- a/api/v1/entries/modulestories.php +++ b/api/v1/entries/modulestories.php @@ -15,16 +15,15 @@ class moduleStoriesEntry extends Entry { $executionID = $this->param('executionID', 0); if(empty($executionID)) return $this->sendError(400, 'Need execution id.'); - $control = $this->loadController('story', 'ajaxGetExecutionStories'); - $control->ajaxGetExecutionStories($executionID, $this->param('productID', 0), $this->param('branchID', 0), $moduleID); + + $control = $this->loadController('execution', 'story'); + $control->story($executionID, 'order_desc', 'byModule', $moduleID); $data = $this->getData(); - $this->loadModel('story'); + $result = []; - foreach($data as $storyID => $storyName) + foreach($data->data->stories as $story) { - if(empty($storyID)) continue; - $story = $this->story->getById($storyID); $result[] = $this->filterFields($story, 'id,title,module,pri,status,stage,estimate'); } return $this->send(200, array('stories' => $result));