diff --git a/api/v1/entries/product.php b/api/v1/entries/product.php index e69de29bb2..9497c564c7 100644 --- a/api/v1/entries/product.php +++ b/api/v1/entries/product.php @@ -0,0 +1,48 @@ +loadController('product', 'view'); + $control->view($productID); + + $data = $this->getData(); + if(isset($data->status) and $data->status == 'success') return $this->send(200, $data->data->product); + if(isset($data->status) and $data->status == 'fail') return $this->sendError(400, $data->message); + + $this->sendError(400, 'error'); + } + + public function put($productID) + { + $oldProduct = $this->loadModel('product')->getByID($productID); + + /* Set $_POST variables. */ + $fields = 'program,line,name,PO,QD,RD,type,desc,whitelist,status,acl'; + $this->batchSetPost($fields, $oldProduct); + + $control = $this->loadController('product', 'edit'); + $control->edit($productID); + + $data = $this->getData(); + if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message); + + $this->sendSuccess(200, 'success'); + } + + public function delete($productID) + { + $control = $this->loadController('product', 'delete'); + $control->delete($productID, 'yes'); + + $this->getData(); + $this->sendSuccess(200, 'success'); + } +} diff --git a/api/v1/entries/products.php b/api/v1/entries/products.php index e69de29bb2..0703b7c131 100644 --- a/api/v1/entries/products.php +++ b/api/v1/entries/products.php @@ -0,0 +1,49 @@ +loadController('product', 'all'); + $control->all(); + $data = $this->getData(); + + if(isset($data->status) and $data->status == 'success') + { + return $this->send(200, $data->data->productStats); + } + if(isset($data->status) and $data->status == 'fail') + { + return $this->sendError(400, $data->message); + } + + return $this->sendError(400, 'error'); + } + + public function post() + { + $fields = 'program,line,name,PO,QD,RD,type,desc,whitelist'; + $this->batchSetPost($fields); + + $this->setPost('acl', $this->request('acl', 'private')); + $this->setPost('whitelist', $this->request('whitelist', array())); + + $control = $this->loadController('product', 'create'); + $this->requireFields('name,program'); + + $control->create($this->request('program')); + + $data = $this->getData(); + if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message); + + $product = $this->loadModel('product')->getByID($data->id); + + $this->send(200, $product); + } +} diff --git a/api/v1/entries/stories.php b/api/v1/entries/stories.php new file mode 100644 index 0000000000..a2a3da5a12 --- /dev/null +++ b/api/v1/entries/stories.php @@ -0,0 +1,57 @@ +loadController('product', 'browse'); + $control->browse($productID); + $data = $this->getData(); + + if(isset($data->status) and $data->status == 'success') + { + $stories = $data->data->stories; + $result = array(); + foreach($stories as $story) + { + $result[] = $story; + } + return $this->send(200, $result); + } + if(isset($data->status) and $data->status == 'fail') + { + return $this->sendError(400, $data->message); + } + + return $this->sendError(400, 'error'); + } + + public function post($productID) + { + $fields = 'title,spec,verify,reviewer,type'; + $this->batchSetPost($fields); + + /* If reviewer is not post, set needNotReview. */ + if(empty($this->request('reviewer'))) $this->setPost('needNotReview', 1); + $this->setPost('product', $productID); + + $control = $this->loadController('story', 'create'); + $this->requireFields('title,spec,type'); + + $control->create($productID); + + $data = $this->getData(); + if(isset($data->result) and $data->result == 'fail') return $this->sendError(400, $data->message); + if(isset($data->result) and !isset($data->id)) return $this->sendError(400, $data->message); + + $story = $this->loadModel('story')->getByID($data->id); + + $this->send(200, $story); + } +} diff --git a/api/v1/entries/story.php b/api/v1/entries/story.php new file mode 100644 index 0000000000..ff7dc0874e --- /dev/null +++ b/api/v1/entries/story.php @@ -0,0 +1,45 @@ +loadController('story', 'view'); + $control->view($storyID); + + $data = $this->getData(); + $story = $data->data->story; + $this->send(200, $story); + } + + public function put($storyID) + { + $oldStory = $this->loadModel('story')->getByID($storyID); + + /* Set $_POST variables. */ + $fields = 'type'; + $this->batchSetPost($fields, $oldStory); + $this->setPost('parent', 0); + + $control = $this->loadController('story', 'edit'); + $control->edit($storyID); + + $this->getData(); + $this->sendSuccess(200, 'success'); + } + + public function delete($storyID) + { + $control = $this->loadController('story', 'delete'); + $control->delete($storyID, 'yes'); + + $this->getData(); + $this->sendSuccess(200, 'success'); + } +} diff --git a/api/v1/entries/storychange.php b/api/v1/entries/storychange.php new file mode 100644 index 0000000000..50568500e1 --- /dev/null +++ b/api/v1/entries/storychange.php @@ -0,0 +1,39 @@ +loadModel('story')->getByID($storyID); + + $fields = 'reviewer,comment'; + $this->batchSetPost($fields); + $fields = 'title,spec,verify'; + $this->batchSetPost($fields, $oldStory); + + /* If reviewer is not post, set needNotReview. */ + if(empty($this->request('reviewer'))) + { + $this->setPost('reviewer', array()); + $this->setPost('needNotReview', 1); + } + + $control = $this->loadController('story', 'change'); + $this->requireFields('title,spec'); + + $control->change($storyID); + + $data = $this->getData(); + if($data->status == 'fail') return $this->sendError(400, $data->message); + + $story = $this->loadModel('story')->getByID($storyID); + + $this->send(200, $story); + } +} diff --git a/api/v1/entries/tasks.php b/api/v1/entries/tasks.php index a1df8a596f..de9a5a33c4 100644 --- a/api/v1/entries/tasks.php +++ b/api/v1/entries/tasks.php @@ -8,7 +8,7 @@ */ class tasksEntry extends entry { - public function get($taskID) + public function get() { } diff --git a/api/v1/entries/tokens.php b/api/v1/entries/tokens.php index b4d7732643..2d72658408 100644 --- a/api/v1/entries/tokens.php +++ b/api/v1/entries/tokens.php @@ -18,7 +18,7 @@ class tokensEntry extends baseEntry if($user) { $this->user->login($user); - $this->send(200, array('token' => session_id())); + $this->send(201, array('token' => session_id())); } $this->sendError(400, $this->app->lang->user->loginFailed); diff --git a/config/routes.php b/config/routes.php index 9d76ff8beb..f3fcee5dc2 100644 --- a/config/routes.php +++ b/config/routes.php @@ -17,6 +17,10 @@ $routes['/products/:id'] = 'product'; $routes['/productlines'] = 'productLines'; $routes['/productlines/:id'] = 'productLine'; +$routes['/products/:id/stories'] = 'stories'; +$routes['/stories/:id'] = 'story'; +$routes['/stories/:id/change'] = 'storyChange'; + $routes['/executions/:execution/tasks'] = 'tasks'; $routes['/tasks/:id'] = 'task'; $routes['/tasks/:id/assignto'] = 'taskAssignTo'; diff --git a/config/zentaopms.php b/config/zentaopms.php index 0b7db239c2..aebad39e09 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -251,6 +251,7 @@ $config->objectTables['webhook'] = TABLE_WEBHOOK; $config->objectTables['stakeholder'] = TABLE_STAKEHOLDER; $config->objectTables['job'] = TABLE_JOB; $config->objectTables['team'] = TABLE_TEAM; +$config->objectTables['pipeline'] = TABLE_PIPELINE; /* Program privs.*/ $config->programPriv = new stdclass(); diff --git a/module/action/config.php b/module/action/config.php index 479032c858..8319fefa2a 100755 --- a/module/action/config.php +++ b/module/action/config.php @@ -30,6 +30,7 @@ $config->action->objectNameFields['stakeholder'] = 'user'; $config->action->objectNameFields['budget'] = 'name'; $config->action->objectNameFields['job'] = 'name'; $config->action->objectNameFields['team'] = 'name'; +$config->action->objectNameFields['pipeline'] = 'name'; $config->action->commonImgSize = 870; diff --git a/module/action/lang/de.php b/module/action/lang/de.php index b61f9c8c03..5a67dedaa2 100644 --- a/module/action/lang/de.php +++ b/module/action/lang/de.php @@ -99,6 +99,7 @@ $lang->action->objectTypes['webhook'] = 'Webhook'; $lang->action->objectTypes['job'] = 'Job'; $lang->action->objectTypes['team'] = 'Team'; $lang->action->objectTypes['whitelist'] = 'Whitelist'; +$lang->action->objectTypes['pipeline'] = 'GitLib'; /* 用来描述操作历史记录。*/ $lang->action->desc = new stdclass(); diff --git a/module/action/lang/en.php b/module/action/lang/en.php index 2cee6ad09d..e3b3b3aee2 100755 --- a/module/action/lang/en.php +++ b/module/action/lang/en.php @@ -103,6 +103,7 @@ $lang->action->objectTypes['entry'] = 'Entry'; $lang->action->objectTypes['webhook'] = 'Webhook'; $lang->action->objectTypes['team'] = 'Team'; $lang->action->objectTypes['whitelist'] = 'Whitelist'; +$lang->action->objectTypes['pipeline'] = 'GitLib'; /* Used to describe operation history. */ $lang->action->desc = new stdclass(); diff --git a/module/action/lang/fr.php b/module/action/lang/fr.php index 7b4195db98..7555229f72 100644 --- a/module/action/lang/fr.php +++ b/module/action/lang/fr.php @@ -99,6 +99,7 @@ $lang->action->objectTypes['webhook'] = 'Webhook'; $lang->action->objectTypes['job'] = 'Job'; $lang->action->objectTypes['team'] = 'Team'; $lang->action->objectTypes['whitelist'] = 'Whitelist'; +$lang->action->objectTypes['pipeline'] = 'GitLib'; /* 用来描述操作历史记录。*/ $lang->action->desc = new stdclass(); diff --git a/module/action/lang/vi.php b/module/action/lang/vi.php index 2abefe6569..fe86495b31 100644 --- a/module/action/lang/vi.php +++ b/module/action/lang/vi.php @@ -99,6 +99,7 @@ $lang->action->objectTypes['webhook'] = 'Webhook'; $lang->action->objectTypes['job'] = 'Job'; $lang->action->objectTypes['team'] = 'Team'; $lang->action->objectTypes['whitelist'] = 'Whitelist'; +$lang->action->objectTypes['pipeline'] = 'GitLib'; /* Used to describe operation history. */ $lang->action->desc = new stdclass(); diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index d94e60c869..a328ca7951 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -103,6 +103,7 @@ $lang->action->objectTypes['entry'] = '应用'; $lang->action->objectTypes['webhook'] = 'Webhook'; $lang->action->objectTypes['team'] = '团队'; $lang->action->objectTypes['whitelist'] = '白名单'; +$lang->action->objectTypes['pipeline'] = 'GitLib'; /* 用来描述操作历史记录。*/ $lang->action->desc = new stdclass(); diff --git a/module/bug/control.php b/module/bug/control.php index 1c3b20fd13..48d82f598f 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -558,9 +558,13 @@ class bug extends control $this->view->showFields = $this->config->bug->custom->createFields; /* Set gitlabProjects. */ - $allGitlabs = $this->loadModel('gitlab')->getPairs(); - $gitlabProjects = $this->loadModel('gitlab')->getProjectsByExecution($executionID); - foreach($allGitlabs as $id => $name) if($id and !isset($gitlabProjects[$id])) unset($allGitlabs[$id]); + $this->loadModel('gitlab'); + $allGitlabs = $this->gitlab->getPairs(); + $gitlabProjects = $this->gitlab->getProjectsByExecution($executionID); + foreach($allGitlabs as $id => $name) + { + if($id and !isset($gitlabProjects[$id])) unset($allGitlabs[$id]); + } $this->view->gitlabList = $allGitlabs; $this->view->gitlabProjects = $gitlabProjects; @@ -1462,13 +1466,14 @@ class bug extends control $_POST = array(); $bugs = $this->bug->getByList($bugIDList); + $this->loadModel('gitlab'); foreach($bugs as $bugID => $bug) { - $relation = $this->loadModel('gitlab')->getRelationByObject('bug', $bugID); + $relation = $this->gitlab->getRelationByObject('bug', $bugID); if(!empty($relation)) { - $currentIssue = $this->loadModel('gitlab')->apiGetSingleIssue($relation->gitlabID, $relation->projectID, $relation->issueID); - if($currentIssue->state != 'closed') $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug); + $currentIssue = $this->gitlab->apiGetSingleIssue($relation->gitlabID, $relation->projectID, $relation->issueID); + if($currentIssue->state != 'closed') $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug); } if($bug->status != 'resolved') @@ -1555,8 +1560,9 @@ class bug extends control else { /* Delete related issue in gitlab. */ - $relation = $this->loadModel('gitlab')->getRelationByObject('bug', $bugID); - if(!empty($relation)) $this->loadModel('gitlab')->deleteIssue('bug', $bugID, $relation->issueID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('bug', $bugID); + if(!empty($relation)) $this->gitlab->deleteIssue('bug', $bugID, $relation->issueID); $this->bug->delete(TABLE_BUG, $bugID); if($bug->toTask != 0) diff --git a/module/bug/model.php b/module/bug/model.php index 5c26f44494..04176bfd6b 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -282,14 +282,14 @@ class bugModel extends model * @param object $bug * @param int $executionID * @access public - * @return int + * @return int|bool */ public function createBugFromGitlabIssue($bug, $executionID) { $bug->openedBy = $this->app->user->account; $bug->openedDate = helper::now(); // TODO(dingguodong) use from issue->created_at ? $bug->assignedDate = isset($bug->assignedTo) ? helper::now() : 0; - $bug->openedBuild = 1; + $bug->openedBuild = 'trunk'; $bug->story = 0; $bug->task = 0; $bug->pri = 3; @@ -368,7 +368,7 @@ class bugModel extends model */ public function checkDelayBug($bug) { - // Delayed or not?. + /* Delayed or not? */ if(!helper::isZeroDate($bug->deadline)) { if($bug->resolvedDate and !helper::isZeroDate($bug->resolvedDate)) @@ -677,8 +677,9 @@ class bugModel extends model if(!empty($bug)) { - $relation = $this->loadModel('gitlab')->getRelationByObject('bug', $bugID); - if($relation) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug, $bugID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('bug', $bugID); + if($relation) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug, $bugID); } return common::createChanges($oldBug, $bug); } @@ -803,8 +804,9 @@ class bugModel extends model $allChanges[$bugID] = common::createChanges($oldBug, $bug); /* update bug to gitlab issue. */ - $relation = $this->loadModel('gitlab')->getRelationByObject('bug', $bugID); - if($relation) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug, $bugID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('bug', $bugID); + if($relation) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug, $bugID); } else { @@ -857,12 +859,13 @@ class bugModel extends model } /* Update bugs. */ + $this->loadModel('gitlab'); foreach($activateBugs as $bugID => $bug) { if(!empty($bug)) { - $relation = $this->loadModel('gitlab')->getRelationByObject('bug', $bugID); - if($relation) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', (Object)$bug, $bugID); + $relation = $this->gitlab->getRelationByObject('bug', $bugID); + if($relation) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', (Object)$bug, $bugID); } $oldBug = $bugs[$bugID]; @@ -899,13 +902,14 @@ class bugModel extends model ->autoCheck() ->where('id')->eq($bugID)->exec(); - $relation = $this->loadModel('gitlab')->getRelationByObject('bug', $bugID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('bug', $bugID); $bug = $this->getById($bugID); // get full bug object to update issue. - $bug->assignee_id = $this->loadModel('gitlab')->getGitlabUserID($relation->gitlabID, $bug->assignedTo); + $bug->assignee_id = $this->gitlab->getGitlabUserID($relation->gitlabID, $bug->assignedTo); if($bug->assignee_id != '') { - // TODO(dingguodong) we should alert to operator when can not find the user, and the operator should reconfigure user binding. - $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug, $bugID); + /* TODO(dingguodong) we should alert to operator when can not find the user, and the operator should reconfigure user binding. */ + $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug, $bugID); } if(!dao::isError()) return common::createChanges($oldBug, $bug); @@ -952,6 +956,7 @@ class bugModel extends model { $now = helper::now(); $bugs = $this->getByList($bugIDList); + $this->loadModel('gitlab'); foreach($bugIDList as $bugID) { if($bugs[$bugID]->confirmed) continue; @@ -964,8 +969,8 @@ class bugModel extends model if(!empty($bug)) { - $relation = $this->loadModel('gitlab')->getRelationByObject('bug', $bugID); - if($relation) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug, $bugID); + $relation = $this->gitlab->getRelationByObject('bug', $bugID); + if($relation) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug, $bugID); } $this->dao->update(TABLE_BUG)->data($bug)->where('id')->eq($bugID)->exec(); @@ -1059,8 +1064,9 @@ class bugModel extends model /* Link bug to build and release. */ $this->linkBugToBuild($bugID, $bug->resolvedBuild); - $relation = $this->loadModel('gitlab')->getRelationByObject('bug', $bugID); - if($relation) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug, $bugID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('bug', $bugID); + if($relation) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug, $bugID); return common::createChanges($oldBug, $bug); } @@ -1192,8 +1198,9 @@ class bugModel extends model $this->executeHooks($bugID); /* batch resolve issure bugs.*/ - $relation = $this->loadModel('gitlab')->getRelationByObject('bug', $bugID); - if($relation) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug, $bugID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('bug', $bugID); + if($relation) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug, $bugID); $changes[$bugID] = common::createChanges($oldBug, $bug); } @@ -1254,8 +1261,9 @@ class bugModel extends model if(!empty($bug)) { - $relation = $this->loadModel('gitlab')->getRelationByObject('bug', $bugID); - if($relation) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug, $bugID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('bug', $bugID); + if($relation) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug, $bugID); } $bug->activatedCount += 1; @@ -1287,11 +1295,12 @@ class bugModel extends model $this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->where('id')->eq((int)$bugID)->exec(); - $relation = $this->loadModel('gitlab')->getRelationByObject('bug', $bugID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('bug', $bugID); if(!empty($relation)) { - $currentIssue = $this->loadModel('gitlab')->apiGetSingleIssue($relation->gitlabID, $relation->projectID, $relation->issueID); - if($currentIssue->state != 'closed') $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug, $bugID); + $currentIssue = $this->gitlab->apiGetSingleIssue($relation->gitlabID, $relation->projectID, $relation->issueID); + if($currentIssue->state != 'closed') $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $bug, $bugID); } return common::createChanges($oldBug, $bug); } diff --git a/module/common/model.php b/module/common/model.php index 2024d5b5e7..2505d9c363 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -1820,7 +1820,10 @@ EOD; { /* Get user program priv. */ if(!$this->app->session->project) return; - $program = $this->dao->findByID($this->app->session->project)->from(TABLE_PROJECT)->fetch(); + + $program = $this->dao->findByID($this->app->session->project)->from(TABLE_PROJECT)->fetch(); + if(empty($program)) return; + $programRights = $this->dao->select('t3.module, t3.method')->from(TABLE_GROUP)->alias('t1') ->leftJoin(TABLE_USERGROUP)->alias('t2')->on('t1.id = t2.`group`') ->leftJoin(TABLE_GROUPPRIV)->alias('t3')->on('t2.`group`=t3.`group`') diff --git a/module/execution/control.php b/module/execution/control.php index a4f501513b..b906888948 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2514,8 +2514,9 @@ class execution extends control foreach($storyIdList as $storyID) { /* Delete related issue in gitlab. */ - $relation = $this->loadModel('gitlab')->getRelationByObject('story', $storyID); - if(!empty($relation)) $this->loadModel('gitlab')->deleteIssue('story', $storyID, $relation->issueID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('story', $storyID); + if(!empty($relation)) $this->gitlab->deleteIssue('story', $storyID, $relation->issueID); $this->execution->unlinkStory($executionID, $storyID); } diff --git a/module/gitlab/lang/de.php b/module/gitlab/lang/de.php deleted file mode 100644 index 4e2c99ff52..0000000000 --- a/module/gitlab/lang/de.php +++ /dev/null @@ -1,19 +0,0 @@ -jenkins->common = 'Jenkins'; -$lang->jenkins->browse = 'Browse Jenkins'; -$lang->jenkins->create = 'Create Jenkins'; -$lang->jenkins->edit = 'Edit Jenkins'; -$lang->jenkins->delete = 'Delete'; -$lang->jenkins->confirmDelete = 'Do you want to delete this Jenkins server?'; - -$lang->jenkins->id = 'ID'; -$lang->jenkins->name = 'Name'; -$lang->jenkins->url = 'Service URL'; -$lang->jenkins->token = 'Token'; -$lang->jenkins->account = 'UserName'; -$lang->jenkins->password = 'Password'; - -$lang->jenkins->lblCreate = 'Create Jenkins Server'; -$lang->jenkins->desc = 'Description'; -$lang->jenkins->tokenFirst = 'Use token if not empty.'; -$lang->jenkins->tips = 'Cancel "Prevent Cross Site Request Forgery exploits" when using password.'; diff --git a/module/gitlab/lang/en.php b/module/gitlab/lang/en.php index d8a12a1798..17dbaabd4b 100644 --- a/module/gitlab/lang/en.php +++ b/module/gitlab/lang/en.php @@ -15,14 +15,14 @@ $lang->gitlab->zentaoAccount = 'Zentao Account'; $lang->gitlab->browseAction = 'GitLab List'; $lang->gitlab->deleteAction = 'Delete GitLab'; -$lang->gitlab->gitlabProject = "{$lang->gitlab->common}project"; -$lang->gitlab->gitlabIssue = "{$lang->gitlab->common}issue"; +$lang->gitlab->gitlabProject = "{$lang->gitlab->common} project"; +$lang->gitlab->gitlabIssue = "{$lang->gitlab->common} issue"; $lang->gitlab->zentaoProduct = 'Zentao Product'; $lang->gitlab->objectType = 'Type'; // task, bug, story $lang->gitlab->id = 'ID'; $lang->gitlab->name = "{$lang->gitlab->common}name"; -$lang->gitlab->url = 'GitLab Url'; +$lang->gitlab->url = 'GitLab URL'; $lang->gitlab->token = 'Token'; $lang->gitlab->defaultProject = 'Default Project'; $lang->gitlab->private = 'MD5 Verify'; @@ -34,13 +34,13 @@ $lang->gitlab->tips = 'When using a password, please disable the "Prevent $lang->gitlab->placeholder = new stdclass; $lang->gitlab->placeholder->name = ''; -$lang->gitlab->placeholder->url = "Please fill in the access address of the GitLab Server homepage, as :https://gitlab.zentao.net."; +$lang->gitlab->placeholder->url = "Please fill in the access address of the GitLab Server homepage, as: https://gitlab.zentao.net."; $lang->gitlab->placeholder->token = "Please fill in the access token of an account with admin privileges."; $lang->gitlab->noImportableIssues = "There are currently no issues available for import."; $lang->gitlab->tokenError = "The current token is not admin rights."; $lang->gitlab->hostError = "Invalid GitLab service address."; -$lang->gitlab->bindUserError = "Cannot bind users repeatedly %s"; +$lang->gitlab->bindUserError = "Can not bind users repeatedly %s"; $lang->gitlab->importIssueError = "The execution to which this issue belongs is not selected."; $lang->gitlab->importIssueWarn = "There is a problem of import failure, you can try to import again."; diff --git a/module/gitlab/lang/fr.php b/module/gitlab/lang/fr.php deleted file mode 100644 index d3dcf35cbd..0000000000 --- a/module/gitlab/lang/fr.php +++ /dev/null @@ -1,20 +0,0 @@ -jenkins->common = 'Jenkins'; -$lang->jenkins->browse = 'Afficher Jenkins'; -$lang->jenkins->create = 'Cr閑r Jenkins'; -$lang->jenkins->edit = 'Editer Jenkins'; -$lang->jenkins->delete = 'Supprimer'; -$lang->jenkins->confirmDelete = 'Voulez-vous supprimer ce serveur Jenkins ?'; - -$lang->jenkins->id = 'ID'; -$lang->jenkins->name = 'Nom'; -$lang->jenkins->url = 'Service URL'; -$lang->jenkins->token = 'Token'; -$lang->jenkins->account = 'UserName'; -$lang->jenkins->password = 'Password'; - -$lang->jenkins->lblCreate = 'Cr閑r Serveur Jenkins'; -$lang->jenkins->desc = 'Description'; -$lang->jenkins->tokenFirst = 'Utiliser un Token si non vide.'; -$lang->jenkins->tips = 'Cancel "Prevent Cross Site Request Forgery exploits" when using password.'; -$lang->jenkins->tips = "Annuler Emp阠her les exploits de contrefa鏾n de demande intersite lors de l'utilisation du mot de passe."; diff --git a/module/gitlab/lang/vi.php b/module/gitlab/lang/vi.php deleted file mode 100644 index b5a5f5d46d..0000000000 --- a/module/gitlab/lang/vi.php +++ /dev/null @@ -1,19 +0,0 @@ -jenkins->common = 'Jenkins'; -$lang->jenkins->browse = 'Jenkins'; -$lang->jenkins->create = 'Tạo Jenkins'; -$lang->jenkins->edit = 'Sửa Jenkins'; -$lang->jenkins->delete = 'Xóa'; -$lang->jenkins->confirmDelete = 'Bạn có muốn xóa máy chủ Jenkins này?'; - -$lang->jenkins->id = 'ID'; -$lang->jenkins->name = 'Tên'; -$lang->jenkins->url = 'URL'; -$lang->jenkins->token = 'Token'; -$lang->jenkins->account = 'Người dùng'; -$lang->jenkins->password = 'Mật khẩu'; - -$lang->jenkins->lblCreate = 'Tạo Jenkins Server'; -$lang->jenkins->desc = 'Mô tả'; -$lang->jenkins->tokenFirst = 'Sử dụng token nếu không trống.'; -$lang->jenkins->tips = 'Hủy "Ngăn chặn khai thác yêu cầu trang web giả mạo" khi sử dụng mật khẩu.'; diff --git a/module/gitlab/lang/zh-cn.php b/module/gitlab/lang/zh-cn.php index 40a0650177..ea5df297f8 100644 --- a/module/gitlab/lang/zh-cn.php +++ b/module/gitlab/lang/zh-cn.php @@ -1,20 +1,20 @@ gitlab = new stdclass; -$lang->gitlab->common = 'Gitlab'; -$lang->gitlab->browse = '浏览gitlab'; -$lang->gitlab->create = '添加gitlab'; -$lang->gitlab->edit = '编辑gitlab'; +$lang->gitlab->common = 'GitLab'; +$lang->gitlab->browse = '浏览GitLab'; +$lang->gitlab->create = '添加GitLab'; +$lang->gitlab->edit = '编辑GitLab'; $lang->gitlab->bindUser = '绑定用户'; $lang->gitlab->webhook = 'webhook'; $lang->gitlab->bindProduct = '关联产品'; $lang->gitlab->importIssue = '关联issue'; -$lang->gitlab->delete = '删除gitlab'; -$lang->gitlab->confirmDelete = '确认删除该gitlab吗?'; -$lang->gitlab->gitlabAccount = 'gitlab用户'; +$lang->gitlab->delete = '删除GitLab'; +$lang->gitlab->confirmDelete = '确认删除该GitLab吗?'; +$lang->gitlab->gitlabAccount = 'GitLab用户'; $lang->gitlab->zentaoAccount = '禅道用户'; -$lang->gitlab->browseAction = 'gitlab列表'; -$lang->gitlab->deleteAction = '删除gitlab'; +$lang->gitlab->browseAction = 'GitLab列表'; +$lang->gitlab->deleteAction = '删除GitLab'; $lang->gitlab->gitlabProject = "{$lang->gitlab->common}项目"; $lang->gitlab->gitlabIssue = "{$lang->gitlab->common}issue"; $lang->gitlab->zentaoProduct = '禅道产品'; @@ -27,10 +27,10 @@ $lang->gitlab->token = 'Token'; $lang->gitlab->defaultProject = '默认项目'; $lang->gitlab->private = 'MD5验证'; -$lang->gitlab->lblCreate = '添加gitlab服务器'; +$lang->gitlab->lblCreate = '添加GitLab服务器'; $lang->gitlab->desc = '描述'; $lang->gitlab->tokenFirst = 'Token不为空时,优先使用Token。'; -$lang->gitlab->tips = '使用密码时,请在gitlab全局安全设置中禁用"防止跨站点请求伪造"选项。'; +$lang->gitlab->tips = '使用密码时,请在GitLab全局安全设置中禁用"防止跨站点请求伪造"选项。'; $lang->gitlab->placeholder = new stdclass; $lang->gitlab->placeholder->name = ''; @@ -39,7 +39,7 @@ $lang->gitlab->placeholder->token = "请填写具有admin权限账户的access t $lang->gitlab->noImportableIssues = "目前没有可供导入的issue。"; $lang->gitlab->tokenError = "当前token非管理员权限。"; -$lang->gitlab->hostError = "无效的gitlab服务地址。"; +$lang->gitlab->hostError = "无效的GitLab服务地址。"; $lang->gitlab->bindUserError = "不能重复绑定用户 %s"; $lang->gitlab->importIssueError = "未选择该issue所属的执行。"; $lang->gitlab->importIssueWarn = "存在导入失败的issue,可再次尝试导入。"; diff --git a/module/gitlab/lang/zh-tw.php b/module/gitlab/lang/zh-tw.php deleted file mode 100644 index e19ffbbae3..0000000000 --- a/module/gitlab/lang/zh-tw.php +++ /dev/null @@ -1,22 +0,0 @@ -jenkins->common = 'Jenkins'; -$lang->jenkins->browse = '瀏覽Jenkins'; -$lang->jenkins->create = '添加Jenkins'; -$lang->jenkins->edit = '編輯Jenkins'; -$lang->jenkins->delete = '刪除'; -$lang->jenkins->confirmDelete = '確認刪除該Jenkins嗎?'; - -$lang->jenkins->browseAction = 'Jenkins列表'; -$lang->jenkins->deleteAction = '刪除Jenkins'; - -$lang->jenkins->id = 'ID'; -$lang->jenkins->name = '名稱'; -$lang->jenkins->url = '服務地址'; -$lang->jenkins->token = 'Token'; -$lang->jenkins->account = '用戶名'; -$lang->jenkins->password = '密碼'; - -$lang->jenkins->lblCreate = '添加Jenkins伺服器'; -$lang->jenkins->desc = '描述'; -$lang->jenkins->tokenFirst = 'Token不為空時,優先使用Token。'; -$lang->jenkins->tips = '使用密碼時,請在Jenkins全局安全設置中禁用"防止跨站點請求偽造"選項。'; diff --git a/module/gitlab/model.php b/module/gitlab/model.php index 622acec33f..8a5fa49bd4 100644 --- a/module/gitlab/model.php +++ b/module/gitlab/model.php @@ -863,8 +863,9 @@ class gitlabModel extends model /** * Create relationship between zentao product and gitlab project. * + * @param array $products * @param int $gitlabID - * @param int $projectID + * @param int $gitlabProjectID * @access public * @return void */ @@ -926,6 +927,7 @@ class gitlabModel extends model /** * Create webhook for zentao. * + * @param int $products * @param int $gitlabID * @param int $projectID * @access public @@ -948,8 +950,6 @@ class gitlabModel extends model /** * Delete an issue from zentao and gitlab. * - * @param int $gitlabID - * @param int $projectID * @param string $objectType * @param int $objectID * @param int $issueID @@ -969,7 +969,7 @@ class gitlabModel extends model * * @param string $objectType * @param object $object - * @param int $gitlab + * @param int $gitlabID * @param object $issue * @access public * @return void @@ -1106,7 +1106,7 @@ class gitlabModel extends model * * @param int $gitlabID * @param int $projectID - * @param object $story + * @param object $bug * @access public * @return object */ @@ -1197,6 +1197,7 @@ class gitlabModel extends model * * @param object $issue * @param int $gitlabID + * @param object $changes * @access public * @return object */ diff --git a/module/gitlab/view/importissue.html.php b/module/gitlab/view/importissue.html.php index 4735effda7..dcbf7f6a3a 100644 --- a/module/gitlab/view/importissue.html.php +++ b/module/gitlab/view/importissue.html.php @@ -42,9 +42,9 @@ - + save);?> - goback, '', 'class="btn btn-wide"'); ?> + createLink('repo', 'maintain', ""), $lang->goback, '', 'class="btn btn-wide"'); ?> diff --git a/module/product/control.php b/module/product/control.php index b3936f7f88..27c3e8c04e 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -320,11 +320,11 @@ class product extends control if(!empty($_POST)) { $productID = $this->product->create(); - if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); $this->loadModel('action')->create('product', $productID, 'opened'); $this->executeHooks($productID); - if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $productID)); + if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $productID)); $openApp = $this->app->openApp; $moduleName = $openApp == 'program'? 'program' : $this->moduleName; @@ -332,7 +332,7 @@ class product extends control $param = $openApp == 'program' ? "programID=$programID" : "productID=$productID"; $locate = $this->createLink($moduleName, $methodName, $param); if($openApp == 'doc') $locate = $this->createLink('doc', 'objectLibs', 'type=product'); - $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate)); + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate)); } if($this->app->openApp == 'program') $this->loadModel('program')->setMenu($programID); @@ -457,7 +457,7 @@ class product extends control } } - if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); if($action == 'undelete') { $this->loadModel('action'); @@ -479,7 +479,7 @@ class product extends control $locate = $this->createLink($moduleName, $methodName, $param); if(!$programID) $this->session->set('productList', $this->createLink('product', 'browse', $param), 'product'); - $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate)); + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locate)); } $productID = $this->product->saveState($productID, $this->products); @@ -702,6 +702,8 @@ class product extends control $this->dao->update(TABLE_DOCLIB)->set('deleted')->eq(1)->where('product')->eq($productID)->exec(); $this->session->set('product', ''); $this->executeHooks($productID); + + if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess)); die(js::locate($this->createLink('product', 'browse'), 'parent')); } } diff --git a/module/project/control.php b/module/project/control.php index c7794d9b42..72be3019d8 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -442,7 +442,7 @@ class project extends control $linkedBranches = array(); $productPlans = array(0 => ''); $allProducts = $this->program->getProductPairs($project->parent, 'assign', 'noclosed'); - $linkedProducts = $this->project->getProducts($projectID, true, 'noclosed'); + $linkedProducts = $this->project->getProducts($projectID); $parentProject = $this->program->getByID($project->parent); /* If the story of the product which linked the project, you don't allow to remove the product. */ diff --git a/module/repo/lang/zh-cn.php b/module/repo/lang/zh-cn.php index 9a0bf77497..59c08b8361 100644 --- a/module/repo/lang/zh-cn.php +++ b/module/repo/lang/zh-cn.php @@ -86,9 +86,6 @@ $lang->repo->group = '分组'; $lang->repo->user = '用户'; $lang->repo->info = '版本信息'; -$lang->repo->gitlabHost = 'Gitlab URL'; -$lang->repo->gitlabToken = '版本信息'; - $lang->repo->title = '标题'; $lang->repo->status = '状态'; $lang->repo->openedBy = '创建者'; @@ -131,12 +128,12 @@ $lang->repo->scmList['Gitlab'] = 'Gitlab'; $lang->repo->scmList['Subversion'] = 'Subversion'; $lang->repo->scmList['Gitlab'] = 'Gitlab'; -$lang->repo->gitlabHost = 'GitLab Sever'; +$lang->repo->gitlabHost = 'GitLab Server'; $lang->repo->gitlabToken = 'GitLab Token'; $lang->repo->gitlabProject = 'GitLab 项目'; $lang->repo->placeholder = new stdclass; -$lang->repo->placeholder->gitlabHost = '请填写gitlab访问地址'; +$lang->repo->placeholder->gitlabHost = '请填写GitLab访问地址'; $lang->repo->notice = new stdclass(); $lang->repo->notice->syncing = '正在同步中, 请稍等...'; diff --git a/module/repo/model.php b/module/repo/model.php index fc733a6a55..c5381707e0 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -230,12 +230,13 @@ class repoModel extends model if(!dao::isError()) $this->rmClientVersionFile(); + $this->loadModel('gitlab'); if($this->post->SCM == 'Gitlab') { - $this->loadModel("gitlab")->saveProjectRelation($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject); + $this->gitlab->saveProjectRelation($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject); /* create webhook for zentao */ - $this->loadModel("gitlab")->initWebhooks($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject); + $this->gitlab->initWebhooks($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject); } return $this->dao->lastInsertID(); } @@ -293,12 +294,13 @@ class repoModel extends model $this->rmClientVersionFile(); - if($repo->SCM == 'Gitlab') $this->loadModel("gitlab")->saveProjectRelation($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject); + $this->loadModel('gitlab'); + if($repo->SCM == 'Gitlab') $this->gitlab->saveProjectRelation($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject); if($repo->path != $data->path) { $this->dao->delete()->from(TABLE_REPOHISTORY)->where('repo')->eq($id)->exec(); $this->dao->delete()->from(TABLE_REPOFILES)->where('repo')->eq($id)->exec(); - if($repo->SCM == 'Gitlab') $this->loadModel("gitlab")->initWebhooks($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject); + if($repo->SCM == 'Gitlab') $this->gitlab->initWebhooks($this->post->product, $this->post->gitlabHost, $this->post->gitlabProject); return false; } diff --git a/module/story/control.php b/module/story/control.php index 54b879c137..905a0b1d9c 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -100,7 +100,7 @@ class story extends control { $response['result'] = 'fail'; $response['message'] = dao::getError(); - $this->send($response); + return $this->send($response); } $storyID = $storyResult['id']; @@ -119,7 +119,7 @@ class story extends control $param = $execution->type == 'project' ? "projectID=$objectID&productID=$productID" : "executionID=$objectID"; $response['locate'] = $this->createLink($moduleName, 'story', $param); } - $this->send($response); + return $this->send($response); } $action = $bugID == 0 ? 'Opened' : 'Frombug'; @@ -146,16 +146,16 @@ class story extends control $this->executeHooks($storyID); - if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $storyID)); + if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $storyID)); /* If link from no head then reload. */ - if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); + if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); if($this->post->newStory) { $response['message'] = $this->lang->story->successSaved . $this->lang->story->newStory; $response['locate'] = $this->createLink('story', 'create', "productID=$productID&branch=$branch&moduleID=$moduleID&story=0&objectID=$objectID&bugID=$bugID"); - $this->send($response); + return $this->send($response); } $moduleID = $this->post->module ? $this->post->module : 0; @@ -175,7 +175,7 @@ class story extends control $response['locate'] = $this->createLink($moduleName, 'story', $param); } if($this->app->getViewType() == 'xhtml') $response['locate'] = $this->createLink('story', 'view', "storyID=$storyID"); - $this->send($response); + return $this->send($response); } /* Set products, users and module. */ @@ -295,9 +295,10 @@ class story extends control $this->view->customFields = $customFields; $this->view->showFields = $this->config->story->custom->createFields; - $allGitlabs = $this->loadModel('gitlab')->getPairs(); + $this->loadModel('gitlab'); + $allGitlabs = $this->gitlab->getPairs(); $executionID = $objectID; - $gitlabProjects = $this->loadModel('gitlab')->getProjectsByExecution($executionID); + $gitlabProjects = $this->gitlab->getProjectsByExecution($executionID); foreach($allGitlabs as $id => $name) if($id and !isset($gitlabProjects[$id])) unset($allGitlabs[$id]); $this->view->gitlabList = $allGitlabs; $this->view->gitlabProjects = $gitlabProjects; @@ -413,7 +414,7 @@ class story extends control if(dao::isError()) die(js::error(dao::getError())); } - if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $stories)); + if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $stories)); if(isonlybody()) die(js::closeModal('parent.parent', 'this')); if($storyID) @@ -583,14 +584,8 @@ class story extends control $this->executeHooks($storyID); - if(defined('RUN_MODE') && RUN_MODE == 'api') - { - die(array('status' => 'success', 'data' => $storyID)); - } - else - { - die(js::locate($this->createLink($this->app->rawModule, 'view', "storyID=$storyID"), 'parent')); - } + if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success', 'data' => $storyID)); + die(js::locate($this->createLink($this->app->rawModule, 'view', "storyID=$storyID"), 'parent')); } $this->commonAction($storyID); @@ -816,7 +811,11 @@ class story extends control if(!empty($_POST)) { $changes = $this->story->change($storyID); - if(dao::isError()) die(js::error(dao::getError())); + if(dao::isError()) + { + if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'message' => dao::getError())); + die(js::error(dao::getError())); + } $version = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch('version'); $files = $this->loadModel('file')->saveUpload('story', $storyID, $version); @@ -832,6 +831,8 @@ class story extends control $this->executeHooks($storyID); $module = $this->app->openApp == 'project' ? 'projectstory' : 'story'; + + if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success')); die(js::locate($this->createLink($module, 'view', "storyID=$storyID"), 'parent')); } @@ -991,8 +992,9 @@ class story extends control else { /* Delete related issue in gitlab. */ - $relation = $this->loadModel('gitlab')->getRelationByObject('story', $storyID); - if(!empty($relation)) $this->loadModel('gitlab')->deleteIssue('story', $storyID, $relation->issueID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('story', $storyID); + if(!empty($relation)) $this->gitlab->deleteIssue('story', $storyID, $relation->issueID); $this->story->delete(TABLE_STORY, $storyID); if($story->parent > 0) @@ -1003,6 +1005,7 @@ class story extends control $this->executeHooks($storyID); + if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success')); die(js::locate($this->session->storyList, 'parent')); } } @@ -1323,12 +1326,12 @@ class story extends control { $response['result'] = 'fail'; $response['message'] = dao::getError(); - $this->send($response); + return $this->send($response); } if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $tasks)); $response['locate'] = $this->createLink('execution', 'task', "executionID=$executionID"); - $this->send($response); + return $this->send($response); } } diff --git a/module/story/model.php b/module/story/model.php index 98d1cc5b20..ea296e8ad0 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -700,8 +700,9 @@ class storyModel extends model $this->file->updateObjectID($this->post->uid, $storyID, 'story'); /* update story to gitlab issue. */ - $relation = $this->loadModel('gitlab')->getRelationByObject('story', $storyID); - if($relation) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('story', $storyID); + if($relation) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); return common::createChanges($oldStory, $story); } @@ -883,8 +884,9 @@ class storyModel extends model } /* update story to gitlab issue. */ - $relation = $this->loadModel('gitlab')->getRelationByObject('story', $storyID); - if($relation) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('story', $storyID); + if($relation) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); unset($oldStory->parent); unset($story->parent); @@ -1217,8 +1219,9 @@ class storyModel extends model if($oldStory->plan != $story->plan) $this->updateStoryOrderOfPlan($storyID, $story->plan, $oldStory->plan); /* update story to gitlab issue. */ - $relation = $this->loadModel('gitlab')->getRelationByObject('story', $storyID); - if(!empty($relation)) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('story', $storyID); + if(!empty($relation)) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); $this->executeHooks($storyID); if($story->type == 'story') $this->batchChangeStage(array($storyID), $story->stage); @@ -1485,12 +1488,13 @@ class storyModel extends model ->checkIF($story->closedReason == 'duplicate', 'duplicateStory', 'notempty') ->where('id')->eq($storyID)->exec(); - $relation = $this->loadModel('gitlab')->getRelationByObject('story', $storyID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('story', $storyID); if(!empty($relation)) { - $currentIssue = $this->loadModel('gitlab')->apiGetSingleIssue($relation->gitlabID, $relation->projectID, $relation->issueID); - if($currentIssue->state != 'closed') $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); + $currentIssue = $this->gitlab->apiGetSingleIssue($relation->gitlabID, $relation->projectID, $relation->issueID); + if($currentIssue->state != 'closed') $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); } /* Update parent story status. */ @@ -1560,11 +1564,12 @@ class storyModel extends model $this->setStage($storyID); $allChanges[$storyID] = common::createChanges($oldStory, $story); - $relation = $this->loadModel('gitlab')->getRelationByObject('story', $storyID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('story', $storyID); if(!empty($relation)) { - $currentIssue = $this->loadModel('gitlab')->apiGetSingleIssue($relation->gitlabID, $relation->projectID, $relation->issueID); - if($currentIssue->state != 'closed') $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); + $currentIssue = $this->gitlab->apiGetSingleIssue($relation->gitlabID, $relation->projectID, $relation->issueID); + if($currentIssue->state != 'closed') $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); } } else @@ -1843,9 +1848,10 @@ class storyModel extends model if(!dao::isError()) { - $relation = $this->loadModel('gitlab')->getRelationByObject('story', $storyID); - $story->assignee_id = $this->loadModel('gitlab')->getGitlabUserID($relation->gitlabID, $story->assignedTo); - if($story->assignee_id != '') $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('story', $storyID); + $story->assignee_id = $this->gitlab->getGitlabUserID($relation->gitlabID, $story->assignedTo); + if($story->assignee_id != '') $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); return common::createChanges($oldStory, $story); } return false; @@ -1878,13 +1884,15 @@ class storyModel extends model $this->dao->update(TABLE_STORY)->data($story)->autoCheck()->where('id')->eq((int)$storyID)->exec(); if(!dao::isError()) { - $relation = $this->loadModel('gitlab')->getRelationByObject('story', $storyID); - $story->assignee_id = $this->loadModel('gitlab')->getGitlabUserID($relation->gitlabID, $story->assignedTo); - if($story->assignee_id != '') $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('story', $storyID); + $story->assignee_id = $this->gitlab->getGitlabUserID($relation->gitlabID, $story->assignedTo); + if($story->assignee_id != '') $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); /* Push this story to gitlab issue. */ - $relation = $this->loadModel('gitlab')->getRelationByObject('story', $storyID); - if(!empty($relation)) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('story', $storyID); + if(!empty($relation)) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); } } return $allChanges; @@ -1921,8 +1929,9 @@ class storyModel extends model if($oldStory->parent > 0) $this->updateParentStatus($storyID, $oldStory->parent); /* Push this story to gitlab issue. */ - $relation = $this->loadModel('gitlab')->getRelationByObject('story', $storyID); - if(!empty($relation)) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('story', $storyID); + if(!empty($relation)) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'story', $story, $storyID); return common::createChanges($oldStory, $story); } diff --git a/module/task/control.php b/module/task/control.php index 785e91d5f4..42cfb1c31d 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -217,8 +217,9 @@ class task extends control foreach(explode(',', $this->config->task->customCreateFields) as $field) $customFields[$field] = $this->lang->task->$field; if($execution->type == 'ops') unset($customFields['story']); - $allGitlabs = $this->loadModel('gitlab')->getPairs(); - $gitlabProjects = $this->loadModel('gitlab')->getProjectsByExecution($executionID); + $this->loadModel('gitlab'); + $allGitlabs = $this->gitlab->getPairs(); + $gitlabProjects = $this->gitlab->getProjectsByExecution($executionID); foreach($allGitlabs as $id => $name) if($id and !isset($gitlabProjects[$id])) unset($allGitlabs[$id]); $this->view->gitlabList = $allGitlabs; $this->view->gitlabProjects = $gitlabProjects; @@ -577,7 +578,8 @@ class task extends control $task = $this->task->getByID($taskID); - $relation = $this->loadModel('gitlab')->getRelationByObject('task', $taskID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('task', $taskID); if($relation)$this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $task, $taskID); $members = $this->loadModel('user')->getTeamMemberPairs($executionID, 'execution', 'nodeleted'); @@ -1298,8 +1300,9 @@ class task extends control else { /* Delete related issue in gitlab. */ - $relation = $this->loadModel('gitlab')->getRelationByObject('task', $taskID); - if(!empty($relation)) $this->loadModel('gitlab')->deleteIssue('task', $taskID, $relation->issueID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('task', $taskID); + if(!empty($relation)) $this->gitlab->deleteIssue('task', $taskID, $relation->issueID); $this->task->delete(TABLE_TASK, $taskID); if($task->parent > 0) diff --git a/module/task/model.php b/module/task/model.php index 4d3f7b1f2b..3b471cbbe0 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -982,8 +982,9 @@ class taskModel extends model ->where('id')->eq((int)$taskID)->exec(); /* update task to gitlab issue. */ - $relation = $this->loadModel('gitlab')->getRelationByObject('task', $taskID); - if(!empty($relation)) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $task, $taskID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('task', $taskID); + if(!empty($relation)) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $task, $taskID); if(!dao::isError()) { @@ -1218,12 +1219,13 @@ class taskModel extends model $tasks[$taskID] = $task; } - $issues = $this->loadModel('gitlab')->getIssueListByObjects('task', $taskID); + $this->loadModel('gitlab'); + $issues = $this->gitlab->getIssueListByObjects('task', $taskID); foreach($tasks as $taskID => $task) { $issue = zget($issues, $taskID, 0); if(!$issue) continue; - $this->loadModel('gitlab')->apiUpdateIssue($issue->gitlabID, $issue->projectID, $issue->issueID, $task); + $this->gitlab->apiUpdateIssue($issue->gitlabID, $issue->projectID, $issue->issueID, $task); } /* Check field not empty. */ @@ -1297,8 +1299,9 @@ class taskModel extends model $allChanges[$taskID] = common::createChanges($oldTask, $task); /* update task to gitlab issue. */ - $relation = $this->loadModel('gitlab')->getRelationByObject('task', $taskID); - if(!empty($relation)) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $task, $taskID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('task', $taskID); + if(!empty($relation)) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $task, $taskID); } else { @@ -1386,8 +1389,9 @@ class taskModel extends model ->where('id')->eq($taskID)->exec(); $task = $this->getById($taskID); - $relation = $this->loadModel('gitlab')->getRelationByObject('task', $taskID); - if(!empty($relation)) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $task, $taskID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('task', $taskID); + if(!empty($relation)) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $task, $taskID); if(!dao::isError()) return common::createChanges($oldTask, $task); } @@ -1432,7 +1436,7 @@ class taskModel extends model $task->status = 'done'; $task->finishedBy = $this->app->user->account; $task->finishedDate = helper::now(); - $task->assignedTo = $oldTask->openedBy; // Fix bug#1341 + $task->assignedTo = $oldTask->openedBy; } /* Record consumed and left. */ @@ -1724,11 +1728,12 @@ class taskModel extends model ->where('id')->eq((int)$taskID) ->exec(); - $relation = $this->loadModel('gitlab')->getRelationByObject('task', $taskID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('task', $taskID); if(!empty($relation)) { - $currentIssue = $this->loadModel('gitlab')->apiGetSingleIssue($relation->gitlabID, $relation->projectID, $relation->issueID); - if($currentIssue->state != 'closed') $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $task, $taskID); + $currentIssue = $this->gitlab->apiGetSingleIssue($relation->gitlabID, $relation->projectID, $relation->issueID); + if($currentIssue->state != 'closed') $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $task, $taskID); } if($oldTask->parent > 0) $this->updateParentStatus($taskID); @@ -1787,11 +1792,12 @@ class taskModel extends model $this->dao->update(TABLE_TASK)->data($task)->autoCheck()->where('id')->eq((int)$taskID)->exec(); - $relation = $this->loadModel('gitlab')->getRelationByObject('task', $taskID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('task', $taskID); if(!empty($relation)) { - $currentIssue = $this->loadModel('gitlab')->apiGetSingleIssue($relation->gitlabID, $relation->projectID, $relation->issueID); - if($currentIssue->state != 'closed') $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $task, $taskID); + $currentIssue = $this->gitlab->apiGetSingleIssue($relation->gitlabID, $relation->projectID, $relation->issueID); + if($currentIssue->state != 'closed') $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'bug', $task, $taskID); } if(!dao::isError()) @@ -1837,12 +1843,13 @@ class taskModel extends model $this->dao->update(TABLE_TASK)->set('assignedTo=openedBy')->where('parent')->eq((int)$taskID)->exec(); } if($oldTask->story) $this->loadModel('story')->setStage($oldTask->story); - - $relation = $this->loadModel('gitlab')->getRelationByObject('task', $taskID); + + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('task', $taskID); if(!empty($relation)) { - $currentIssue = $this->loadModel('gitlab')->apiGetSingleIssue($relation->gitlabID, $relation->projectID, $relation->issueID); - if($currentIssue->state != 'closed') $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $task, $taskID); + $currentIssue = $this->gitlab->apiGetSingleIssue($relation->gitlabID, $relation->projectID, $relation->issueID); + if($currentIssue->state != 'closed') $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $task, $taskID); } if(!dao::isError()) return common::createChanges($oldTask, $task); @@ -1910,8 +1917,9 @@ class taskModel extends model } if($oldTask->story) $this->loadModel('story')->setStage($oldTask->story); - $relation = $this->loadModel('gitlab')->getRelationByObject('task', $taskID); - if(!empty($relation)) $this->loadModel('gitlab')->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $task, $taskID); + $this->loadModel('gitlab'); + $relation = $this->gitlab->getRelationByObject('task', $taskID); + if(!empty($relation)) $this->gitlab->apiUpdateIssue($relation->gitlabID, $relation->projectID, $relation->issueID, 'task', $task, $taskID); if(!dao::isError()) return common::createChanges($oldTask, $task); } diff --git a/module/upgrade/js/mergeprogram.js b/module/upgrade/js/mergeprogram.js index 888680cbcd..3ec0810a6f 100644 --- a/module/upgrade/js/mergeprogram.js +++ b/module/upgrade/js/mergeprogram.js @@ -799,6 +799,15 @@ function toggleProgram(obj) var programID = $('#programs').val(); getProgramStatus('program', programID); } + var projectType = $('input[name="projectType"]:checked').val(); + if(projectType == 'project') + { + $('.projectStatus').addClass('hidden'); + } + if(projectType == 'execution') + { + $('.projectStatus').removeClass('hidden'); + } } /** diff --git a/module/upgrade/lang/de.php b/module/upgrade/lang/de.php index df9c6a454b..e6fda3ffc2 100644 --- a/module/upgrade/lang/de.php +++ b/module/upgrade/lang/de.php @@ -90,8 +90,8 @@ $lang->upgrade->to20Desc = <<upgrade->mergeProgramDesc = <<Next, ZenTao will migrate the existing data of {$lang->productCommon} and {$lang->projectCommon} to Program and Project. It will be one of the followings:


-

1. Manage {$lang->productCommon} and {$lang->projectCommon} by Product Line

-

Migrate the data of {$lang->productCommon} and {$lang->projectCommon} by Product Line to a Program. You can also migrate it separately.

+

1. Manage {$lang->productCommon} and {$lang->projectCommon} by {$lang->productCommon} Line

+

Migrate the data of {$lang->productCommon} and {$lang->projectCommon} by {$lang->productCommon} Line to a Program. You can also migrate it separately.

2. Manage {$lang->projectCommon} by {$lang->productCommon}

You can migrate the data of several {$lang->productCommon}s and {$lang->projectCommon}s to one Program. Or select {$lang->projectCommon}s of a {$lang->productCommon} and {$lang->productCommon} to a Program.

2. Independent {$lang->projectCommon}

@@ -120,7 +120,7 @@ $lang->upgrade->projectName = 'Project Name'; $lang->upgrade->newProgram = 'Create'; $lang->upgrade->projectEmpty = 'Project must be not empty.'; $lang->upgrade->mergeSummary = "Dear users, there are %s {$lang->productCommon} and %s {$lang->projectCommon} in your system waiting for Migration. By System Calculation, we recommend your migration plan as follows, you can also adjust according to your own situation:"; -$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED {$lang->projectCommon}: Consolidate the entire product line and the {$lang->productCommon} and {$lang->projectCommon} below it into one large project."; +$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED {$lang->projectCommon}: Consolidate the entire {$lang->productCommon} line and the {$lang->productCommon} and {$lang->projectCommon} below it into one large project."; $lang->upgrade->mergeByProduct = "PRODUCT-BASED {$lang->projectCommon}: You can select multiple {$lang->productCommon} and their lower {$lang->projectCommon} to merge into a large project, or you can select a {$lang->productCommon} to merge its lower {$lang->projectCommon} into a larger project"; $lang->upgrade->mergeByProject = "Independent {$lang->projectCommon}: You can select several {$lang->projectCommon} and merge them into one large project, or merge them independently"; $lang->upgrade->mergeByMoreLink = "{$lang->projectCommon} that relates multiple {$lang->productCommon}: select which project the {$lang->projectCommon} belongs to."; diff --git a/module/upgrade/lang/en.php b/module/upgrade/lang/en.php index 15c5c532e6..eff7209a29 100644 --- a/module/upgrade/lang/en.php +++ b/module/upgrade/lang/en.php @@ -71,8 +71,8 @@ $lang->upgrade->to15Desc = <<upgrade->mergeProgramDesc = <<Next, ZenTao will migrate the existing data of {$lang->productCommon} and {$lang->projectCommon} to Program and Project. It will be one of the followings:


-

1. Manage {$lang->productCommon} and {$lang->projectCommon} by Product Line

-

Migrate the data of {$lang->productCommon} and {$lang->projectCommon} by Product Line to a Program. You can also migrate it separately.

+

1. Manage {$lang->productCommon} and {$lang->projectCommon} by {$lang->productCommon} Line

+

Migrate the data of {$lang->productCommon} and {$lang->projectCommon} by {$lang->productCommon} Line to a Program. You can also migrate it separately.

2. Manage {$lang->projectCommon} by {$lang->productCommon}

You can migrate the data of several {$lang->productCommon}s and {$lang->projectCommon}s to one Program. Or select {$lang->projectCommon}s of a {$lang->productCommon} and {$lang->productCommon} to a Program.

2. Independent {$lang->projectCommon}

@@ -107,7 +107,7 @@ $lang->upgrade->projectName = 'Project Name'; $lang->upgrade->newProgram = 'Create'; $lang->upgrade->projectEmpty = 'Project must be not empty.'; $lang->upgrade->mergeSummary = "Dear users, there are %s {$lang->productCommon} and %s {$lang->projectCommon} in your system waiting for Migration. By System Calculation, we recommend your migration plan as follows, you can also adjust according to your own situation:"; -$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED {$lang->projectCommon}: Consolidate the entire product line and the {$lang->productCommon} and {$lang->projectCommon} below it into one large project."; +$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED {$lang->projectCommon}: Consolidate the entire {$lang->productCommon} line and the {$lang->productCommon} and {$lang->projectCommon} below it into one large project."; $lang->upgrade->mergeByProduct = "PRODUCT-BASED {$lang->projectCommon}: You can select multiple {$lang->productCommon} and their lower {$lang->projectCommon} to merge into a large project, or you can select a {$lang->productCommon} to merge its lower {$lang->projectCommon} into a larger project"; $lang->upgrade->mergeByProject = "Independent {$lang->projectCommon}: You can select several {$lang->projectCommon} and merge them into one large project, or merge them independently"; $lang->upgrade->mergeByMoreLink = "{$lang->projectCommon} that relates multiple {$lang->productCommon}: select which project the {$lang->projectCommon} belongs to."; diff --git a/module/upgrade/lang/fr.php b/module/upgrade/lang/fr.php index 2417b7767c..fbcd325fac 100644 --- a/module/upgrade/lang/fr.php +++ b/module/upgrade/lang/fr.php @@ -91,8 +91,8 @@ $lang->upgrade->to20Desc = <<upgrade->mergeProgramDesc = <<Next, ZenTao will migrate the existing data of {$lang->productCommon} and {$lang->projectCommon} to Program and Project. It will be one of the followings:


-

1. Manage {$lang->productCommon} and {$lang->projectCommon} by Product Line

-

Migrate the data of {$lang->productCommon} and {$lang->projectCommon} by Product Line to a Program. You can also migrate it separately.

+

1. Manage {$lang->productCommon} and {$lang->projectCommon} by {$lang->productCommon} Line

+

Migrate the data of {$lang->productCommon} and {$lang->projectCommon} by {$lang->productCommon} Line to a Program. You can also migrate it separately.

2. Manage {$lang->projectCommon} by {$lang->productCommon}

You can migrate the data of several {$lang->productCommon}s and {$lang->projectCommon}s to one Program. Or select {$lang->projectCommon}s of a {$lang->productCommon} and {$lang->productCommon} to a Program.

2. Independent {$lang->projectCommon}

@@ -121,7 +121,7 @@ $lang->upgrade->projectName = 'Project Name'; $lang->upgrade->newProgram = 'Create'; $lang->upgrade->projectEmpty = 'Project must be not empty.'; $lang->upgrade->mergeSummary = "Dear users, there are %s {$lang->productCommon} and %s {$lang->projectCommon} in your system waiting for Migration. By System Calculation, we recommend your migration plan as follows, you can also adjust according to your own situation:"; -$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED {$lang->projectCommon}: Consolidate the entire product line and the {$lang->productCommon} and {$lang->projectCommon} below it into one large project."; +$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED {$lang->projectCommon}: Consolidate the entire {$lang->productCommon} line and the {$lang->productCommon} and {$lang->projectCommon} below it into one large project."; $lang->upgrade->mergeByProduct = "PRODUCT-BASED {$lang->projectCommon}: You can select multiple {$lang->productCommon} and their lower {$lang->projectCommon} to merge into a large project, or you can select a {$lang->productCommon} to merge its lower {$lang->projectCommon} into a larger project"; $lang->upgrade->mergeByProject = "Independent {$lang->projectCommon}: You can select several {$lang->projectCommon} and merge them into one large project, or merge them independently"; $lang->upgrade->mergeByMoreLink = "{$lang->projectCommon} that relates multiple {$lang->productCommon}: select which project the {$lang->projectCommon} belongs to."; diff --git a/module/upgrade/lang/vi.php b/module/upgrade/lang/vi.php index 21d755cd06..aa640b035d 100644 --- a/module/upgrade/lang/vi.php +++ b/module/upgrade/lang/vi.php @@ -91,8 +91,8 @@ $lang->upgrade->to20Desc = <<upgrade->mergeProgramDesc = <<Next, ZenTao will migrate the existing data of {$lang->productCommon} and {$lang->projectCommon} to Program and Project. It will be one of the followings:


-

1. Manage {$lang->productCommon} and {$lang->projectCommon} by Product Line

-

Migrate the data of {$lang->productCommon} and {$lang->projectCommon} by Product Line to a Program. You can also migrate it separately.

+

1. Manage {$lang->productCommon} and {$lang->projectCommon} by {$lang->productCommon} Line

+

Migrate the data of {$lang->productCommon} and {$lang->projectCommon} by {$lang->productCommon} Line to a Program. You can also migrate it separately.

2. Manage {$lang->projectCommon} by {$lang->productCommon}

You can migrate the data of several {$lang->productCommon}s and {$lang->projectCommon}s to one Program. Or select {$lang->projectCommon}s of a {$lang->productCommon} and {$lang->productCommon} to a Program.

2. Independent {$lang->projectCommon}

@@ -121,7 +121,7 @@ $lang->upgrade->projectName = 'Project Name'; $lang->upgrade->newProgram = 'Create'; $lang->upgrade->projectEmpty = 'Project must be not empty.'; $lang->upgrade->mergeSummary = "Dear users, there are %s {$lang->productCommon} and %s {$lang->projectCommon} in your system waiting for Migration. By System Calculation, we recommend your migration plan as follows, you can also adjust according to your own situation:"; -$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED {$lang->projectCommon}: Consolidate the entire product line and the {$lang->productCommon} and {$lang->projectCommon} below it into one large project."; +$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED {$lang->projectCommon}: Consolidate the entire {$lang->productCommon} line and the {$lang->productCommon} and {$lang->projectCommon} below it into one large project."; $lang->upgrade->mergeByProduct = "PRODUCT-BASED {$lang->projectCommon}: You can select multiple {$lang->productCommon} and their lower {$lang->projectCommon} to merge into a large project, or you can select a {$lang->productCommon} to merge its lower {$lang->projectCommon} into a larger project"; $lang->upgrade->mergeByProject = "Independent {$lang->projectCommon}: You can select several {$lang->projectCommon} and merge them into one large project, or merge them independently"; $lang->upgrade->mergeByMoreLink = "{$lang->projectCommon} that relates multiple {$lang->productCommon}: select which project the {$lang->projectCommon} belongs to."; diff --git a/module/upgrade/lang/zh-cn.php b/module/upgrade/lang/zh-cn.php index 05c3d64279..543ef5a494 100644 --- a/module/upgrade/lang/zh-cn.php +++ b/module/upgrade/lang/zh-cn.php @@ -72,8 +72,8 @@ EOD; $lang->upgrade->mergeProgramDesc = <<接下来我们会把之前历史{$lang->productCommon}和{$lang->projectCommon}数据迁移到项目集和项目下,迁移的情况如下:


-

情况一:以产品线组织的{$lang->productCommon}和{$lang->projectCommon}

-

可以将整个产品线及其下面的{$lang->productCommon}和{$lang->projectCommon}迁移到一个项目集中,当然您也可以根据需要分开迁移。

+

情况一:以{$lang->productCommon}线组织的{$lang->productCommon}和{$lang->projectCommon}

+

可以将整个{$lang->productCommon}线及其下面的{$lang->productCommon}和{$lang->projectCommon}迁移到一个项目集中,当然您也可以根据需要分开迁移。

情况二:以{$lang->productCommon}组织的{$lang->projectCommon}

可以选择多个{$lang->productCommon}及其下面的{$lang->projectCommon}迁移到一个项目集中,也可以选择某一个{$lang->productCommon}和{$lang->productCommon}下面的{$lang->projectCommon}迁移到项目集中。

情况三:独立的{$lang->projectCommon}

@@ -108,7 +108,7 @@ $lang->upgrade->projectName = '项目名称'; $lang->upgrade->newProgram = '新建'; $lang->upgrade->projectEmpty = '所属项目不能为空!'; $lang->upgrade->mergeSummary = "尊敬的用户,您的系统中共有%s个{$lang->productCommon},%s个{$lang->projectCommon}等待迁移。"; -$lang->upgrade->mergeByProductLine = "以产品线组织的{$lang->productCommon}和{$lang->projectCommon}:将整个产品线及其下面的{$lang->productCommon}和{$lang->projectCommon}归并到一个项目集和项目中,也可以分开归并。"; +$lang->upgrade->mergeByProductLine = "以{$lang->productCommon}线组织的{$lang->productCommon}和{$lang->projectCommon}:将整个{$lang->productCommon}线及其下面的{$lang->productCommon}和{$lang->projectCommon}归并到一个项目集和项目中,也可以分开归并。"; $lang->upgrade->mergeByProduct = "以{$lang->productCommon}组织的{$lang->projectCommon}:可以选择多个{$lang->productCommon}及其下面的{$lang->projectCommon}归并到一个项目集和项目中,也可以选择某一个{$lang->productCommon}将其下面所属的{$lang->projectCommon}归并到项目集和项目中。"; $lang->upgrade->mergeByProject = "独立的{$lang->projectCommon}:可以选择若干{$lang->projectCommon}归并到一个项目中,也可以独立归并。"; $lang->upgrade->mergeByMoreLink = "关联多个{$lang->productCommon}的{$lang->projectCommon}:选择这个{$lang->projectCommon}归属于哪一个项目。"; diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 22b975ee00..ede17fd93c 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -4344,7 +4344,7 @@ class upgradeModel extends model else { /* Use historical projects as project upgrades. */ - $projects = $this->dao->select('id,name,begin,end,status,PM')->from(TABLE_PROJECT)->where('id')->in($projectIdList)->fetchAll('id'); + $projects = $this->dao->select('id,name,begin,end,status,PM,acl')->from(TABLE_PROJECT)->where('id')->in($projectIdList)->fetchAll('id'); foreach($projectIdList as $projectID) { $data->projectName = $projects[$projectID]->name; @@ -4352,6 +4352,7 @@ class upgradeModel extends model $data->end = $projects[$projectID]->end; $data->projectStatus = $projects[$projectID]->status; $data->PM = $projects[$projectID]->PM; + $data->projectAcl = $projects[$projectID]->acl == 'custom' ? 'private' : $projects[$projectID]->acl; $projectList[$projectID] = $this->createProject($programID, $data); } diff --git a/module/upgrade/view/createprogram.html.php b/module/upgrade/view/createprogram.html.php index 04bc318654..17ff4f0a09 100644 --- a/module/upgrade/view/createprogram.html.php +++ b/module/upgrade/view/createprogram.html.php @@ -57,7 +57,7 @@ - product->lineName;?> + upgrade->line;?>