From d6977456923291c702bccac22ac5acefe977d735 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E8=BE=B0=E8=BD=A9?= Date: Thu, 11 Apr 2024 14:14:40 +0800 Subject: [PATCH] * Add branch param for project post api. --- api/v1/entries/projects.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/api/v1/entries/projects.php b/api/v1/entries/projects.php index 232657ff21..176fc4b090 100644 --- a/api/v1/entries/projects.php +++ b/api/v1/entries/projects.php @@ -75,7 +75,7 @@ class projectsEntry extends entry */ public function post() { - $fields = 'name,begin,end,products,desc,hasProduct'; + $fields = 'name,begin,end,products,branch,desc,hasProduct'; $this->batchSetPost($fields); if(isset($_POST['products']) and !isset($_POST['hasProduct'])) $_POST['hasProduct'] = true; @@ -89,6 +89,17 @@ class projectsEntry extends entry $this->setPost('model', $this->request('model', 'scrum')); $this->setPost('parent', $this->request('parent', 0)); + if(isset($_POST['branch'])) + { + $branches = $_POST['branch']; + foreach($branches as $key => $branch) + { + if(empty($branch)) unset($branches[$key]); + } + + $this->setPost('branch', $branches); + } + $control = $this->loadController('project', 'create'); $requireFields = 'name,begin,end,products';