* Finish task #7401.

This commit is contained in:
chenfei
2020-07-20 11:23:04 +08:00
parent bb1d677e25
commit b2f7a2ee17
8 changed files with 37 additions and 9 deletions
+1
View File
@@ -222,6 +222,7 @@ $lang->story->mustChoosePreVersion = 'Version wählen um es umzukhren.';
$lang->story->noStory = 'Keine Storys. ';
$lang->story->ignoreChangeStage = 'Story %s is a draft. Please review it..';
$lang->story->cannotDeleteParent = "Can not delete parent {$lang->storyCommon}";
$lang->story->moveChildrenTips = "Move child {$lang->storyCommon} to selected product when modified product property of parent {$lang->storyCommon}.";
$lang->story->form = new stdclass();
$lang->story->form->area = 'Story Bereich';
+1
View File
@@ -225,6 +225,7 @@ $lang->story->mustChoosePreVersion = 'Select a version to revert to.';
$lang->story->noStory = 'No stories yet. ';
$lang->story->ignoreChangeStage = 'Story %s is a draft. Please review it..';
$lang->story->cannotDeleteParent = "Can not delete parent {$lang->storyCommon}";
$lang->story->moveChildrenTips = "Move child {$lang->storyCommon} to selected product when modified product property of parent {$lang->storyCommon}.";
$lang->story->form = new stdclass();
$lang->story->form->area = 'Scope';
+1
View File
@@ -222,6 +222,7 @@ $lang->story->mustChoosePreVersion = 'Sélect une version pour revenir en arri
$lang->story->noStory = "Aucune story pour l'instant. ";
$lang->story->ignoreChangeStage = "Story %s est à l'état brouillon et nécessite d'être complétée et validée...";
$lang->story->cannotDeleteParent = "Can not delete parent {$lang->storyCommon}";
$lang->story->moveChildrenTips = "Move child {$lang->storyCommon} to selected product when modified product property of parent {$lang->storyCommon}.";
$lang->story->form = new stdclass();
$lang->story->form->area = 'Périmètre';
+1
View File
@@ -222,6 +222,7 @@ $lang->story->mustChoosePreVersion = 'Chọn một phiên bản để chuyển t
$lang->story->noStory = 'Không có câu chuyện nào';
$lang->story->ignoreChangeStage = 'Câu chuyện %s là bản nháp. Vui lòng xét duyệt nó..';
$lang->story->cannotDeleteParent = "Không thể xóa {$lang->storyCommon} mẹ";
$lang->story->moveChildrenTips = "Move child {$lang->storyCommon} to selected product when modified product property of parent {$lang->storyCommon}.";
$lang->story->form = new stdclass();
$lang->story->form->area = 'Phạm vi';
+1
View File
@@ -225,6 +225,7 @@ $lang->story->mustChoosePreVersion = '必须选择回溯的版本';
$lang->story->noStory = "暂时没有{$lang->storyCommon}。";
$lang->story->ignoreChangeStage = "{$lang->storyCommon} %s 为草稿状态,没有修改其阶段。";
$lang->story->cannotDeleteParent = "不能删除父{$lang->storyCommon}";
$lang->story->moveChildrenTips = "修改父{$lang->storyCommon}的所属产品会将其下的子{$lang->storyCommon}也移动到所选产品下。";
$lang->story->form = new stdclass();
$lang->story->form->area = "该{$lang->storyCommon}所属范围";
+28 -9
View File
@@ -597,16 +597,11 @@ class storyModel extends model
{
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')->in($storyProjects)->andWhere('product')->eq($story->product)->orderBy('project')->fetchPairs('project','project');
$unlinkedProjects = array_diff($storyProjects, $linkedProjects);
foreach($unlinkedProjects as $projectID)
$this->updateStoryProduct($storyID, $story->product);
if($oldStory->parent == '-1')
{
$data = new stdclass();
$data->project = $projectID;
$data->product = $story->product;
$this->dao->replace(TABLE_PROJECTPRODUCT)->data($data)->exec();
$childStories = $this->dao->select('id')->from(TABLE_STORY)->where('parent')->eq($storyID)->andWhere('deleted')->eq(0)->fetchPairs('id');
foreach($childStories as $childStoryID) $this->updateStoryProduct($childStoryID, $story->product);
}
}
@@ -667,6 +662,30 @@ class storyModel extends model
}
}
/**
* Update story product.
*
* @param int $storyID
* @param int $productID
* @access public
* @return void
*/
public function updateStoryProduct($storyID, $productID)
{
$this->dao->update(TABLE_STORY)->set('product')->eq($productID)->where('id')->eq($storyID)->exec();
$this->dao->update(TABLE_PROJECTSTORY)->set('product')->eq($productID)->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')->in($storyProjects)->andWhere('product')->eq($productID)->orderBy('project')->fetchPairs('project','project');
$unlinkedProjects = array_diff($storyProjects, $linkedProjects);
foreach($unlinkedProjects as $projectID)
{
$data = new stdclass();
$data->project = $projectID;
$data->product = $productID;
$this->dao->replace(TABLE_PROJECTPRODUCT)->data($data)->exec();
}
}
/**
* Update parent status.
*
+2
View File
@@ -11,6 +11,8 @@
*/
?>
<?php include './header.html.php';?>
<?php js::set('parentStory', !empty($story->children));?>
<?php js::set('moveChildrenTips', $lang->story->moveChildrenTips);?>
<div class='main-content' id='mainContent'>
<form method='post' enctype='multipart/form-data' target='hiddenwin' id='dataform'>
<div class='main-header'>
+2
View File
@@ -3,6 +3,8 @@
<script>
function loadProduct(productID)
{
if(parentStory) alert(moveChildrenTips);
loadProductBranches(productID)
loadProductModules(productID);
loadProductPlans(productID);