* finish task #2850.

This commit is contained in:
wangyidong
2017-01-13 11:12:25 +08:00
parent ad25d007d9
commit 9855a93bf3
2 changed files with 20 additions and 3 deletions
+18 -1
View File
@@ -466,7 +466,24 @@ class storyModel extends model
->checkIF(isset($story->closedReason) and $story->closedReason == 'duplicate', 'duplicateStory', 'notempty')
->where('id')->eq((int)$storyID)->exec();
if(!dao::isError()) return common::createChanges($oldStory, $story);
if(!dao::isError())
{
if($story->product != $oldStory->product)
{
$this->dao->update(TABLE_PROJECTSTORY)->set('product')->eq($story->product)->where('story')->eq($storyID)->exec();
$storyProjects = $this->dao->select('project')->from(TABLE_PROJECTSTORY)->where('story')->eq($storyID)->orderBy('project')->fetchPairs('project', 'project');
$linkedProjects = $this->dao->select('project')->from(TABLE_PROJECTPRODUCT)->where('project')->eq($storyProjects)->andWhere('product')->eq($story->product)->orderBy('project')->fetchPairs('project','project');
$unlinkedProjects = array_diff($storyProjects, $linkedProjects);
foreach($unlinkedProjects as $projectID)
{
$data = new stdclass();
$data->project = $projectID;
$data->product = $story->product;
$this->dao->insert(TABLE_PROJECTPRODUCT)->data($data)->exec();
}
}
return common::createChanges($oldStory, $story);
}
}
/**
+2 -2
View File
@@ -198,9 +198,9 @@
<th><?php echo $lang->story->stage;?></th>
<td>
<?php
if($story->stages)
if($story->stages and $branches)
{
foreach($story->stages as $branch => $stage) echo $branches[$branch] . ' : ' . $lang->story->stageList[$stage] . '<br />';
foreach($story->stages as $branch => $stage) if(isset($branches[$branch])) echo $branches[$branch] . ' : ' . $lang->story->stageList[$stage] . '<br />';
}
else
{