diff --git a/module/execution/control.php b/module/execution/control.php index be01e4169e..56bc1e018d 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1678,8 +1678,9 @@ class execution extends control if($this->app->tab == 'project') { $projectID = $this->session->project; + $project = $this->project->getById($projectID); $this->project->setMenu($projectID); - $this->view->project = $this->project->getById($projectID); + $this->view->project = $project; } if(!$this->post->executionIDList) return print(js::locate($this->session->executionList, 'parent')); @@ -1717,7 +1718,7 @@ class execution extends control $this->view->position[] = $this->lang->execution->batchEdit; $this->view->executionIDList = $executionIDList; $this->view->executions = $executions; - $this->view->allProjects = $this->project->getPairsByModel('all', 0, 'noclosed', isset($projectID) ? $projectID : 0); + $this->view->allProjects = $this->project->getPairsByModel($project->model, 0, 'noclosed', isset($projectID) ? $projectID : 0); $this->view->pmUsers = $pmUsers; $this->view->poUsers = $poUsers; $this->view->qdUsers = $qdUsers; diff --git a/module/execution/js/batchedit.js b/module/execution/js/batchedit.js index f9fca2bb2b..6c0e349d09 100644 --- a/module/execution/js/batchedit.js +++ b/module/execution/js/batchedit.js @@ -1,13 +1,14 @@ -$(function() +function changeProject(obj, executionID, projectID) { - $('[id^="projects"]').change(function() + var $td = $(obj).closest('td'); + if($td.find('[id^="syncStories"]').length == 0) { - var executionID = $(this).attr('id').replace('projects', ''); - var $td = $(this).closest('td'); - if($td.find('[id^="syncStories"]').length == 0) - { - $td.append(""); - } - $("#syncStories" + executionID).val(confirm(confirmSyncStories) ? 'yes' : 'no'); - }) -}); + $td.append(""); + } + var confirmVal = confirm(confirmSync); + $("#syncStories" + executionID).val(confirmVal ? 'yes' : 'no'); + if(!confirmVal) + { + $(obj).val(projectID).trigger("chosen:updated"); + } +}; diff --git a/module/execution/lang/en.php b/module/execution/lang/en.php index c9aa6aa2f0..0c7530ff03 100644 --- a/module/execution/lang/en.php +++ b/module/execution/lang/en.php @@ -340,7 +340,7 @@ if($config->systemMode == 'new') $lang->execution->copyTeamTitle = "Choose a $lang->execution->confirmDelete = "Do you want to delete the {$lang->executionCommon}[%s]?"; $lang->execution->confirmUnlinkMember = "Do you want to unlink this User from {$lang->executionCommon}?"; $lang->execution->confirmUnlinkStory = "After {$lang->SRCommon} is removed, cased linked to {$lang->SRCommon} will be reomoved and tasks linked to {$lang->SRCommon} will be cancelled. Do you want to continue?"; -$lang->execution->confirmSyncStories = "After modifying the project, synchronize the execution related {$lang->SRCommon} to the new project?"; +$lang->execution->confirmSync = "After modifying the project, in order to maintain the consistency of data, the data of products, requirements, teams and whitelist associated with the implementation will be synchronized to the new project. Please know."; $lang->execution->confirmUnlinkExecutionStory = "Do you want to unlink this Story from the execution?"; $lang->execution->notAllowedUnlinkStory = "This {$lang->SRCommon} is linked to the {$lang->executionCommon} of the execution. Remove it from the {$lang->executionCommon}, then try again."; $lang->execution->notAllowRemoveProducts = "The story of this product is linked with the {$lang->executionCommon}. Unlink it before doing any action."; diff --git a/module/execution/lang/zh-cn.php b/module/execution/lang/zh-cn.php index 9248f804cb..b3cd85caf9 100644 --- a/module/execution/lang/zh-cn.php +++ b/module/execution/lang/zh-cn.php @@ -340,7 +340,7 @@ if($config->systemMode == 'new') $lang->execution->copyTeamTitle = "选择 $lang->execution->confirmDelete = "您确定删除{$lang->executionCommon}[%s]吗?"; $lang->execution->confirmUnlinkMember = "您确定从该{$lang->executionCommon}中移除该用户吗?"; $lang->execution->confirmUnlinkStory = "移除该{$lang->SRCommon}后,该{$lang->SRCommon}关联的用例将被移除,该{$lang->SRCommon}关联的任务将被取消,请确认。"; -$lang->execution->confirmSyncStories = "修改所属项目后,执行关联的{$lang->SRCommon}是否同步到新项目中?"; +$lang->execution->confirmSync = "修改所属项目后,为了保持数据的一致性,该执行所关联的产品、需求、团队和白名单数据将会同步到新的项目中,请知悉。"; $lang->execution->confirmUnlinkExecutionStory = "您确定从该项目中移除该{$lang->SRCommon}吗?"; $lang->execution->notAllowedUnlinkStory = "该{$lang->SRCommon}已经与项目下{$lang->executionCommon}相关联,请从{$lang->executionCommon}中移除后再操作。"; $lang->execution->notAllowRemoveProducts = "该{$lang->productCommon}中的{$lang->SRCommon}已与该{$lang->executionCommon}进行了关联,请取消关联后再操作。"; diff --git a/module/execution/model.php b/module/execution/model.php index b3180f1394..266c19d257 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -684,6 +684,27 @@ class executionModel extends model $projectID = isset($execution->project) ? $execution->project : $oldExecution->project; $project = $this->project->getByID($projectID); + if(isset($execution->project)) + { + $executionProductList = $this->loadModel('product')->getProducts($executionID); + $projectProductList = $this->product->getProducts($execution->project); + $executionProductIdList = array_keys($executionProductList); + $projectProductIdList = array_keys($projectProductList); + $diffProductIdList = array_diff($executionProductIdList, $projectProductIdList); + if(!empty($diffProductIdList)) + { + foreach($diffProductIdList as $key => $newProductID) + { + $data = $this->dao->select('*')->from(TABLE_PROJECTPRODUCT) + ->where('project')->eq($executionID) + ->andWhere('product')->eq($newProductID) + ->fetch(); + $data->project = $execution->project; + $this->dao->insert(TABLE_PROJECTPRODUCT)->data($data)->exec(); + } + } + } + if($project and $execution->begin < $project->begin) { dao::$errors['begin'] = sprintf($this->lang->execution->errorLetterProject, $project->begin); diff --git a/module/execution/view/batchedit.html.php b/module/execution/view/batchedit.html.php index 2ad0a2b496..5520f67890 100755 --- a/module/execution/view/batchedit.html.php +++ b/module/execution/view/batchedit.html.php @@ -83,7 +83,7 @@