* Fix details.
This commit is contained in:
@@ -16,7 +16,7 @@ if(!class_exists('config')){class config{}}
|
||||
if(!function_exists('getWebRoot')){function getWebRoot(){}}
|
||||
|
||||
/* 基本设置。Basic settings. */
|
||||
$config->version = '20.0'; // ZenTaoPHP的版本。 The version of ZenTaoPHP. Don't change it.
|
||||
$config->version = '20.0.alpha1'; // ZenTaoPHP的版本。 The version of ZenTaoPHP. Don't change it.
|
||||
$config->charset = 'UTF-8'; // ZenTaoPHP的编码。 The encoding of ZenTaoPHP.
|
||||
$config->cookieLife = time() + 2592000; // Cookie的生存时间。The cookie life time.
|
||||
$config->timezone = 'Asia/Shanghai'; // 时区设置。 The time zone setting, for more see http://www.php.net/manual/en/timezones.php.
|
||||
|
||||
@@ -1180,7 +1180,7 @@ class docModel extends model
|
||||
$objectLibs = $this->dao->select('*')->from(TABLE_DOCLIB)->where('deleted')->eq(0)->andWhere($type)->eq($objectID)->orderBy('`order`, id')->fetchAll('id');
|
||||
if($type == 'product')
|
||||
{
|
||||
$hasProject = $this->dao->select('DISTINCT t1.product, count(project) as projectCount')->from(TABLE_PROJECTPRODUCT)->alias('t1')
|
||||
$hasProject = $this->dao->select('DISTINCT t1.product, count(t1.project) as projectCount')->from(TABLE_PROJECTPRODUCT)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')
|
||||
->where('t1.product')->eq($objectID)
|
||||
->beginIF(strpos($this->config->doc->custom->showLibs, 'unclosed') !== false)->andWhere('t2.status')->notin('done,closed')->fi()
|
||||
|
||||
@@ -23,6 +23,10 @@ class upgrade extends control
|
||||
$upgradeFile = $this->app->wwwRoot . 'upgrade.php';
|
||||
if(!file_exists($upgradeFile)) $this->locate($this->createLink('my', 'index'));
|
||||
|
||||
/* Judge upgrade step. */
|
||||
$upgradeStep = $this->loadModel('setting')->getItem('owner=system&module=common§ion=global&key=upgradeStep');
|
||||
if($upgradeStep == 'mergeProgram') $this->locate(inlink('mergeProgram'));
|
||||
|
||||
if(version_compare($this->config->installedVersion, '20', '<')) $this->locate(inlink('to20'));
|
||||
if(version_compare($this->config->installedVersion, '6.4', '<=')) $this->locate(inlink('license'));
|
||||
$this->locate(inlink('backup'));
|
||||
@@ -141,7 +145,11 @@ class upgrade extends control
|
||||
|
||||
if(!$this->upgrade->isError())
|
||||
{
|
||||
if(version_compare(str_replace('_', '.', $fromVersion), '20', '<') && !isset($this->config->qcVersion)) $this->locate(inlink('mergeProgram'));
|
||||
if(version_compare(str_replace('_', '.', $fromVersion), '20', '<') && !isset($this->config->qcVersion))
|
||||
{
|
||||
$this->loadModel('setting')->setItem('system.common.global.upgradeStep', 'mergeProgram');
|
||||
$this->locate(inlink('mergeProgram'));
|
||||
}
|
||||
$this->locate(inlink('afterExec', "fromVersion=$fromVersion"));
|
||||
}
|
||||
|
||||
@@ -159,6 +167,7 @@ class upgrade extends control
|
||||
*/
|
||||
public function mergeProgram($type = 'productline')
|
||||
{
|
||||
$this->session->set('upgrading', true);
|
||||
$this->app->loadLang('program');
|
||||
|
||||
if($_POST)
|
||||
@@ -167,7 +176,6 @@ class upgrade extends control
|
||||
{
|
||||
$linkedProducts = array();
|
||||
$linkedSprints = array();
|
||||
$unlinkProducts = array();
|
||||
$unlinkSprints = array();
|
||||
|
||||
/* Compute checked products and sprints, unchecked products and sprints. */
|
||||
@@ -176,7 +184,6 @@ class upgrade extends control
|
||||
foreach($products as $productID)
|
||||
{
|
||||
$linkedProducts[$productID] = $productID;
|
||||
unset($_POST['productIdList'][$lineID][$productID]);
|
||||
|
||||
if(isset($_POST['sprints'][$lineID][$productID]))
|
||||
{
|
||||
@@ -185,11 +192,9 @@ class upgrade extends control
|
||||
$linkedSprints[$sprintID] = $sprintID;
|
||||
unset($_POST['sprintIdList'][$lineID][$productID][$sprintID]);
|
||||
}
|
||||
$unlinkSprints += $this->post->sprintIdList[$lineID][$productID];
|
||||
$unlinkSprints[$productID] = $this->post->sprintIdList[$lineID][$productID];
|
||||
}
|
||||
}
|
||||
|
||||
$unlinkProducts += $this->post->productIdList[$lineID];
|
||||
}
|
||||
|
||||
/* Create Program. */
|
||||
@@ -199,9 +204,11 @@ class upgrade extends control
|
||||
/* Process merged products and projects. */
|
||||
$this->upgrade->processMergedData($programID, $projectID, $linkedProducts, $linkedSprints);
|
||||
|
||||
/* Process unlinked product. */
|
||||
if($unlinkProducts) $this->dao->update(TABLE_PRODUCT)->set('line')->eq(0)->where('id')->in($unlinkProducts)->exec();
|
||||
if($unlinkSprints) $this->dao->delete()->from(TABLE_PROJECTPRODUCT)->where('project')->in($unlinkSprints)->exec();
|
||||
/* Process unlinked sprint and product. */
|
||||
foreach($linkedProducts as $productID => $product)
|
||||
{
|
||||
if((isset($unlinkSprints[$productID]) and empty($unlinkSprints[$productID])) || !isset($unlinkSprints[$productID])) $this->dao->update(TABLE_PRODUCT)->set('line')->eq(0)->where('id')->eq($productID)->exec();
|
||||
}
|
||||
}
|
||||
elseif($type == 'product')
|
||||
{
|
||||
@@ -262,7 +269,7 @@ class upgrade extends control
|
||||
}
|
||||
|
||||
/* Get no merged product and project count. */
|
||||
$noMergedProductCount = $this->dao->select('count(*) as count')->from(TABLE_PRODUCT)->where('program')->eq(0)->andWhere('deleted')->eq(0)->fetch('count');
|
||||
$noMergedProductCount = $this->dao->select('count(*) as count')->from(TABLE_PRODUCT)->where('program')->eq(0)->fetch('count');
|
||||
$noMergedSprintCount = $this->dao->select('count(*) as count')->from(TABLE_PROJECT)->where('grade')->eq(0)->andWhere('path')->eq('')->fetch('count');
|
||||
|
||||
/* When all products and projects merged then finish and locate afterExec page. */
|
||||
@@ -270,6 +277,7 @@ class upgrade extends control
|
||||
{
|
||||
$this->upgrade->initUserView();
|
||||
$this->upgrade->setDefaultPriv();
|
||||
$this->loadModel('setting')->deleteItems('owner=system&module=common§ion=global&key=upgradeStep');
|
||||
die(js::locate($this->createLink('upgrade', 'afterExec', "fromVersion=&processed=yes")));
|
||||
}
|
||||
|
||||
@@ -282,16 +290,16 @@ class upgrade extends control
|
||||
/* Get products and projects group by product line. */
|
||||
if($type == 'productline')
|
||||
{
|
||||
$productlines = $this->dao->select('*')->from(TABLE_MODULE)->where('type')->eq('line')->fetchAll('id');
|
||||
$productlines = $this->dao->select('*')->from(TABLE_MODULE)->where('type')->eq('line')->orderBy('id_desc')->fetchAll('id');
|
||||
|
||||
$noMergedProducts = $this->dao->select('*')->from(TABLE_PRODUCT)->where('program')->eq(0)->andWhere('line')->in(array_keys($productlines))->andWhere('deleted')->eq(0)->fetchAll('id');
|
||||
$noMergedProducts = $this->dao->select('*')->from(TABLE_PRODUCT)->where('line')->in(array_keys($productlines))->orderBy('id_desc')->fetchAll('id');
|
||||
if(empty($noMergedProducts)) $this->locate($this->createLink('upgrade', 'mergeProgram', 'type=product'));
|
||||
|
||||
$noMergedSprints = $this->dao->select('t1.*')->from(TABLE_PROJECT)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id=t2.project')
|
||||
->where('t1.model')->eq('')
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->where('t1.project')->eq(0)
|
||||
->andWhere('t2.product')->in(array_keys($noMergedProducts))
|
||||
->orderBy('t1.id_desc')
|
||||
->fetchAll('id');
|
||||
|
||||
/* Remove sprint than linked more than two products */
|
||||
@@ -328,21 +336,25 @@ class upgrade extends control
|
||||
/* Get projects group by product. */
|
||||
if($type == 'product')
|
||||
{
|
||||
$noMergedProducts = $this->dao->select('*')->from(TABLE_PRODUCT)->where('program')->eq(0)->andWhere('deleted')->eq(0)->fetchAll('id');
|
||||
$noMergedProducts = $this->dao->select('*')->from(TABLE_PRODUCT)->where('program')->eq(0)->fetchAll('id');
|
||||
if(empty($noMergedProducts)) $this->locate($this->createLink('upgrade', 'mergeProgram', 'type=sprint'));
|
||||
|
||||
$noMergedSprints = $this->dao->select('t1.*')->from(TABLE_PROJECT)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECTPRODUCT)->alias('t2')->on('t1.id=t2.project')
|
||||
->where('t1.model')->eq('')
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->andWhere('t2.product')->in(array_keys($noMergedProducts))
|
||||
->fetchAll('id');
|
||||
|
||||
/* Remove project than linked more than two products */
|
||||
$sprintProducts = $this->dao->select('*')->from(TABLE_PROJECTPRODUCT)->where('project')->in(array_keys($noMergedSprints))->fetchGroup('project', 'product');
|
||||
$productGroup = array();
|
||||
foreach($sprintProducts as $sprintID => $products)
|
||||
{
|
||||
if(count($products) > 1) unset($noMergedSprints[$sprintID]);
|
||||
if(count($products) > 1)
|
||||
{
|
||||
unset($noMergedSprints[$sprintID]);
|
||||
$productGroup[] = array_keys($products);
|
||||
}
|
||||
}
|
||||
|
||||
/* Group project by product. */
|
||||
|
||||
@@ -48,6 +48,7 @@ $lang->upgrade->updateFile = '需要更新附件信息。';
|
||||
$lang->upgrade->noticeSQL = '检查到你的数据库跟标准不一致,尝试修复失败。请执行以下SQL语句,再刷新页面检查。';
|
||||
$lang->upgrade->afterDeleted = '以上文件未能删除, 删除后刷新!';
|
||||
$lang->upgrade->mergeProgram = '数据归并';
|
||||
$lang->upgrade->to20Demo = '查看20版本Demo';
|
||||
$lang->upgrade->to20Tips = '禅道20版本升级提示';
|
||||
$lang->upgrade->to20Button = '我已经做好备份,开始升级吧!';
|
||||
$lang->upgrade->to20TipsHeader = "<p>尊敬的用户,感谢对禅道的支持。自20版本开始,禅道全面升级成为通用的项目管理平台。相关介绍请看如下视频:</p><br />";
|
||||
@@ -58,7 +59,6 @@ $lang->upgrade->to20Desc = <<<EOD
|
||||
<li>您可以先安装一个20版本的禅道,体验一下里边的概念和流程。</li>
|
||||
<li>20版本禅道改动比较大,升级之前请做好备份。</li>
|
||||
<li>请放心升级,即使第一次升级不到位,后续还可以再调整,不会影响系统数据。</li>
|
||||
<li>点击查看<a href='https://demo.qcmmi.com/' target='_blank'>20.0版系统demo</a>。</li>
|
||||
</ol>
|
||||
</div>
|
||||
EOD;
|
||||
@@ -71,7 +71,7 @@ $lang->upgrade->product = $lang->productCommon;
|
||||
$lang->upgrade->project = '迭代';
|
||||
|
||||
$lang->upgrade->newProgram = '新建';
|
||||
$lang->upgrade->mergeSummary = "尊敬的用户,您的系统中共有%s个产品,%s个迭代等待迁移。经系统计算,我们推荐您的迁移方案如下,您也可以根据自己的情况进行调整:";
|
||||
$lang->upgrade->mergeSummary = "尊敬的用户,您的系统中共有%s个产品,%s个迭代等待迁移。";
|
||||
$lang->upgrade->mergeByProductLine = "以产品线组织的产品和迭代:将整个产品线及其下面的产品和迭代归并到一个项目集和项目中,也可以分开归并。";
|
||||
$lang->upgrade->mergeByProduct = "以产品组织的迭代:可以选择多个产品及其下面的迭代归并到一个项目集和项目中,也可以选择某一个产品将其下面所属的迭代归并到项目集和项目中。";
|
||||
$lang->upgrade->mergeByProject = "独立的迭代:可以选择若干迭代归并到一个项目中,也可以独立归并。";
|
||||
|
||||
@@ -3945,17 +3945,6 @@ class upgradeModel extends model
|
||||
*/
|
||||
public function processMergedData($programID, $projectID, $productIdList = array(), $sprintIdList = array())
|
||||
{
|
||||
/* Product linked objects. */
|
||||
$this->dao->update(TABLE_PRODUCT)->set('program')->eq($programID)->where('id')->in($productIdList)->exec();
|
||||
$this->dao->update(TABLE_STORY)->set('PRJ')->eq($projectID)->where('product')->in($productIdList)->exec();
|
||||
$this->dao->update(TABLE_BUG)->set('PRJ')->eq($projectID)->where('product')->in($productIdList)->exec();
|
||||
$this->dao->update(TABLE_RELEASE)->set('PRJ')->eq($projectID)->where('product')->in($productIdList)->exec();
|
||||
$this->dao->update(TABLE_CASE)->set('PRJ')->eq($projectID)->where('product')->in($productIdList)->exec();
|
||||
$this->dao->update(TABLE_TESTREPORT)->set('PRJ')->eq($projectID)->where('product')->in($productIdList)->exec();
|
||||
$this->dao->update(TABLE_TESTSUITE)->set('PRJ')->eq($projectID)->where('product')->in($productIdList)->exec();
|
||||
$this->dao->update(TABLE_BUILD)->set('PRJ')->eq($projectID)->where('product')->in($productIdList)->exec();
|
||||
$this->dao->update(TABLE_DOC)->set('PRJ')->eq($projectID)->where("lib IN(SELECT id from " . TABLE_DOCLIB . " WHERE type = 'product' and product " . helper::dbIN($productIdList) . ')')->exec();
|
||||
|
||||
/* Project linked objects. */
|
||||
$this->dao->update(TABLE_TASK)->set('PRJ')->eq($projectID)->where('project')->in($sprintIdList)->exec();
|
||||
$this->dao->update(TABLE_DOC)->set('PRJ')->eq($projectID)->where("lib IN(SELECT id from " . TABLE_DOCLIB . " WHERE type = 'project' and project " . helper::dbIN($sprintIdList) . ')')->exec();
|
||||
@@ -3964,6 +3953,8 @@ class upgradeModel extends model
|
||||
$products = $this->dao->select('id, acl')->from(TABLE_PRODUCT)->where('id')->in($productIdList)->fetchAll();
|
||||
foreach($products as $product)
|
||||
{
|
||||
if($product->program) continue;
|
||||
|
||||
$data = new stdclass();
|
||||
$data->program = $programID;
|
||||
$data->acl = $product->acl == 'custom' ? 'private' : $product->acl;
|
||||
|
||||
@@ -69,3 +69,4 @@
|
||||
<td><?php echo nl2br(html::radio('acl', $lang->program->PGMPRJAclList, 'open', "onclick='setWhite(this.value);'", 'block'));?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class='table-foot text-center'><?php echo html::submitButton();?></div>
|
||||
|
||||
@@ -49,10 +49,14 @@
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td class='text-center' colspan='3'><?php echo html::submitButton();?></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
<?php endif;?>
|
||||
</div>
|
||||
<div class='modal-footer'><?php echo html::submitButton();?></div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -18,7 +18,10 @@
|
||||
<?php echo $lang->upgrade->to20TipsHeader;?>
|
||||
<?php echo $lang->upgrade->to20Desc;?>
|
||||
</div>
|
||||
<div class='panel-footer text-center'><?php echo html::a($this->createLink('upgrade', 'selectVersion'), $lang->upgrade->to20Button, '', "class='btn btn-primary'");?></div>
|
||||
<div class='panel-footer text-center'>
|
||||
<?php echo html::a('https://demo.qcmmi.com', $lang->upgrade->to20Demo, '_blank', "class='btn btn-secondary'");?>
|
||||
<?php echo html::a($this->createLink('upgrade', 'backup'), $lang->upgrade->to20Button, '', "class='btn btn-primary'");?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.lite.html.php';?>
|
||||
|
||||
Reference in New Issue
Block a user