From 3501560f09c4bff71c3b36a74861bab530c5e6d3 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Tue, 23 Mar 2021 15:40:12 +0800 Subject: [PATCH 1/7] * Fix build of project bug. --- module/build/control.php | 6 +++--- module/build/view/view.html.php | 4 ++-- module/execution/control.php | 9 ++++----- module/project/view/build.html.php | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/module/build/control.php b/module/build/control.php index 79abcd2e12..29866bcef0 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -42,8 +42,7 @@ class build extends control { $this->loadModel('project')->setMenu($projectID); $executions = $this->execution->getPairs($projectID); - $executionID = isset($executions[$this->session->executionID]) ? $this->session->executionID : key($executions); - $this->session->set('executionID', 0); + $executionID = $executionID == 0 ? key($executions) : $executionID; $this->session->set('project', $projectID); } elseif($this->app->openApp == 'execution') @@ -284,7 +283,8 @@ class build extends control $this->send($response); } - die(js::locate($this->createLink('execution', 'build', "executionID=$build->execution"), 'parent')); + $link = $this->app->openApp == 'project' ? $this->createLink('project', 'build', "projectID=$build->project") : $this->createLink('execution', 'build', "executionID=$build->execution"); + die(js::locate($link, 'parent')); } } diff --git a/module/build/view/view.html.php b/module/build/view/view.html.php index 70843136ea..863f3d2543 100644 --- a/module/build/view/view.html.php +++ b/module/build/view/view.html.php @@ -53,8 +53,8 @@ tbody tr td:first-child input {display: none;} { echo $this->buildOperateMenu($build, 'view'); - if(common::hasPriv('build', 'edit')) echo html::a($this->createLink('build', 'edit', "buildID=$build->id"), " " . $this->lang->edit, '', "class='btn btn-link' title='{$this->lang->edit}'"); - if(common::hasPriv('build', 'delete')) echo html::a($this->createLink('build', 'delete', "buildID=$build->id"), " " . $this->lang->delete, '', "class='btn btn-link' title='{$this->lang->delete}' target='hiddenwin'"); + if(common::hasPriv('build', 'edit')) echo html::a($this->createLink('build', 'edit', "buildID=$build->id"), " " . $this->lang->edit, '', "class='btn btn-link' title='{$this->lang->edit}' data-app='{$app->openApp}'"); + if(common::hasPriv('build', 'delete')) echo html::a($this->createLink('build', 'delete', "buildID=$build->id"), " " . $this->lang->delete, '', "class='btn btn-link' title='{$this->lang->delete}' target='hiddenwin' data-app='{$app->openApp}'"); } ?> diff --git a/module/execution/control.php b/module/execution/control.php index 8aa893e9b1..577032ef5f 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -2047,6 +2047,9 @@ class execution extends control $browseExecutionLink = $this->createLink('execution', 'browse', "executionID=$executionID"); + $this->loadModel('product'); + $execution = $this->execution->getById($executionID); + if(!empty($_POST)) { /* Get executionType and determine whether a product is linked with the stage. */ @@ -2073,14 +2076,10 @@ class execution extends control if(isonlybody()) { - $this->session->set('executionID' , $executionID); - die(js::reload('parent')); + die(js::locate($this->createLink('build', 'create', "executionID=$executionID&productID=0&projectID=$execution->project"), 'parent')); } } - $this->loadModel('product'); - $execution = $this->execution->getById($executionID); - /* Set menu. */ $this->execution->setMenu($execution->id); diff --git a/module/project/view/build.html.php b/module/project/view/build.html.php index 1f0efc92a9..f1c2bf24f9 100644 --- a/module/project/view/build.html.php +++ b/module/project/view/build.html.php @@ -78,7 +78,7 @@ echo html::a($this->createLink('build', 'view', "buildID=$build->id&type=story&link=true"), "", '', "class='btn' title='{$lang->build->linkStory}' data-app='project'"); } common::printIcon('testtask', 'create', "product=$build->product&executionID={$build->execution}&build=$build->id&projectID=$projectID", $build, 'list', 'bullhorn', '', '', '', "data-app='project'"); - $lang->project->bug = $lang->execution->viewBug; + $lang->build->view = $lang->project->bug; common::printIcon('build', 'view', "buildID=$build->id&type=generatedBug", $build, 'list', 'bug', '', '', '', "data-app='project'"); common::printIcon('build', 'edit', "buildID=$build->id", $build, 'list'); if(common::hasPriv('build', 'delete', $build)) From 1167617573c7beaca474b050ef67acc918f8be9c Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Tue, 23 Mar 2021 15:45:34 +0800 Subject: [PATCH 2/7] * Fix repo error. --- module/repo/control.php | 20 ++++++++++++-------- module/repo/view/maintain.html.php | 11 ++++++++--- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/module/repo/control.php b/module/repo/control.php index f462a73aa4..9ac1561c80 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -27,6 +27,8 @@ class repo extends control die(js::locate('back')); } + $this->projectID = $this->session->project ? $this->session->project : 0; + /* Unlock session for wait to get data of repo. */ session_write_close(); } @@ -106,7 +108,7 @@ class repo extends control * @access public * @return void */ - public function create($objectID) + public function create($objectID = 0) { if($_POST) { @@ -155,7 +157,6 @@ class repo extends control $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('maintain'))); } - $this->repo->setMenu($this->repos, $repo->id, false); $this->app->loadLang('action'); $repo->repoType = $repo->id . '-' . $repo->SCM; @@ -216,7 +217,6 @@ class repo extends control public function view($repoID, $entry, $revision = 'HEAD', $showBug = 'false', $encoding = '') { if($this->get->repoPath) $entry = $this->get->repoPath; - $this->repo->setMenu($this->repos, $repoID); $this->repo->setBackSession('view', $withOtherModule = true); if($repoID == 0) $repoID = $this->session->repoID; @@ -232,6 +232,7 @@ class repo extends control $repo = $this->repo->getRepoByID($repoID); $entry = $this->repo->decodePath($entry); + $this->commonAction($repoID); $this->scm->setEngine($repo); $info = $this->scm->info($entry, $revision); $path = $entry ? $info->path : ''; @@ -434,7 +435,6 @@ class repo extends control public function log($repoID = 0, $entry = '', $revision = 'HEAD', $type = 'dir', $recTotal = 0, $recPerPage = 50, $pageID = 1) { if($this->get->repoPath) $entry = $this->get->repoPath; - $this->repo->setMenu($this->repos, $repoID); $this->repo->setBackSession('log', $withOtherModule = true); if($repoID == 0) $repoID = $this->session->repoID; @@ -453,6 +453,7 @@ class repo extends control $this->locate($this->repo->createLink('diff', "repoID=$repoID&entry=" . $this->repo->encodePath($path) . "&oldrevision=$oldRevision&newRevision=$newRevision")); } + $this->commonAction($repoID); $this->scm->setEngine($repo); $info = $this->scm->info($entry, $revision); @@ -488,7 +489,6 @@ class repo extends control { if($this->get->repoPath) $root = $this->get->repoPath; - $this->repo->setMenu($this->repos, $repoID); $this->repo->setBackSession(); if($repoID == 0) $repoID = $this->session->repoID; $repo = $this->repo->getRepoByID($repoID); @@ -496,6 +496,7 @@ class repo extends control /* Save session. */ $this->session->set('revisionList', $this->app->getURI(true)); + $this->commonAction($repoID); $this->scm->setEngine($repo); $log = $this->scm->log('', $revision, $revision); @@ -585,12 +586,12 @@ class repo extends control public function blame($repoID, $entry, $revision = 'HEAD', $encoding = '') { if($this->get->repoPath) $entry = $this->get->repoPath; - $this->repo->setMenu($this->repos, $repoID); if($repoID == 0) $repoID = $this->session->repoID; $repo = $this->repo->getRepoByID($repoID); $file = $entry; $entry = $this->repo->decodePath($entry); + $this->commonAction($repoID); $this->scm->setEngine($repo); $encoding = empty($encoding) ? $repo->encoding : $encoding; $encoding = strtolower(str_replace('_', '-', $encoding)); @@ -632,7 +633,6 @@ class repo extends control public function diff($repoID, $entry = '', $oldRevision = '0', $newRevision = 'HEAD', $showBug = 'false', $encoding = '') { if($this->get->repoPath) $entry = $this->get->repoPath; - $this->repo->setMenu($this->repos, $repoID); if($repoID == 0) $repoID = $this->session->repoID; $file = $entry; $repo = $this->repo->getRepoByID($repoID); @@ -658,6 +658,7 @@ class repo extends control $this->locate($this->repo->createLink('diff', "repoID=$repoID&entry=" . $this->repo->encodePath($entry) . "&oldrevision=$oldRevision&newRevision=$newRevision&showBug=&encoding=$encoding")); } + $this->commonAction($repoID); $this->scm->setEngine($repo); $encoding = empty($encoding) ? $repo->encoding : $encoding; $encoding = strtolower(str_replace('_', '-', $encoding)); @@ -741,6 +742,8 @@ class repo extends control if($this->get->repoPath) $path = $this->get->repoPath; $entry = $this->repo->decodePath($path); $repo = $this->repo->getRepoByID($repoID); + + $this->commonAction($repoID); $this->scm->setEngine($repo); $content = $type == 'file' ? $this->scm->cat($entry, $fromRevision) : $this->scm->diff($entry, $fromRevision, $toRevision, 'patch'); $fileName = basename(urldecode($entry)); @@ -788,7 +791,6 @@ class repo extends control */ public function showSyncCommit($repoID = 0, $branch = '') { - $this->repo->setMenu($this->repos, $repoID); if($repoID == 0) $repoID = $this->session->repoID; if($branch) $branch = base64_decode($branch); @@ -818,6 +820,7 @@ class repo extends control if(empty($repo)) die(); if($repo->synced) die('finish'); + $this->commonAction($repoID); $this->scm->setEngine($repo); $branchID = ''; @@ -910,6 +913,7 @@ class repo extends control if($repo->SCM != 'Git') die('finish'); if($branch) $branch = base64_decode($branch); + $this->commonAction($repoID); $this->scm->setEngine($repo); $this->repo->setRepoBranch($branch); diff --git a/module/repo/view/maintain.html.php b/module/repo/view/maintain.html.php index 0c158fbc4f..41a88d825e 100644 --- a/module/repo/view/maintain.html.php +++ b/module/repo/view/maintain.html.php @@ -11,6 +11,11 @@ */ ?> +
@@ -28,7 +33,7 @@ $repo):?> - + From 5d2ffea599b0b3ade6a7f2897986b98b15af9fa6 Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Tue, 23 Mar 2021 16:03:59 +0800 Subject: [PATCH 3/7] * Fix upgrade logic. --- db/update15.0.sql | 4 ++++ module/upgrade/model.php | 8 +------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/db/update15.0.sql b/db/update15.0.sql index 3ca69ee6d8..03ec09355d 100644 --- a/db/update15.0.sql +++ b/db/update15.0.sql @@ -349,3 +349,7 @@ update zt_config set `value`='project-browse' where `key`='projectLink'; update zt_config set `value`='program-browse' where `key`='programLink'; update zt_block set source='project', block='projectteam' where block='programteam' and source='program'; update zt_block set source='project', block='project' where block='program' and source='program'; + +update zt_team set type='execution' where type='project'; +update zt_action set objectType='execution' where objectType='project'; +update zt_file set objectType='execution' where objectType='project'; diff --git a/module/upgrade/model.php b/module/upgrade/model.php index a00dc798bc..ee8b018591 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -4315,7 +4315,7 @@ class upgradeModel extends model if(isset($sprint->feedback)) $teams[$sprint->feedback] = $sprint->feedback; } - $teams += $this->dao->select('account')->from(TABLE_TEAM)->where('type')->eq('project')->andWhere('root')->in($sprintIdList)->fetchPairs('account', 'account'); + $teams += $this->dao->select('account')->from(TABLE_TEAM)->where('type')->eq('execution')->andWhere('root')->in($sprintIdList)->fetchPairs('account', 'account'); $users = $this->dao->select('account')->from(TABLE_USER)->where('deleted')->eq('0')->fetchPairs('account', 'account'); /* Insert product and sprint team into project team. */ @@ -4333,12 +4333,6 @@ class upgradeModel extends model $this->dao->replace(TABLE_TEAM)->data($team)->exec(); } - /* Update project type to sprint. */ - $this->dao->update(TABLE_TEAM)->set('type')->eq('sprint') - ->where('type')->eq('project') - ->andWhere('root')->in($sprintIdList) - ->exec(); - /* Get all actor in sprint and product. */ foreach($productIdList as $productID) $productIdList[$productID] = ",{$productID},"; $whiteList = $this->dao->select('actor')->from(TABLE_ACTION)->where('execution')->in($sprintIdList)->orWhere('product')->in($productIdList)->fetchPairs('actor', 'actor'); From afad42544004a014f147f66f402b603fa224e6c1 Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Tue, 23 Mar 2021 16:23:53 +0800 Subject: [PATCH 4/7] * Finish task#36862. --- module/bug/view/browse.html.php | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/module/bug/view/browse.html.php b/module/bug/view/browse.html.php index c5611f056c..f2f7f55a52 100644 --- a/module/bug/view/browse.html.php +++ b/module/bug/view/browse.html.php @@ -21,6 +21,11 @@ js::set('productID', $productID); js::set('branch', $branch); $currentBrowseType = isset($lang->bug->mySelects[$browseType]) && in_array($browseType, array_keys($lang->bug->mySelects)) ? $browseType : ''; ?> + global->flow == 'full'):?>
id; ?> repo->scmList, $repo->SCM); ?> createLink('repo', 'browse', "repoID={$repo->id}"), $repo->name);?> @@ -43,8 +48,8 @@ path; ?> createLink('repo', 'delete', "repoID=$id"), '', 'hiddenwin', "title='{$lang->repo->delete}' class='btn'"); + common::printIcon('repo', 'edit', "repoID=$repo->id", '', 'list', 'edit'); + if(common::hasPriv('repo', 'delete')) echo html::a($this->createLink('repo', 'delete', "repoID=$repo->id"), '', 'hiddenwin', "title='{$lang->repo->delete}' class='btn'"); ?>