From 98cea3e6436fa10f8742847ad5f00b33a788ff99 Mon Sep 17 00:00:00 2001
From: wangyidong
Date: Mon, 22 Feb 2021 10:55:35 +0800
Subject: [PATCH 1/3] * finish task #35998.
---
module/upgrade/control.php | 46 +++++++++++++++-----------
module/upgrade/lang/zh-cn.php | 31 ++++++++---------
module/upgrade/view/guideto15.html.php | 39 ++++++++++++++++++++++
module/upgrade/view/to20.html.php | 31 -----------------
4 files changed, 81 insertions(+), 66 deletions(-)
create mode 100644 module/upgrade/view/guideto15.html.php
delete mode 100644 module/upgrade/view/to20.html.php
diff --git a/module/upgrade/control.php b/module/upgrade/control.php
index f325685110..faa4c90522 100644
--- a/module/upgrade/control.php
+++ b/module/upgrade/control.php
@@ -23,7 +23,7 @@ class upgrade extends control
$upgradeFile = $this->app->wwwRoot . 'upgrade.php';
if(!file_exists($upgradeFile)) $this->locate($this->createLink('my', 'index'));
- if((version_compare($this->config->installedVersion, '20', '<')
+ if((version_compare($this->config->installedVersion, '15', '<')
|| strpos($this->config->installedVersion, 'biz') !== false
|| strpos($this->config->installedVersion, 'pro') !== false)
&& strpos($this->config->installedVersion, 'max') === false)
@@ -31,26 +31,11 @@ class upgrade extends control
/* Judge upgrade step. */
$upgradeStep = $this->loadModel('setting')->getItem('owner=system&module=common§ion=global&key=upgradeStep');
if($upgradeStep == 'mergeProgram') $this->locate(inlink('mergeProgram'));
-
- $this->locate(inlink('to20'));
}
if(version_compare($this->config->installedVersion, '6.4', '<=')) $this->locate(inlink('license'));
$this->locate(inlink('backup'));
}
- /**
- * Upgrade to 20 version.
- *
- * @access public
- * @return void
- */
- public function to20()
- {
- $this->view->title = $this->lang->upgrade->to20Tips;
- $this->view->video = $this->lang->upgrade->videoURL;
- $this->display();
- }
-
/**
* Check agree license.
*
@@ -152,11 +137,11 @@ class upgrade extends control
if(!$this->upgrade->isError())
{
- if((version_compare($fromVersion, '20', '<')
- || strpos($fromVersion, 'biz') !== false
- || strpos($fromVersion, 'pro') !== false)
+ if((version_compare($fromVersion, '15', '<')
+ || strpos($fromVersion, 'biz') !== false
+ || strpos($fromVersion, 'pro') !== false)
&& strpos($fromVersion, 'max') === false
- && !isset($this->config->qcVersion)) $this->locate(inlink('mergeTips'));
+ && !isset($this->config->qcVersion)) $this->locate(inlink('guideTo15', "fromVersion=$fromVersion"));
$this->locate(inlink('afterExec', "fromVersion=$fromVersion"));
}
@@ -165,6 +150,27 @@ class upgrade extends control
$this->display();
}
+ /**
+ * Guide to 15 version.
+ *
+ * @param string $fromVersion
+ * @access public
+ * @return void
+ */
+ public function guideTo15($fromVersion)
+ {
+ if($_POST)
+ {
+ $after15mode = fixer::input('post')->get('after15mode');
+ $this->loadModel('setting')->setItem('system.custom.after15mode', $after15mode);
+
+ if($after15mode == 'old') $this->locate(inlink('afterExec', "fromVersion=$fromVersion"));
+ if($after15mode == 'new') $this->locate(inlink('mergeTips'));
+ }
+
+ $this->display();
+ }
+
/**
* Merge program tips.
*
diff --git a/module/upgrade/lang/zh-cn.php b/module/upgrade/lang/zh-cn.php
index 6ffb0b6ebb..194e9a20e1 100644
--- a/module/upgrade/lang/zh-cn.php
+++ b/module/upgrade/lang/zh-cn.php
@@ -49,21 +49,16 @@ $lang->upgrade->noticeSQL = '检查到你的数据库跟标准不一致,
$lang->upgrade->afterDeleted = '以上文件未能删除, 删除后刷新!';
$lang->upgrade->mergeProgram = '数据迁移';
$lang->upgrade->mergeTips = '数据迁移提示';
-$lang->upgrade->to20Demo = '查看20版本Demo';
-$lang->upgrade->demoURL = 'http://zentao20.demo.zentao.net';
-$lang->upgrade->videoURL = 'https://qc.zentao.net/zentao20.mp4';
-$lang->upgrade->to20Tips = '禅道20版本升级提示';
-$lang->upgrade->to20Button = '我已经做好备份,开始升级吧!';
-$lang->upgrade->to20TipsHeader = "尊敬的用户,感谢对禅道的支持。自20版本开始,禅道全面升级成为通用的项目管理平台。相关介绍请看如下视频(如视频无法正常播放,请直接访问 禅道20版本介绍):
";
-$lang->upgrade->to20Desc = <<
- 友情提示:
-
- - 您可以先安装一个20版本的禅道,体验一下里边的概念和流程。
- - 20版本禅道改动比较大,升级之前请做好备份。
- - 请放心升级,即使第一次升级不到位,后续还可以再调整,不会影响系统数据。
-
-
+$lang->upgrade->to15Guide = '升级15版本后引导';
+$lang->upgrade->to15Desc = <<尊敬的用户,禅道从15版本开始对导航和概念做了调整,主要改动如下:
+
+- 增加了项目集概念。一个项目集可以包括多个产品和多个项目。
+- 细分了项目和迭代概念,一个项目可以包含多个迭代。
+- 导航增加了左侧菜单并支持多页面操作。
+
+您可以在线体验最新版本的功能以决定是否启用的模式:演示链接。
+请问您计划如何使用禅道的新版本呢?
EOD;
$lang->upgrade->mergeProgramDesc = <<接下来我们会把之前历史产品和迭代数据迁移到项目集和项目下,迁移的方案如下:
@@ -77,6 +72,12 @@ $lang->upgrade->mergeProgramDesc = <<可以选择这些迭代归属于某个新项目下。
EOD;
+$lang->upgrade->to15Mode['old'] = '保持老版本的习惯';
+$lang->upgrade->to15Mode['new'] = '全新项目集管理模式';
+
+$lang->upgrade->selectedModeTips['old'] = '后续您还可以在后台-自定义里面切换为全新项目集管理的模式。';
+$lang->upgrade->selectedModeTips['new'] = '切换为项目集管理模式需要对之前的数据进行归并处理,系统会引导您完成这个操作。';
+
$lang->upgrade->line = '产品线';
$lang->upgrade->program = '目标项目集和项目';
$lang->upgrade->existPGM = '已有项目集';
diff --git a/module/upgrade/view/guideto15.html.php b/module/upgrade/view/guideto15.html.php
new file mode 100644
index 0000000000..876b7bc985
--- /dev/null
+++ b/module/upgrade/view/guideto15.html.php
@@ -0,0 +1,39 @@
+
+ * @package upgrade
+ * @version $Id$
+ * @link http://www.zentao.net
+ */
+?>
+
+
+upgrade->selectedModeTips);?>
+
+
diff --git a/module/upgrade/view/to20.html.php b/module/upgrade/view/to20.html.php
deleted file mode 100644
index 8e84009358..0000000000
--- a/module/upgrade/view/to20.html.php
+++ /dev/null
@@ -1,31 +0,0 @@
-
- * @package upgrade
- * @version $Id$
- * @link http://www.zentao.net
- */
-?>
-
-
-
-
upgrade->to20Tips;?>
-
- upgrade->to20TipsHeader;?>
-
-
-
-
upgrade->to20Desc;?>
-
-
-
-
-
-
From b668ce197024b36e7a20e6dcf654ac058be8bee0 Mon Sep 17 00:00:00 2001
From: Yagami <976204163@qq.com>
Date: Mon, 22 Feb 2021 11:05:01 +0800
Subject: [PATCH 2/3] * Finish task #36028,#36068,#36072.
---
module/upgrade/control.php | 3 +-
module/upgrade/js/mergeprogram.js | 38 +++++++++-
module/upgrade/model.php | 84 ++++++++++++++-------
module/upgrade/view/createprogram.html.php | 8 ++
module/upgrade/view/mergebyline.html.php | 4 +-
module/upgrade/view/mergebyproduct.html.php | 2 +-
module/upgrade/view/mergebysprint.html.php | 2 +-
7 files changed, 108 insertions(+), 33 deletions(-)
diff --git a/module/upgrade/control.php b/module/upgrade/control.php
index faa4c90522..42f57fe697 100644
--- a/module/upgrade/control.php
+++ b/module/upgrade/control.php
@@ -439,11 +439,12 @@ class upgrade extends control
}
$programs = $this->upgrade->getProgramPairs();
+ $currentProgramID = $programID ? $programID : key($programs);
$this->view->title = $this->lang->upgrade->mergeProgram;
$this->view->programs = $programs;
$this->view->programID = $programID;
- $this->view->projects = array('' => '') + $this->upgrade->getProjectPairsByProgram(key($programs));
+ $this->view->projects = array('' => '') + $this->upgrade->getProjectPairsByProgram($currentProgramID);
$this->view->users = $this->loadModel('user')->getPairs('noclosed|noempty');
$this->view->groups = $this->loadModel('group')->getPairs();
$this->display();
diff --git a/module/upgrade/js/mergeprogram.js b/module/upgrade/js/mergeprogram.js
index 99afcd4b66..196266b8cc 100644
--- a/module/upgrade/js/mergeprogram.js
+++ b/module/upgrade/js/mergeprogram.js
@@ -126,7 +126,7 @@ function getProjectByProgram(obj)
function toggleProgram(obj)
{
- var $obj = $(obj);
+ var $obj = $(obj);
if($obj.length == 0) return false;
var $programs = $obj.closest('table').find('#programs');
@@ -135,6 +135,7 @@ function toggleProgram(obj)
$('form .pgm-no-exist').removeClass('hidden');
$('form .pgm-exist').addClass('hidden');
$programs.attr('disabled', 'disabled');
+ $('#PGMStatus').closest('.PGMParams').show();
$('form #newProject0').prop('checked', true);
toggleProject($('form #newProject0'));
@@ -143,6 +144,7 @@ function toggleProgram(obj)
{
$('form .pgm-exist').removeClass('hidden');
$('form .pgm-no-exist').addClass('hidden');
+ $('#PGMStatus').closest('.PGMParams').hide();
$programs.removeAttr('disabled');
}
}
@@ -176,6 +178,38 @@ function toggleProject(obj)
}
}
+function setPRJStatus()
+{
+ var PRJStatus = 'closed';
+ $(':checkbox:checked[data-status]').each(function()
+ {
+ var status = $(this).attr('data-status');
+ if(status == 'doing' || status == 'suspended')
+ {
+ PRJStatus = 'doing';
+ return false;
+ }
+
+ if(status == 'wait') PRJStatus = 'wait';
+ });
+ if($(':checkbox:checked[data-status]').length == 0) PRJStatus = 'wait';
+
+ $('#PRJStatus').val(PRJStatus);
+ $('#PRJStatus').trigger('chosen:updated');
+
+ setPGMStatus(PRJStatus);
+}
+
+function setPGMStatus(PRJStatus)
+{
+ var PGMStatus = 'wait';
+ if(PRJStatus != 'wait') PGMStatus = 'doing';
+ if(PRJStatus == 'closed') PGMStatus = 'closed';
+
+ $('#PGMStatus').val(PGMStatus);
+ $('#PGMStatus').trigger('chosen:updated');
+}
+
function setPGMBegin(PGMBegin)
{
$(':checkbox:checked[data-begin]').each(function()
@@ -189,6 +223,8 @@ function setPGMBegin(PGMBegin)
$('.PGMParams #begin').val(PGMBegin);
}
});
+
+ setPRJStatus();
}
function setPGMEnd(PGMEnd)
diff --git a/module/upgrade/model.php b/module/upgrade/model.php
index aa1eb8a8e4..b620ed568b 100644
--- a/module/upgrade/model.php
+++ b/module/upgrade/model.php
@@ -3998,7 +3998,7 @@ class upgradeModel extends model
$program = new stdclass();
$program->name = $data->PGMName;
$program->type = 'program';
- $program->status = 'wait';
+ $program->status = $data->PGMStatus;
$program->begin = $data->begin;
$program->end = isset($data->end) ? $data->end : '';
$program->openedBy = $account;
@@ -4042,7 +4042,7 @@ class upgradeModel extends model
$project->type = 'project';
$project->model = 'scrum';
$project->parent = $programID;
- $project->status = 'wait';
+ $project->status = $data->PRJStatus;
$project->begin = $data->begin;
$project->end = isset($data->end) ? $data->end : '';
$project->PM = $data->PM;
@@ -4115,29 +4115,9 @@ class upgradeModel extends model
{
$projectStory = $sprintStory;
$projectStory->project = $projectID;
- $this->dao->insert(TABLE_PROJECTSTORY)->data($projectStory)->exec();
+ $this->dao->replace(TABLE_PROJECTSTORY)->data($projectStory)->exec();
}
- /* Compute project date. */
- $linkedSprintIdList = $this->dao->select('id')->from(TABLE_PROJECT)->where('project')->eq($projectID)->fetchPairs();
- $linkedSprintIdList += $sprintIdList;
- $undoneSprints = $this->dao->select("count('*') as count")->from(TABLE_PROJECT)->where('id')->in($linkedSprintIdList)->andWhere('status')->ne('closed')->fetch('count');
- $minRealBegan = $this->dao->select('date')->from(TABLE_ACTION)->where('objectID')->in($linkedSprintIdList)->andWhere('objectType')->eq('project')->andWhere('action')->eq('started')->orderBy('date_asc')->fetch('date');
- $maxRealEnd = $this->dao->select('date')->from(TABLE_ACTION)->where('objectID')->in($linkedSprintIdList)->andWhere('objectType')->eq('project')->andWhere('action')->eq('closed')->orderBy('date_desc')->fetch('date');
-
- $data = new stdClass();
- $data->realBegan = $minRealBegan ? substr($minRealBegan, 0, 10) : '0000-00-00';
- if($maxRealEnd and !$undoneSprints)
- {
- $data->realEnd = substr($maxRealEnd, 0, 10);
- $data->closedDate = $maxRealEnd;
- $data->status = 'closed';
- }
-
- $this->dao->update(TABLE_PROJECT)->data($data)->where('id')->eq($projectID)->exec();
-
- if($maxRealEnd and !$undoneSprints) $this->loadModel('action')->create('project', $projectID, 'closedbysystem');
-
/* Compute product acl. */
$products = $this->dao->select('id,program,acl')->from(TABLE_PRODUCT)->where('id')->in($productIdList)->fetchAll();
foreach($products as $product)
@@ -4167,7 +4147,32 @@ class upgradeModel extends model
$this->dao->update(TABLE_PROJECT)->data($data)->where('id')->eq($sprint->id)->exec();
}
- /* Set product and project relation. */
+ /* Compute project date and status. */
+ $linkedSprintIdList = $this->dao->select('id')->from(TABLE_PROJECT)->where('project')->eq($projectID)->fetchPairs();
+ $linkedSprintIdList += $sprintIdList;
+ $minRealBegan = $this->dao->select('date')->from(TABLE_ACTION)->where('objectID')->in($linkedSprintIdList)->andWhere('objectType')->eq('project')->andWhere('action')->eq('started')->orderBy('date_asc')->fetch('date');
+ $maxRealEnd = $this->dao->select('date')->from(TABLE_ACTION)->where('objectID')->in($linkedSprintIdList)->andWhere('objectType')->eq('project')->andWhere('action')->eq('closed')->orderBy('date_desc')->fetch('date');
+
+ $PRJStatus = $this->computeStatus($projectID);
+
+ $data = new stdClass();
+ $data->realBegan = $minRealBegan ? substr($minRealBegan, 0, 10) : '0000-00-00';
+ $data->status = $PRJStatus;
+ if($PRJStatus == 'closed')
+ {
+ $data->realEnd = substr($maxRealEnd, 0, 10);
+ $data->closedDate = $maxRealEnd;
+ }
+
+ $this->dao->update(TABLE_PROJECT)->data($data)->where('id')->eq($projectID)->exec();
+ if($PRJStatus == 'closed') $this->loadModel('action')->create('project', $projectID, 'closedbysystem');
+
+ /* Compute program status. */
+ $PGMStatus = $this->computeStatus($programID);
+ $this->dao->update(TABLE_PROJECT)->set('status')->eq($PGMStatus)->where('id')->eq($programID)->exec();
+ if($PGMStatus == 'closed') $this->loadModel('action')->create('program', $programID, 'closedbysystem');
+
+ /* Set product and project relation. */
foreach($productIdList as $productID)
{
$data = new stdclass();
@@ -4180,9 +4185,34 @@ class upgradeModel extends model
$this->computeObjectMembers($programID, $projectID, $productIdList, $sprintIdList);
}
- /**
- * Compute program and project members.
- *
+ /**
+ * Compute project or program status.
+ *
+ * @param int $objectID
+ * @access public
+ * @return string
+ */
+ public function computeStatus($objectID)
+ {
+ $objects = $this->dao->select('id, status')->from(TABLE_PROJECT)->where('parent')->eq($objectID)->fetchPairs();
+ $objectStatus = empty($objects) ? 'wait' : 'closed';
+ foreach($objects as $status)
+ {
+ if($status == 'doing' || $status == 'suspended')
+ {
+ $objectStatus = 'doing';
+ break;
+ }
+
+ if($status == 'wait') $objectStatus = 'wait';
+ }
+
+ return $objectStatus;
+ }
+
+ /**
+ * Compute program and project members.
+ *
* @param int $programID
* @param int $projectID
* @param array $productIdList
diff --git a/module/upgrade/view/createprogram.html.php b/module/upgrade/view/createprogram.html.php
index 129acc044f..2e77127326 100644
--- a/module/upgrade/view/createprogram.html.php
+++ b/module/upgrade/view/createprogram.html.php
@@ -20,6 +20,10 @@
+
+ | program->PGMCommon . $lang->program->PGMStatus;?> |
+ program->statusList, '', "class='form-control chosen'");?> |
+
|
upgrade->existPRJ;?>
@@ -40,6 +44,10 @@
|
+
+ | program->PRJCommon . $lang->program->PRJStatus;?> |
+ program->statusList, '', "class='form-control chosen'");?> |
+
| program->PRJPM;?> |
'') + $users, '', "class='form-control chosen'");?> |
diff --git a/module/upgrade/view/mergebyline.html.php b/module/upgrade/view/mergebyline.html.php
index c33b1ac2d7..898b1ce9cd 100644
--- a/module/upgrade/view/mergebyline.html.php
+++ b/module/upgrade/view/mergebyline.html.php
@@ -37,14 +37,14 @@
id] as $productID => $product):?>
- id]", array($productID => "{$lang->productCommon} #{$product->id} {$product->name}"), $i == 0 ? $product->id : 0, "title='{$product->name}' data-productid='{$product->id}' data-line='{$line->id}' data-begin='{$product->createdDate}'");?>
+ id]", array($productID => $product->name), $i == 0 ? $product->id : 0, "title='{$product->name}' data-productid='{$product->id}' data-line='{$line->id}' data-begin='{$product->createdDate}'");?>
id][$productID]", $productID);?>
From 6787d19ac7793db1755ff9196cc6614c65351297 Mon Sep 17 00:00:00 2001
From: wangyidong
Date: Mon, 22 Feb 2021 13:03:46 +0800
Subject: [PATCH 3/3] * finish task #36010.
---
module/custom/control.php | 28 +++++++++++++++
module/custom/lang/zh-cn.php | 1 +
module/custom/view/header.html.php | 4 +++
module/custom/view/mode.html.php | 36 +++++++++++++++++++
module/upgrade/control.php | 7 ++--
module/upgrade/view/createprogram.html.php | 2 +-
...{guideto15.html.php => to15guide.html.php} | 0
7 files changed, 75 insertions(+), 3 deletions(-)
create mode 100644 module/custom/view/mode.html.php
rename module/upgrade/view/{guideto15.html.php => to15guide.html.php} (100%)
diff --git a/module/custom/control.php b/module/custom/control.php
index 414aecfdfd..025c6d528a 100644
--- a/module/custom/control.php
+++ b/module/custom/control.php
@@ -594,6 +594,34 @@ class custom extends control
$this->display();
}
+ /**
+ * Set Mode.
+ *
+ * @access public
+ * @return void
+ */
+ public function mode()
+ {
+ if($_POST)
+ {
+ $after15mode = fixer::input('post')->get('after15mode');
+ $this->loadModel('setting')->setItem('system.custom.after15mode', $after15mode);
+ if($after15mode == 'new') $this->locate($this->createLink('upgrade', 'mergeTips'));
+ }
+
+ $after15mode = zget($this->config->custom, 'after15mode', 'old');
+ if($after15mode == 'new')
+ {
+ if(isset($this->config->global->upgradeStep) and $this->config->global->upgradeStep == 'mergeProgram') $this->locate($this->createLink('upgrade', 'mergeProgram'));
+
+ unset($_SESSION['upgrading']);
+ $this->locate(inlink('index'));
+ }
+
+ $this->app->loadLang('upgrade');
+ $this->display();
+ }
+
/**
* Ajax save custom fields.
*
diff --git a/module/custom/lang/zh-cn.php b/module/custom/lang/zh-cn.php
index 6339b67a74..92ee02828e 100644
--- a/module/custom/lang/zh-cn.php
+++ b/module/custom/lang/zh-cn.php
@@ -38,6 +38,7 @@ $lang->custom->URStory = "用户需求";
$lang->custom->SRStory = "软件需求";
$lang->custom->epic = "史诗";
$lang->custom->default = "默认";
+$lang->custom->mode = "模式";
$lang->custom->scrumStory = "故事";
$lang->custom->waterfallCommon = "瀑布";
$lang->custom->buildin = "系统内置";
diff --git a/module/custom/view/header.html.php b/module/custom/view/header.html.php
index f2644be41e..d6ff2052d6 100644
--- a/module/custom/view/header.html.php
+++ b/module/custom/view/header.html.php
@@ -12,6 +12,10 @@
{
common::printLink('custom', $sysObject, "", "{$lang->custom->$sysObject}", '', "class='btn btn-link' id='{$sysObject}Tab'");
}
+ if(isset($config->custom->after15mode) and $config->custom->after15mode == 'old')
+ {
+ common::printLink('custom', 'mode', "", "{$lang->custom->mode}", '', "class='btn btn-link' id='modeTab'");
+ }
?>
diff --git a/module/custom/view/mode.html.php b/module/custom/view/mode.html.php
new file mode 100644
index 0000000000..d9b5cfe816
--- /dev/null
+++ b/module/custom/view/mode.html.php
@@ -0,0 +1,36 @@
+
+ * @package custom
+ * @version $Id$
+ * @link http://www.zentao.net
+ */
+?>
+
+
+
+
diff --git a/module/upgrade/control.php b/module/upgrade/control.php
index 42f57fe697..eab5ff16c6 100644
--- a/module/upgrade/control.php
+++ b/module/upgrade/control.php
@@ -141,7 +141,7 @@ class upgrade extends control
|| strpos($fromVersion, 'biz') !== false
|| strpos($fromVersion, 'pro') !== false)
&& strpos($fromVersion, 'max') === false
- && !isset($this->config->qcVersion)) $this->locate(inlink('guideTo15', "fromVersion=$fromVersion"));
+ && !isset($this->config->qcVersion)) $this->locate(inlink('to15Guide', "fromVersion=$fromVersion"));
$this->locate(inlink('afterExec', "fromVersion=$fromVersion"));
}
@@ -157,7 +157,7 @@ class upgrade extends control
* @access public
* @return void
*/
- public function guideTo15($fromVersion)
+ public function to15Guide($fromVersion)
{
if($_POST)
{
@@ -168,6 +168,7 @@ class upgrade extends control
if($after15mode == 'new') $this->locate(inlink('mergeTips'));
}
+ $this->view->title = $this->lang->upgrade->to15Guide;
$this->display();
}
@@ -469,6 +470,8 @@ class upgrade extends control
if(empty($repos))
{
$this->loadModel('setting')->deleteItems('owner=system&module=common§ion=global&key=upgradeStep');
+
+ if($this->config->version == $this->config->installedVersion) die(js::locate($this->createLink('custom', 'mode')));
die(js::locate($this->createLink('upgrade', 'afterExec', "fromVersion=&processed=no")));
}
diff --git a/module/upgrade/view/createprogram.html.php b/module/upgrade/view/createprogram.html.php
index 2e77127326..4c0369e48e 100644
--- a/module/upgrade/view/createprogram.html.php
+++ b/module/upgrade/view/createprogram.html.php
@@ -9,7 +9,7 @@