Merge branch 'master' of github.com:easysoft/zentaopms

This commit is contained in:
wangyidong
2016-11-17 11:37:19 +08:00
8 changed files with 149 additions and 11 deletions
+35
View File
@@ -1213,6 +1213,41 @@ class bugModel extends model
return $bugs;
}
/**
* Get bugs of a story.
*
* @param int $storyID
* @access public
* @return array
*/
public function getStoryBugs($storyID)
{
return $this->dao->select('id, title, type, status, assignedTo, resolvedBy, resolution')
->from(TABLE_BUG)
->where('story')->eq((int)$storyID)
->andWhere('deleted')->eq(0)
->fetchAll('id');
}
/**
* Get counts of some stories' bugs.
*
* @param array $stories
* @access public
* @return int
*/
public function getStoryBugCounts($stories)
{
$bugCounts = $this->dao->select('story, COUNT(*) AS bugs')
->from(TABLE_BUG)
->where('story')->in($stories)
->andWhere('deleted')->eq(0)
->groupBy('story')
->fetchPairs();
foreach($stories as $storyID) if(!isset($bugCounts[$storyID])) $bugCounts[$storyID] = 0;
return $bugCounts;
}
/**
* Get bug info from a result.
*
+10
View File
@@ -159,6 +159,13 @@ class product extends control
/* Process the sql, get the conditon partion, save it to session. */
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'story');
/* Get related tasks, bugs, cases count of each story. */
$storyIdList = array();
foreach($stories as $story) $storyIdList[$story->id] = $story->id;
$storyTasks = $this->loadModel('task')->getStoryTaskCounts($storyIdList);
$storyBugs = $this->loadModel('bug')->getStoryBugCounts($storyIdList);
$storyCases = $this->loadModel('testcase')->getStoryCaseCounts($storyIdList);
/* Build search form. */
$actionURL = $this->createLink('product', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID");
$this->config->product->search['onMenuBar'] = 'yes';
@@ -191,6 +198,9 @@ class product extends control
$this->view->branches = $this->loadModel('branch')->getPairs($productID);
$this->view->storyStages = $this->product->batchGetStoryStage($stories);
$this->view->setShowModule = true;
$this->view->storyTasks = $storyTasks;
$this->view->storyBugs = $storyBugs;
$this->view->storyCases = $storyCases;
$this->view->param = $param;
$this->display();
}
+2 -1
View File
@@ -12,6 +12,7 @@
?>
<?php include '../../common/view/header.html.php';?>
<?php include '../../common/view/datatable.fix.html.php';?>
<?php include '../../common/view/tablesorter.html.php';?>
<?php js::set('browseType', $browseType);?>
<div id='featurebar'>
<ul class='nav'>
@@ -109,7 +110,7 @@
?>
<tfoot>
<tr>
<td colspan='11'>
<td colspan='14'>
<div class='table-actions clearfix'>
<?php if(count($stories)):?>
<?php echo html::selectButton();?>
+31 -10
View File
@@ -13,16 +13,19 @@
<table class='table table-condensed table-hover table-striped tablesorter table-fixed' id='storyList'>
<thead>
<tr>
<th class='w-id'> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th class='w-pri'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
<th class='w-p30'> <?php common::printOrderLink('title', $orderBy, $vars, $lang->story->title);?></th>
<th> <?php common::printOrderLink('plan', $orderBy, $vars, $lang->story->planAB);?></th>
<th> <?php common::printOrderLink('source', $orderBy, $vars, $lang->story->source);?></th>
<th> <?php common::printOrderLink('openedBy', $orderBy, $vars, $lang->openedByAB);?></th>
<th> <?php common::printOrderLink('assignedTo', $orderBy, $vars, $lang->assignedToAB);?></th>
<th class='w-hour'><?php common::printOrderLink('estimate', $orderBy, $vars, $lang->story->estimateAB);?></th>
<th> <?php common::printOrderLink('status', $orderBy, $vars, $lang->statusAB);?></th>
<th> <?php common::printOrderLink('stage', $orderBy, $vars, $lang->story->stageAB);?></th>
<th class='w-id {sorter:false}'> <?php common::printOrderLink('id', $orderBy, $vars, $lang->idAB);?></th>
<th class='w-pri {sorter:false}'> <?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
<th class='w-p30 {sorter:false}'> <?php common::printOrderLink('title', $orderBy, $vars, $lang->story->title);?></th>
<th class='w-70px {sorter:false}'><?php common::printOrderLink('plan', $orderBy, $vars, $lang->story->planAB);?></th>
<th class='w-70px {sorter:false}'><?php common::printOrderLink('source', $orderBy, $vars, $lang->story->source);?></th>
<th class='w-user {sorter:false}'><?php common::printOrderLink('openedBy', $orderBy, $vars, $lang->openedByAB);?></th>
<th class='w-user {sorter:false}'><?php common::printOrderLink('assignedTo', $orderBy, $vars, $lang->assignedToAB);?></th>
<th class='w-hour {sorter:false}'><?php common::printOrderLink('estimate', $orderBy, $vars, $lang->story->estimateAB);?></th>
<th class='w-50px {sorter:false}'><?php common::printOrderLink('status', $orderBy, $vars, $lang->statusAB);?></th>
<th class='w-70px {sorter:false}'><?php common::printOrderLink('stage', $orderBy, $vars, $lang->story->stageAB);?></th>
<th class='w-30px'><?php echo $lang->story->taskCountAB;?></th>
<th class='w-30px'><?php echo $lang->story->bugCountAB;?></th>
<th class='w-30px'><?php echo $lang->story->caseCountAB;?></th>
<th class='w-140px {sorter:false}'><?php echo $lang->actions;?></th>
</tr>
</thead>
@@ -64,6 +67,24 @@
}
?>
</td>
<td class='linkbox'>
<?php
$tasksLink = $this->createLink('story', 'tasks', "storyID=$story->id");
$storyTasks[$story->id] > 0 ? print(html::a($tasksLink, $storyTasks[$story->id], '', 'class="iframe"')) : print(0);
?>
</td>
<td class='linkbox'>
<?php
$bugsLink = $this->createLink('story', 'bugs', "storyID=$story->id");
$storyBugs[$story->id] > 0 ? print(html::a($bugsLink, $storyBugs[$story->id], '', 'class="iframe"')) : print(0);
?>
</td>
<td class='linkbox'>
<?php
$casesLink = $this->createLink('story', 'cases', "storyID=$story->id");
$storyCases[$story->id] > 0 ? print(html::a($casesLink, $storyCases[$story->id], '', 'class="iframe"')) : print(0);
?>
</td>
<td class='text-right'>
<?php
$vars = "story={$story->id}";
+30
View File
@@ -919,6 +919,36 @@ class story extends control
$this->display();
}
/**
* Bugs of a story.
*
* @param int $storyID
* @access public
* @return void
*/
public function bugs($storyID)
{
$this->loadModel('bug');
$this->view->bugs = $this->bug->getStoryBugs($storyID);
$this->view->users = $this->user->getPairs('noletter');
$this->display();
}
/**
* Cases of a story.
*
* @param int $storyID
* @access public
* @return void
*/
public function cases($storyID)
{
$this->loadModel('testcase');
$this->view->cases = $this->testcase->getStoryCases($storyID);
$this->view->users = $this->user->getPairs('noletter');
$this->display();
}
/**
* Show zero case story.
*
+3
View File
@@ -24,6 +24,9 @@ $lang->story->delete = "Delete";
$lang->story->view = "Story Details";
$lang->story->tasks = "Linked Task";
$lang->story->taskCount = 'Tasks';
$lang->story->taskCountAB = 'Tasks';
$lang->story->bugCountAB = 'Bugs';
$lang->story->caseCountAB = 'Cases';
$lang->story->linkStory = 'Link Story';
$lang->story->unlinkStory = 'Unlink Story';
$lang->story->export = "Export Data";
+3
View File
@@ -24,6 +24,9 @@ $lang->story->delete = "删除";
$lang->story->view = "需求详情";
$lang->story->tasks = "相关任务";
$lang->story->taskCount = '任务数';
$lang->story->taskCountAB = '任';
$lang->story->bugCountAB = 'Bug';
$lang->story->caseCountAB = '用';
$lang->story->linkStory = '关联需求';
$lang->story->unlinkStory = '移除相关需求';
$lang->story->export = "导出数据";
+35
View File
@@ -382,6 +382,41 @@ class testcaseModel extends model
->orderBy($orderBy)->page($pager)->fetchAll();
}
/**
* Get cases of a story.
*
* @param int $storyID
* @access public
* @return array
*/
public function getStoryCases($storyID)
{
return $this->dao->select('id, title, type, status, lastRunner, lastRunDate, lastRunResult')
->from(TABLE_CASE)
->where('story')->eq((int)$storyID)
->andWhere('deleted')->eq(0)
->fetchAll('id');
}
/**
* Get counts of some stories' cases.
*
* @param array $stories
* @access public
* @return int
*/
public function getStoryCaseCounts($stories)
{
$caseCounts = $this->dao->select('story, COUNT(*) AS cases')
->from(TABLE_CASE)
->where('story')->in($stories)
->andWhere('deleted')->eq(0)
->groupBy('story')
->fetchPairs();
foreach($stories as $storyID) if(!isset($caseCounts[$storyID])) $caseCounts[$storyID] = 0;
return $caseCounts;
}
/**
* Update a case.
*