diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php
index ef1e82c97d..25b585c81b 100644
--- a/module/product/view/browse.html.php
+++ b/module/product/view/browse.html.php
@@ -205,7 +205,7 @@
children)) ? ' table-child-bottom' : '';?>
- $value) $this->story->printCell($value, $child, $users, $branches, $storyStages, $modulePairs, $storyTasks, $storyBugs, $storyCases, $useDatatable ? 'datatable' : 'table');?>
+ $value) $this->story->printCell($value, $child, $users, $branches, $storyStages, $modulePairs, $storyTasks, $storyBugs, $storyCases, $useDatatable ? 'datatable' : 'table', $storyType);?>
diff --git a/module/story/model.php b/module/story/model.php
index 0109ec631b..6c7cce951e 100644
--- a/module/story/model.php
+++ b/module/story/model.php
@@ -1597,7 +1597,7 @@ class storyModel extends model
->andWhere('deleted')->eq(0)
->andWhere('type')->eq($type)
->orderBy($orderBy)->page($pager)->fetchAll('id');
- return $this->mergePlanTitle($productID, $stories, $branch);
+ return $this->mergePlanTitle($productID, $stories, $branch, $type);
}
/**
@@ -1757,7 +1757,7 @@ class storyModel extends model
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
- return $this->mergePlanTitle($productID, $stories, $branch);
+ return $this->mergePlanTitle($productID, $stories, $branch, $type);
}
/**
@@ -1783,7 +1783,7 @@ class storyModel extends model
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
- return $this->mergePlanTitle($productID, $stories, $branch);
+ return $this->mergePlanTitle($productID, $stories, $branch, $type);
}
/**
@@ -2106,7 +2106,7 @@ class storyModel extends model
$productIdList = array();
foreach($stories as $story) $productIdList[$story->product] = $story->product;
- return $this->mergePlanTitle($productIdList, $stories);
+ return $this->mergePlanTitle($productIdList, $stories, 0, $storyType);
}
/**
@@ -2618,6 +2618,7 @@ class storyModel extends model
if($action == 'activate') return $story->status == 'closed';
if($action == 'assignto') return $story->status != 'closed';
if($action == 'batchcreate' and $story->parent > 0) return false;
+ if($action == 'batchcreate' and $story->type == 'requirement') return false;
if($action == 'batchcreate' and ($story->status != 'active' or $story->stage != 'wait')) return false;
return true;
@@ -2633,7 +2634,7 @@ class storyModel extends model
* @access public
* @return array
*/
- public function mergePlanTitle($productID, $stories, $branch = 0)
+ public function mergePlanTitle($productID, $stories, $branch = 0, $type = 'story')
{
$query = $this->dao->get();
if(is_array($branch))
@@ -2647,6 +2648,26 @@ class storyModel extends model
->andWhere('deleted')->eq(0)
->fetchPairs('id', 'title');
+ /* For requirement children. */
+ if($type == 'requirement' && $this->config->storyCommon == 0)
+ {
+ $relations = $this->dao->select('DISTINCT AID, BID')->from(TABLE_RELATION)
+ ->where('AID')->in(array_keys($stories))
+ ->andWhere('AType')->eq('requirement')
+ ->andWhere('BType')->eq('story')
+ ->andWhere('relation')->eq('subdivideinto')
+ ->fetchAll();
+
+ $group = array();
+ foreach($relations as $relation) $group[$relation->AID][] = $relation->BID;
+
+ foreach($stories as $story)
+ {
+ if(!isset($group[$story->id])) continue;
+ $story->children = $this->getByList($group[$story->id]);
+ }
+ }
+
$parents = array();
$tmpStories = array();
foreach($stories as $story)
@@ -2697,7 +2718,7 @@ class storyModel extends model
* @access public
* @return void
*/
- public function printCell($col, $story, $users, $branches, $storyStages, $modulePairs = array(), $storyTasks = array(), $storyBugs = array(), $storyCases = array(), $mode = 'datatable')
+ public function printCell($col, $story, $users, $branches, $storyStages, $modulePairs = array(), $storyTasks = array(), $storyBugs = array(), $storyCases = array(), $mode = 'datatable', $storyType = 'story')
{
$canView = common::hasPriv('story', 'view');
$storyLink = helper::createLink('story', 'view', "storyID=$story->id");
@@ -2724,7 +2745,7 @@ class storyModel extends model
}
elseif($id == 'plan')
{
- $title = $story->planTitle;
+ $title = isset($story->planTitle) ? $story->planTitle : '';
$class .= ' text-ellipsis';
}
else if($id == 'sourceNote')
@@ -2755,6 +2776,7 @@ class storyModel extends model
echo "";
break;
case 'title':
+ if($storyType == 'requirement') echo 'SR ';
if($story->parent > 0 and isset($story->parentName)) $story->title = "{$story->parentName} / {$story->title}";
if($story->branch and isset($branches[$story->branch])) echo "{$branches[$story->branch]} ";
if($story->module and isset($modulePairs[$story->module])) echo "{$modulePairs[$story->module]} ";
@@ -2763,7 +2785,7 @@ class storyModel extends model
if(!empty($story->children)) echo '';
break;
case 'plan':
- echo $story->planTitle;
+ echo isset($story->planTitle) ? $story->planTitle : '';
break;
case 'branch':
echo zget($branches, $story->branch, '');