From 91cd3751b8a9bb16bc2022f95f88de0e6e23372b Mon Sep 17 00:00:00 2001 From: sunguangming Date: Wed, 5 Jul 2023 10:30:22 +0800 Subject: [PATCH] * Finish task #96496. --- module/group/lang/resource.php | 2 + module/story/config/dtable.php | 9 ++- module/story/control.php | 19 +++++++ module/story/css/relation.ui.css | 1 + module/story/lang/de.php | 1 + module/story/lang/en.php | 1 + module/story/lang/fr.php | 1 + module/story/lang/zh-cn.php | 1 + module/story/tao.php | 18 ++++++ module/story/ui/relation.html.php | 92 +++++++++++++++++++++++++++++++ 10 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 module/story/css/relation.ui.css create mode 100644 module/story/ui/relation.html.php diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index f936738969..f7d221f9f2 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -536,6 +536,7 @@ $lang->resource->story->batchToTask = 'batchToTask'; $lang->resource->story->processStoryChange = 'processStoryChange'; $lang->resource->story->linkStories = 'linkStoriesAB'; $lang->resource->story->relieved = 'relievedTwins'; +$lang->resource->story->relation = 'relation'; $lang->story->methodOrder[5] = 'create'; $lang->story->methodOrder[10] = 'batchCreate'; @@ -566,6 +567,7 @@ $lang->story->methodOrder[125] = 'batchToTask'; $lang->story->methodOrder[130] = 'processStoryChange'; $lang->story->methodOrder[135] = 'linkStories'; $lang->story->methodOrder[140] = 'relieved'; +$lang->story->methodOrder[145] = 'relation'; /* Requirement. */ $lang->resource->requirement = new stdclass(); diff --git a/module/story/config/dtable.php b/module/story/config/dtable.php index 2d04d6a037..32b01b3b0f 100644 --- a/module/story/config/dtable.php +++ b/module/story/config/dtable.php @@ -136,9 +136,16 @@ $config->story->dtable->fieldList['caseCount']['group'] = 7; $config->story->dtable->fieldList['URS']['name'] = 'URS'; $config->story->dtable->fieldList['URS']['title'] = 'UR'; -$config->story->dtable->fieldList['URS']['width'] = '30'; +$config->story->dtable->fieldList['URS']['width'] = '50'; +$config->story->dtable->fieldList['URS']['type'] = 'html'; $config->story->dtable->fieldList['URS']['group'] = 6; +$config->story->dtable->fieldList['SRS']['name'] = 'SRS'; +$config->story->dtable->fieldList['SRS']['title'] = 'SR'; +$config->story->dtable->fieldList['SRS']['width'] = '50'; +$config->story->dtable->fieldList['SRS']['type'] = 'html'; +$config->story->dtable->fieldList['SRS']['group'] = 6; + $config->story->dtable->fieldList['closedBy']['name'] = 'closedBy'; $config->story->dtable->fieldList['closedBy']['title'] = $lang->story->closedBy; $config->story->dtable->fieldList['closedBy']['type'] = 'user'; diff --git a/module/story/control.php b/module/story/control.php index 182450b80f..b05b063f0c 100755 --- a/module/story/control.php +++ b/module/story/control.php @@ -1649,6 +1649,25 @@ class story extends control $this->display(); } + /** + * URS of a story. + * + * @param int $storyID + * @param string $storyType + * @access public + * @return void + */ + public function relation($storyID, $storyType = '') + { + $selectFields = array('id', 'pri', 'title', 'plan', 'openedBy', 'assignedTo', 'estimate', 'status'); + + $this->view->relation = $this->story->getStoryRelation($storyID, $storyType, $selectFields); + $this->view->users = $this->user->getPairs('noletter'); + $this->view->storyType = $storyType; + $this->view->story = $this->story->getById($storyID); + $this->display(); + } + /** * If type is linkStories, link related stories else link child stories. * diff --git a/module/story/css/relation.ui.css b/module/story/css/relation.ui.css new file mode 100644 index 0000000000..712c7b4651 --- /dev/null +++ b/module/story/css/relation.ui.css @@ -0,0 +1 @@ +.table {border: 1px solid #ddd;} diff --git a/module/story/lang/de.php b/module/story/lang/de.php index 9c01116c01..8c421cfe3f 100644 --- a/module/story/lang/de.php +++ b/module/story/lang/de.php @@ -27,6 +27,7 @@ $lang->story->submitReview = "Submit Review"; $lang->story->recall = 'Revoke'; $lang->story->recallChange = 'Undo Changes'; $lang->story->recallAction = 'Undo'; +$lang->story->relation = 'Relations'; $lang->story->needReview = 'Need Review'; $lang->story->batchReview = 'Mehere prüfen'; $lang->story->edit = "Bearbeiten"; diff --git a/module/story/lang/en.php b/module/story/lang/en.php index 1b828693c9..82924cf49c 100644 --- a/module/story/lang/en.php +++ b/module/story/lang/en.php @@ -27,6 +27,7 @@ $lang->story->submitReview = "Submit Review"; $lang->story->recall = 'Revoke'; $lang->story->recallChange = 'Undo Changes'; $lang->story->recallAction = 'Undo'; +$lang->story->relation = 'Relations'; $lang->story->needReview = 'Need Review'; $lang->story->batchReview = 'Batch Review'; $lang->story->edit = "Edit Story"; diff --git a/module/story/lang/fr.php b/module/story/lang/fr.php index a74699d0b2..f4c187f06e 100644 --- a/module/story/lang/fr.php +++ b/module/story/lang/fr.php @@ -27,6 +27,7 @@ $lang->story->submitReview = "Submit Review"; $lang->story->recall = 'Revoke'; $lang->story->recallChange = 'Undo Changes'; $lang->story->recallAction = 'Undo'; +$lang->story->relation = 'Relations'; $lang->story->needReview = 'Validation requise'; $lang->story->batchReview = 'Validation par lot'; $lang->story->edit = "Editer Story"; diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php index 0fa7548e09..778c2fd51e 100644 --- a/module/story/lang/zh-cn.php +++ b/module/story/lang/zh-cn.php @@ -27,6 +27,7 @@ $lang->story->submitReview = "提交评审"; $lang->story->recall = '撤销评审'; $lang->story->recallChange = '撤销变更'; $lang->story->recallAction = '撤销'; +$lang->story->relation = '查看关联需求'; $lang->story->needReview = '需要评审'; $lang->story->batchReview = '批量评审'; $lang->story->edit = "编辑"; diff --git a/module/story/tao.php b/module/story/tao.php index 9596d29a8b..e789ba086b 100644 --- a/module/story/tao.php +++ b/module/story/tao.php @@ -360,6 +360,17 @@ class storyTao extends storyModel $parents = $this->dao->select('id,title')->from(TABLE_STORY)->where('id')->in($parents)->andWhere('deleted')->eq(0)->fetchAll('id'); } + $mainID = $type == 'story' ? 'BID' : 'AID'; + $countID = $type == 'story' ? 'AID' : 'BID'; + + $relations = $this->dao->select("$mainID, count($countID) as count")->from(TABLE_RELATION) + ->where('AType')->eq('requirement') + ->andWhere('BType')->eq('story') + ->andWhere('relation')->eq('subdivideinto') + ->andWhere('product')->eq($productID) + ->groupBy($mainID) + ->fetchAll($mainID); + foreach($stories as $story) { /* Export story linkstories. */ @@ -372,6 +383,13 @@ class storyTao extends storyModel $story->planTitle = ''; $storyPlans = explode(',', trim($story->plan, ',')); foreach($storyPlans as $planID) $story->planTitle .= zget($plans, $planID, '') . ' '; + + if(isset($relations[$story->id])) + { + $link = helper::createLink('story', 'relation', "storyID=$story->id&storyType=$type"); + if($type == 'story') $story->URS = html::a($link, $relations[$story->id]->count, '', "data-toggle='modal'"); + if($type == 'requirement') $story->SRS = html::a($link, $relations[$story->id]->count, '', "data-toggle='modal'"); + } } /* For save session query. */ diff --git a/module/story/ui/relation.html.php b/module/story/ui/relation.html.php new file mode 100644 index 0000000000..cbafbbe0f5 --- /dev/null +++ b/module/story/ui/relation.html.php @@ -0,0 +1,92 @@ + + * @package story + * @link https://www.zentao.net + */ +namespace zin; + +modalHeader(); + +$tbody = array(); +foreach($relation as $key => $story) +{ + $tbody[] = h::tr + ( + h::td + ( + $story->id + ), + h::td + ( + $story->title + ), + h::td + ( + $story->pri + ), + h::td + ( + zget($users, $story->openedBy) + ), + h::td + ( + zget($users, $story->assignedTo) + ), + h::td + ( + $story->estimate + ), + h::td + ( + zget($lang->story->statusList, $story->status) + ) + ); +} + +h::table +( + setClass('table table-fixed'), + h::tr + ( + h::th + ( + set::width('60px'), + $lang->story->id + ), + h::th + ( + $lang->story->title + ), + h::th + ( + set::width('60px'), + $lang->story->pri + ), + h::th + ( + set::width('100px'), + $lang->story->openedBy + ), + h::th + ( + set::width('100px'), + $lang->story->assignedTo + ), + h::th + ( + set::width('80px'), + $lang->story->estimate + ), + h::th + ( + set::width('80px'), + $lang->story->status + ), + ), + $tbody +);