diff --git a/db/update16.0.sql b/db/update16.0.sql index 53d062a7c2..670d7fa379 100644 --- a/db/update16.0.sql +++ b/db/update16.0.sql @@ -1 +1,2 @@ ALTER TABLE zt_productplan ADD `status` enum('wait','doing','done','closed') NOT NULL default 'wait' AFTER `title`; +ALTER TABLE zt_product modify column `reviewer` text NOT NULL; diff --git a/db/zentao.sql b/db/zentao.sql index 2b864ada9c..c733278613 100644 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -933,7 +933,7 @@ CREATE TABLE IF NOT EXISTS `zt_product` ( `RD` varchar(30) NOT NULL, `acl` enum('open','private','custom') NOT NULL default 'open', `whitelist` text NOT NULL, - `reviewer` varchar(255) NOT NULL, + `reviewer` text NOT NULL, `createdBy` varchar(30) NOT NULL, `createdDate` datetime NOT NULL, `createdVersion` varchar(20) NOT NULL, diff --git a/lib/scm/gitlab.class.php b/lib/scm/gitlab.class.php index 044b12e610..2ac9958d55 100644 --- a/lib/scm/gitlab.class.php +++ b/lib/scm/gitlab.class.php @@ -617,6 +617,7 @@ class gitlab $param = new stdclass(); $param->path = urldecode($path); + $param->ref_name = $this->branch; $fromDate = $this->getCommittedDate($fromRevision); $toDate = $this->getCommittedDate($toRevision); diff --git a/module/bug/lang/en.php b/module/bug/lang/en.php index 52773b0205..cceaed9529 100644 --- a/module/bug/lang/en.php +++ b/module/bug/lang/en.php @@ -164,6 +164,7 @@ $lang->bug->labelConfirmed = 'Confirmed'; $lang->bug->labelPostponed = 'Postponed'; $lang->bug->changed = 'Changed'; $lang->bug->storyChanged = 'Story Changed'; +$lang->bug->linkMR = 'Related MRs'; /* Page tags. */ $lang->bug->lblAssignedTo = 'AssignTo'; diff --git a/module/bug/lang/zh-cn.php b/module/bug/lang/zh-cn.php index aadb1f1fc8..2e2233ae5b 100644 --- a/module/bug/lang/zh-cn.php +++ b/module/bug/lang/zh-cn.php @@ -164,6 +164,7 @@ $lang->bug->labelConfirmed = '已确认'; $lang->bug->labelPostponed = '被延期'; $lang->bug->changed = '已变动'; $lang->bug->storyChanged = '需求变动'; +$lang->bug->linkMR = '相关合并请求'; /* 页面标签。*/ $lang->bug->lblAssignedTo = '当前指派'; diff --git a/module/bug/lang/zh-tw.php b/module/bug/lang/zh-tw.php index 4e6f711d3e..3a4e4f26c6 100644 --- a/module/bug/lang/zh-tw.php +++ b/module/bug/lang/zh-tw.php @@ -164,6 +164,7 @@ $lang->bug->labelConfirmed = '已確認'; $lang->bug->labelPostponed = '被延期'; $lang->bug->changed = '已變動'; $lang->bug->storyChanged = '需求變動'; +$lang->bug->linkMR = '相關合并請求'; /* 頁面標籤。*/ $lang->bug->lblAssignedTo = '當前指派'; diff --git a/module/bug/model.php b/module/bug/model.php index f1518ab47e..4258a0b02d 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -495,6 +495,7 @@ class bugModel extends model if($bug->linkBug) $bug->linkBugTitles = $this->dao->select('id,title')->from(TABLE_BUG)->where('id')->in($bug->linkBug)->fetchPairs(); if($bug->toStory > 0) $bug->toStoryTitle = $this->dao->findById($bug->toStory)->from(TABLE_STORY)->fields('title')->fetch('title'); if($bug->toTask > 0) $bug->toTaskTitle = $this->dao->findById($bug->toTask)->from(TABLE_TASK)->fields('name')->fetch('name'); + $bug->linkMRTitles = $this->loadModel('mr')->getLinkedMRPairs($bugID, 'bug'); $bug->toCases = array(); $toCases = $this->dao->select('id, title')->from(TABLE_CASE)->where('`fromBug`')->eq($bugID)->fetchAll(); diff --git a/module/bug/view/view.html.php b/module/bug/view/view.html.php index d5e2d774f2..f49ecaf530 100644 --- a/module/bug/view/view.html.php +++ b/module/bug/view/view.html.php @@ -374,7 +374,7 @@ - + case):?> - + @@ -418,6 +418,17 @@ + + + +
bug->linkBug;?>bug->linkBug;?> linkBugTitles)) @@ -389,7 +389,7 @@
bug->fromCase;?>bug->fromCase;?> createLink('testcase', 'view', "caseID=$bug->case&caseVersion=" . ($bug->testtask ? "&from=testtask&taskID={$bug->testtask}" : ''), '', true), "#$bug->case $bug->caseTitle", '', "class='iframe' data-width='80%'");?>
createLink('task', 'view', "taskID=$bug->toTask", '', true), "#$bug->toTask $bug->toTaskTitle", '', "class='iframe' data-width='80%'");?>
bug->linkMR;?> + linkMRTitles as $MRID => $linkMRTitle) + { + echo html::a($this->createLink('mr', 'view', "MRID=$MRID"), "#$MRID $linkMRTitle") . '
'; + } + ?> +
diff --git a/module/mr/model.php b/module/mr/model.php index b1b900ed44..b04bbc65e2 100644 --- a/module/mr/model.php +++ b/module/mr/model.php @@ -1252,6 +1252,23 @@ class mrModel extends model return $links; } + /** + * Get linked MR pairs. + * + * @param int $objectID + * @param string $objectType + * @access public + * @return array + */ + public function getLinkedMRPairs($objectID, $objectType = 'story') + { + return $this->dao->select("t2.id,t2.title")->from(TABLE_RELATION)->alias('t1') + ->leftJoin(TABLE_MR)->alias('t2')->on('t1.AID = t2.id') + ->where('t1.AType')->eq('mr') + ->andWhere('t1.BID')->eq($objectID) + ->fetchPairs(); + } + /** * Create an mr link. * @@ -1325,7 +1342,7 @@ class mrModel extends model $commits = array(); foreach($DiffCommits as $DiffCommit) { - $commits[] = substr($DiffCommit->id, 0, 10); + if(isset($DiffCommit->id)) $commits[] = substr($DiffCommit->id, 0, 10); } return $this->dao->select('objectID')->from(TABLE_ACTION)->where('objectType')->eq($type)->andWhere('extra')->in($commits)->fetchPairs('objectID'); diff --git a/module/product/control.php b/module/product/control.php index 5c028d8df9..272fa4ea0d 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -1048,7 +1048,7 @@ class product extends control /* Get product reviewers. */ $product = $this->product->getByID($productID); $productReviewers = $product->reviewer; - if(!$productReviewers) $productReviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', ''); + if(!$productReviewers and $product->acl != 'open') $productReviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', ''); $storyReviewers = ''; if($storyID) diff --git a/module/story/control.php b/module/story/control.php index aa00d7b601..d7bd5edc46 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -305,7 +305,7 @@ class story extends control /* Get reviewers. */ $reviewers = $product->reviewer; - if(!$reviewers) $reviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', ''); + if(!$reviewers and $product->acl != 'open') $reviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', ''); /* Set Custom. */ foreach(explode(',', $this->config->story->list->customCreateFields) as $field) $customFields[$field] = $this->lang->story->$field; @@ -469,7 +469,7 @@ class story extends control /* Get reviewers. */ $reviewers = $product->reviewer; - if(!$reviewers) $reviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', ''); + if(!$reviewers and $product->acl != 'open') $reviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', ''); /* Init vars. */ $planID = $plan; @@ -685,7 +685,7 @@ class story extends control /* Get product reviewers. */ $productReviewers = $product->reviewer; - if(!$productReviewers) $productReviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', ''); + if(!$productReviewers and $product->acl != 'open') $productReviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', ''); $this->story->replaceURLang($story->type); @@ -937,7 +937,7 @@ class story extends control /* Get product reviewers. */ $productReviewers = $product->reviewer; - if(!$productReviewers) $productReviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', ''); + if(!$productReviewers and $product->acl != 'open') $productReviewers = $this->loadModel('user')->getProductViewListUsers($product, '', '', ''); /* Assign. */ $this->view->title = $this->lang->story->change . "STORY" . $this->lang->colon . $this->view->story->title;