From 553255a1bf42864f70dc3d18eb997f9645689ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Thu, 2 Sep 2021 11:16:23 +0800 Subject: [PATCH 1/4] * adjust for upgrade. --- module/upgrade/model.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 58c203aea7..dd28676d03 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -705,6 +705,7 @@ class upgradeModel extends model $this->appendExec('15_3'); case '15_4': $this->saveLogs('Execute 15_4'); + $this->execSQL($this->getUpgradeFile('15.4')); if(empty($this->config->isINT)) { if(!$executeXuanxuan) @@ -908,6 +909,7 @@ class upgradeModel extends model case '15_2': $confirmContent .= file_get_contents($this->getUpgradeFile('15.2')); case '15_3': $confirmContent .= file_get_contents($this->getUpgradeFile('15.3')); case '15_4': + $confirmContent .= file_get_contents($this->getUpgradeFile('15.4')); if(empty($this->config->isINT)) { $xuanxuanSql = $this->app->getAppRoot() . 'db' . DS . 'upgradexuanxuan4.2.sql'; From 6f7835da43cbb732829067b8b632d3f98fdd26e1 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Thu, 2 Sep 2021 13:02:26 +0800 Subject: [PATCH 2/4] * Fix bug #14568. --- module/execution/css/common.css | 1 - module/execution/css/create.css | 1 - module/execution/js/create.js | 3 +++ module/execution/model.php | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/module/execution/css/common.css b/module/execution/css/common.css index b944d263d0..b3f5061a7b 100644 --- a/module/execution/css/common.css +++ b/module/execution/css/common.css @@ -27,4 +27,3 @@ #whitelistBox .checkbox-inline, #whitelistBox .radio-inline {margin-left: 10px; display: inline-block; padding-left: 0px; padding-right: 10px;} .main-table > .table-responsive {padding: 0 1px; background: #fff;} -#teams_chosen ul li:first-child {max-width:256px; display: inline-block; vertical-align: middle;} diff --git a/module/execution/css/create.css b/module/execution/css/create.css index dd61b6bbba..d482356317 100644 --- a/module/execution/css/create.css +++ b/module/execution/css/create.css @@ -14,5 +14,4 @@ .checkbox input[type=checkbox], .checkbox-inline input[type=checkbox], .radio input[type=radio], .radio-inline input[type=radio] {margin-top: 1px;} #lifeTimeTips {display: none;} -#teams_chosen ul > li:first-child {max-width: 425px;} #teams_chosen ul .label {margin-top: 3px;} diff --git a/module/execution/js/create.js b/module/execution/js/create.js index fd90c0791f..8f82a97143 100644 --- a/module/execution/js/create.js +++ b/module/execution/js/create.js @@ -48,8 +48,11 @@ $(function() { if(systemMode == 'new') { + var maxWidth = $('.chosen-container .chosen-drop.chosen-auto-max-width.in').width() - 70; + $('#teams_chosen ul .label').remove(); $('#teams_chosen ul li:first').after(' '); + $('#teams_chosen ul > li:first').attr('style', 'display: inline-block; vertical-align: middle; max-width: ' + maxWidth + 'px'); } }) diff --git a/module/execution/model.php b/module/execution/model.php index 35a0472e04..c64ed00bb7 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2448,7 +2448,7 @@ class executionModel extends model */ public function getTeamPairsByProject($projectID = 0) { - if(empty($projectID)) return array(); + if(empty($projectID) and $this->config->systemMode == 'new') return array(); $teams = $this->dao->select('id,name,type')->from(TABLE_PROJECT) ->where('deleted')->eq(0) From 1b0f19c0b92ac8f9e3c074e960a5a75526477e86 Mon Sep 17 00:00:00 2001 From: liyuchun Date: Thu, 2 Sep 2021 13:05:19 +0800 Subject: [PATCH 3/4] * Fix bug #14871. --- module/doc/css/objectlibs.css | 1 + 1 file changed, 1 insertion(+) diff --git a/module/doc/css/objectlibs.css b/module/doc/css/objectlibs.css index 1cadc6f3f0..e78f8ac770 100644 --- a/module/doc/css/objectlibs.css +++ b/module/doc/css/objectlibs.css @@ -16,6 +16,7 @@ .main-col .doc-title .actions a + a {margin-left: 8px;} .main-col .doc-title .actions i {font-size: 15px; color: #8c8c8c;} #content .title {max-width: 54%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;} +#content .detail-content {padding-left: 10px;} #mainContent .scrollbar-hover {max-height: 2000px; overflow: scroll;} #sidebar {width: 275px;} #sidebar>.cell {width: 100%;} From 76945e64ff495f4a1f3dd209a72040de5341407f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Thu, 2 Sep 2021 13:13:04 +0800 Subject: [PATCH 4/4] * Sync stories to new project when change execution project. --- module/execution/js/batchedit.js | 13 ++++++++++++ module/execution/js/edit.js | 8 ++++++-- module/execution/lang/zh-cn.php | 1 + module/execution/model.php | 25 ++++++++++++++++++++---- module/execution/view/batchedit.html.php | 1 + module/execution/view/edit.html.php | 1 + 6 files changed, 43 insertions(+), 6 deletions(-) create mode 100644 module/execution/js/batchedit.js diff --git a/module/execution/js/batchedit.js b/module/execution/js/batchedit.js new file mode 100644 index 0000000000..9017c3682f --- /dev/null +++ b/module/execution/js/batchedit.js @@ -0,0 +1,13 @@ +$(function() +{ + $('[id^="projects"]').change(function() + { + executionID = $(this).attr('id').replace('projects', ''); + $td = $(this).closest('td'); + if($td.find('[id^="syncStories"]').length == 0) + { + $td.append(""); + } + $("#syncStories" + executionID).val(confirm(confirmSyncStories) ? 'yes' : 'no'); + }) +}); diff --git a/module/execution/js/edit.js b/module/execution/js/edit.js index e17d014f62..6149182c46 100644 --- a/module/execution/js/edit.js +++ b/module/execution/js/edit.js @@ -19,10 +19,14 @@ $(function() $(this).siblings('div').find('span').attr('title', tip); } }); - + oldProject = $("#project").val(); $('#project').change(function() { - if(!confirm('修改所属项目后,执行关联的原项目需求如果要更改所属项目,需手动修改到新项目,是否继续修改?')) $("#project").val(oldProject).trigger("chosen:updated"); + if($('#submit').closest('td').find('#syncStories').length == 0) + { + $('#submit').after(""); + } + $("#syncStories").val(confirm(confirmSyncStories) ? 'yes' : 'no'); }); }) diff --git a/module/execution/lang/zh-cn.php b/module/execution/lang/zh-cn.php index d3b5f6dea1..b0b406b2b5 100644 --- a/module/execution/lang/zh-cn.php +++ b/module/execution/lang/zh-cn.php @@ -315,6 +315,7 @@ $lang->execution->linkAllStoryTip = "(项目下还未关联{$lang->SRCommon} $lang->execution->confirmDelete = "您确定删除{$lang->executionCommon}[%s]吗?"; $lang->execution->confirmUnlinkMember = "您确定从该{$lang->executionCommon}中移除该用户吗?"; $lang->execution->confirmUnlinkStory = "您确定从该{$lang->executionCommon}中移除该{$lang->SRCommon}吗?"; +$lang->execution->confirmSyncStories = "修改所属项目后,执行关联的{$lang->SRCommon}是否同步到新项目中?"; $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 35a0472e04..48aac5c2a0 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -473,7 +473,7 @@ class executionModel extends model ->setDefault('team', $this->post->name) ->join('whitelist', ',') ->stripTags($this->config->execution->editor->edit['id'], $this->config->allowedTags) - ->remove('products, branch, uid, plans') + ->remove('products, branch, uid, plans, syncStories') ->get(); if($this->config->systemMode == 'new' and (empty($execution->project) or $execution->project == $oldExecution->project)) $this->checkBeginAndEndDate($oldExecution->project, $execution->begin, $execution->end); @@ -544,7 +544,7 @@ class executionModel extends model { $execution->parent = $execution->project; $execution->path = ",{$execution->project},{$executionID},"; - $this->changeProject($execution->project, $oldExecution->project, $executionID); + $this->changeProject($execution->project, $oldExecution->project, $executionID, $this->post->syncStories); } $this->file->updateObjectID($this->post->uid, $executionID, 'execution'); @@ -649,7 +649,7 @@ class executionModel extends model { $execution->parent = $execution->project; $execution->path = ",{$execution->project},{$executionID},"; - $this->changeProject($execution->project, $oldExecution->project, $executionID); + $this->changeProject($execution->project, $oldExecution->project, $executionID, isset($_POST['syncStories'][$executionID]) ? $_POST['syncStories'][$executionID] : 'no'); } $changedAccounts = array(); @@ -2104,10 +2104,11 @@ class executionModel extends model * @param int $newProject * @param int $oldProject * @param int $executionID + * @param string $syncStories yes|no * @access public * @return void */ - public function changeProject($newProject, $oldProject, $executionID) + public function changeProject($newProject, $oldProject, $executionID, $syncStories = 'no') { if($newProject == $oldProject) return; @@ -2157,6 +2158,22 @@ class executionModel extends model $addedAccounts[$account] = $account; } + /* Sync stories to new project. */ + if($syncStories == 'yes') + { + $this->loadModel('action'); + $projectLinkedStories = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($newProject)->fetchPairs('story', 'story'); + $executionLinkedStories = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($executionID)->fetchAll(); + foreach($executionLinkedStories as $linkedStory) + { + if(isset($projectLinkedStories[$linkedStory->story])) continue; + + $linkedStory->project = $newProject; + $this->dao->insert(TABLE_PROJECTSTORY)->data($linkedStory)->exec(); + $this->action->create('story', $linkedStory->story, 'linked2project', '', $newProject); + } + } + if($addedAccounts) $this->loadModel('user')->updateUserView($newProject, 'project', $addedAccounts); } diff --git a/module/execution/view/batchedit.html.php b/module/execution/view/batchedit.html.php index 8d9d0ed0de..027eddac5e 100755 --- a/module/execution/view/batchedit.html.php +++ b/module/execution/view/batchedit.html.php @@ -132,4 +132,5 @@ execution->weekend);?> +execution->confirmSyncStories);?> diff --git a/module/execution/view/edit.html.php b/module/execution/view/edit.html.php index 3014a6f578..3e614444a5 100644 --- a/module/execution/view/edit.html.php +++ b/module/execution/view/edit.html.php @@ -173,4 +173,5 @@ execution->errorSameProducts);?> execution->notAllowRemoveProducts);?> +execution->confirmSyncStories);?>