Merge branch 'sprint/168_sgm_45161' into 'sprint/168'
Sprint/168 sgm 45161 See merge request easycorp/zentaopms!641
This commit is contained in:
@@ -550,6 +550,41 @@ class upgrade extends control
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename object in upgrade.
|
||||
*
|
||||
* @param string $type project|product|execution
|
||||
* @param string $duplicateList
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function renameObject($type = 'project', $duplicateList = '')
|
||||
{
|
||||
$this->app->loadLang($type);
|
||||
if($_POST)
|
||||
{
|
||||
foreach($this->post->project as $projectID => $projectName)
|
||||
{
|
||||
if(!$projectName) continue;
|
||||
$this->dao->update(TABLE_PROJECT)->set('name')->eq($projectName)->where('id')->eq($projectID)->exec();
|
||||
}
|
||||
|
||||
die(js::closeModal('parent.parent', ''));
|
||||
}
|
||||
|
||||
$objectGroup = array();
|
||||
if($type == 'project' or $type == 'execution')
|
||||
{
|
||||
$objectGroup = $this->dao->select('id,name')->from(TABLE_PROJECT)
|
||||
->where('id')->in($duplicateList)
|
||||
->fetchGroup('name');
|
||||
}
|
||||
|
||||
$this->view->type = $type;
|
||||
$this->view->objectGroup = $objectGroup;
|
||||
$this->display();
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge Repos.
|
||||
*
|
||||
|
||||
@@ -113,6 +113,7 @@ $lang->upgrade->selectProject = 'The target project';
|
||||
$lang->upgrade->projectName = 'Project Name';
|
||||
|
||||
$lang->upgrade->newProgram = 'Create';
|
||||
$lang->upgrade->editedName = 'New Name';
|
||||
$lang->upgrade->projectEmpty = 'Project must be not empty.';
|
||||
$lang->upgrade->mergeSummary = "Dear users, there are %s {$lang->productCommon} and %s {$lang->projectCommon} in your system waiting for Migration. By System Calculation, we recommend your migration plan as follows, you can also adjust according to your own situation:";
|
||||
$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED {$lang->projectCommon}: Consolidate the entire {$lang->productCommon} line and the {$lang->productCommon} and {$lang->projectCommon} below it into one large project.";
|
||||
@@ -123,6 +124,7 @@ $lang->upgrade->mergeRepoTips = "Merge the selected version library under t
|
||||
$lang->upgrade->needBuild4Add = 'Full text retrieval has been added in this upgrad. Please create an index.';
|
||||
$lang->upgrade->errorEngineInnodb = 'Your MySQL version is too low to support InnoDB data table engine. Please modify it to MyISAM and try again.';
|
||||
$lang->upgrade->errorEngineInnodb = 'Your MySQL does not support InnoDB data table engine. Please modify it to MyISAM and try again.';
|
||||
$lang->upgrade->duplicateProject = "Project name in the same program cannot be duplicate. Please adjust the duplicate names.";
|
||||
|
||||
$lang->upgrade->projectType['project'] = "Upgrade the historical {$lang->projectCommon} as a project";
|
||||
$lang->upgrade->projectType['execution'] = "Upgrade the historical {$lang->projectCommon} as an execution";
|
||||
@@ -136,4 +138,5 @@ $lang->upgrade->createExecutionTip = <<<EOT
|
||||
<p>ZenTao will upgrade existing {$lang->projectCommon} as execution.</p>
|
||||
<p>After the upgrade, the data of existing {$lang->projectCommon} will be in a Project - Execute of the new version .</p>
|
||||
EOT;
|
||||
|
||||
include dirname(__FILE__) . '/version.php';
|
||||
|
||||
@@ -115,6 +115,7 @@ $lang->upgrade->programName = 'Program Name';
|
||||
$lang->upgrade->projectName = 'Project Name';
|
||||
|
||||
$lang->upgrade->newProgram = 'Create';
|
||||
$lang->upgrade->editedName = 'New Name';
|
||||
$lang->upgrade->projectEmpty = 'Project must be not empty.';
|
||||
$lang->upgrade->mergeSummary = "Dear users, there are %s {$lang->productCommon} and %s {$lang->projectCommon} in your system waiting for Migration. By System Calculation, we recommend your migration plan as follows, you can also adjust according to your own situation:";
|
||||
$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED {$lang->projectCommon}: Consolidate the entire {$lang->productCommon} line and the {$lang->productCommon} and {$lang->projectCommon} below it into one large project.";
|
||||
@@ -124,6 +125,7 @@ $lang->upgrade->mergeByMoreLink = "{$lang->projectCommon} that relates multip
|
||||
$lang->upgrade->mergeRepoTips = "Merge the selected version library under the selected product.";
|
||||
$lang->upgrade->needBuild4Add = 'Full text retrieval has been added in this upgrade. Need create index. Please go [Admin->System->BuildIndex] page to build index.';
|
||||
$lang->upgrade->errorEngineInnodb = 'Your MySQL does not support InnoDB data table engine. Please modify it to MyISAM and try again.';
|
||||
$lang->upgrade->duplicateProject = "Project name in the same program cannot be duplicate. Please adjust the duplicate names.";
|
||||
|
||||
$lang->upgrade->projectType['project'] = "Upgrade the historical {$lang->projectCommon} as a project";
|
||||
$lang->upgrade->projectType['execution'] = "Upgrade the historical {$lang->projectCommon} as an execution";
|
||||
@@ -138,6 +140,4 @@ $lang->upgrade->createExecutionTip = <<<EOT
|
||||
<p>After the upgrade, the data of existing {$lang->projectCommon} will be in a Project - Execute of the new version .</p>
|
||||
EOT;
|
||||
|
||||
$lang->upgrade->projectNameUnique = "『%s』has the same『%s』. Click {$lang->projectCommon} on the left and edit the name of {$lang->projectCommon}.";
|
||||
|
||||
include dirname(__FILE__) . '/version.php';
|
||||
|
||||
@@ -115,6 +115,7 @@ $lang->upgrade->programName = 'Program Name';
|
||||
$lang->upgrade->projectName = 'Project Name';
|
||||
|
||||
$lang->upgrade->newProgram = 'Create';
|
||||
$lang->upgrade->editedName = 'New Name';
|
||||
$lang->upgrade->projectEmpty = 'Project must be not empty.';
|
||||
$lang->upgrade->mergeSummary = "Dear users, there are %s {$lang->productCommon} and %s {$lang->projectCommon} in your system waiting for Migration. By System Calculation, we recommend your migration plan as follows, you can also adjust according to your own situation:";
|
||||
$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED {$lang->projectCommon}: Consolidate the entire {$lang->productCommon} line and the {$lang->productCommon} and {$lang->projectCommon} below it into one large project.";
|
||||
@@ -124,6 +125,7 @@ $lang->upgrade->mergeByMoreLink = "{$lang->projectCommon} that relates multip
|
||||
$lang->upgrade->mergeRepoTips = "Merge the selected version library under the selected product.";
|
||||
$lang->upgrade->needBuild4Add = 'Full text retrieval has been added in this upgrade. Need create index. Please go [Admin->System->BuildIndex] page to build index.';
|
||||
$lang->upgrade->errorEngineInnodb = 'Your MySQL does not support InnoDB data table engine. Please modify it to MyISAM and try again.';
|
||||
$lang->upgrade->duplicateProject = "Project name in the same program cannot be duplicate. Please adjust the duplicate names.";
|
||||
|
||||
$lang->upgrade->projectType['project'] = "Upgrade the historical {$lang->projectCommon} as a project";
|
||||
$lang->upgrade->projectType['execution'] = "Upgrade the historical {$lang->projectCommon} as an execution";
|
||||
@@ -137,4 +139,5 @@ $lang->upgrade->createExecutionTip = <<<EOT
|
||||
<p>ZenTao will upgrade existing {$lang->projectCommon} as execution.</p>
|
||||
<p>After the upgrade, the data of existing {$lang->projectCommon} will be in a Project - Execute of the new version .</p>
|
||||
EOT;
|
||||
|
||||
include dirname(__FILE__) . '/version.php';
|
||||
|
||||
@@ -115,6 +115,7 @@ $lang->upgrade->programName = 'Program Name';
|
||||
$lang->upgrade->projectName = 'Project Name';
|
||||
|
||||
$lang->upgrade->newProgram = 'Create';
|
||||
$lang->upgrade->editedName = 'New Name';
|
||||
$lang->upgrade->projectEmpty = 'Project must be not empty.';
|
||||
$lang->upgrade->mergeSummary = "Dear users, there are %s {$lang->productCommon} and %s {$lang->projectCommon} in your system waiting for Migration. By System Calculation, we recommend your migration plan as follows, you can also adjust according to your own situation:";
|
||||
$lang->upgrade->mergeByProductLine = "PRODUCTLINE-BASED {$lang->projectCommon}: Consolidate the entire {$lang->productCommon} line and the {$lang->productCommon} and {$lang->projectCommon} below it into one large project.";
|
||||
@@ -124,6 +125,7 @@ $lang->upgrade->mergeByMoreLink = "{$lang->projectCommon} that relates multip
|
||||
$lang->upgrade->mergeRepoTips = "Merge the selected version library under the selected product.";
|
||||
$lang->upgrade->needBuild4Add = 'Full text retrieval has been added in this upgrade. Need create index. Please go [Admin->System->BuildIndex] page to build index.';
|
||||
$lang->upgrade->errorEngineInnodb = 'Your MySQL version is too low to support InnoDB data table engine. Please modify it to MyISAM and try again.';
|
||||
$lang->upgrade->duplicateProject = "Project name in the same program cannot be duplicate. Please adjust the duplicate names.";
|
||||
|
||||
$lang->upgrade->projectType['project'] = "Upgrade the historical {$lang->projectCommon} as a project";
|
||||
$lang->upgrade->projectType['execution'] = "Upgrade the historical {$lang->projectCommon} as an execution";
|
||||
@@ -137,4 +139,5 @@ $lang->upgrade->createExecutionTip = <<<EOT
|
||||
<p>ZenTao will upgrade existing {$lang->projectCommon} as execution.</p>
|
||||
<p>After the upgrade, the data of existing {$lang->projectCommon} will be in a Project - Execute of the new version .</p>
|
||||
EOT;
|
||||
|
||||
include dirname(__FILE__) . '/version.php';
|
||||
|
||||
@@ -115,6 +115,7 @@ $lang->upgrade->programName = '项目集名称';
|
||||
$lang->upgrade->projectName = '项目名称';
|
||||
|
||||
$lang->upgrade->newProgram = '新建';
|
||||
$lang->upgrade->editedName = '调整后名称';
|
||||
$lang->upgrade->projectEmpty = '所属项目不能为空!';
|
||||
$lang->upgrade->mergeSummary = "尊敬的用户,您的系统中共有%s个{$lang->productCommon},%s个{$lang->projectCommon}等待迁移。";
|
||||
$lang->upgrade->mergeByProductLine = "以{$lang->productCommon}线组织的{$lang->productCommon}和{$lang->projectCommon}:将整个{$lang->productCommon}线及其下面的{$lang->productCommon}和{$lang->projectCommon}归并到一个项目集和项目中,也可以分开归并。";
|
||||
@@ -124,6 +125,7 @@ $lang->upgrade->mergeByMoreLink = "关联多个{$lang->productCommon}的{$lan
|
||||
$lang->upgrade->mergeRepoTips = "将选中的版本库归并到所选产品下。";
|
||||
$lang->upgrade->needBuild4Add = '本次升级需要创建索引。请到 [后台->系统->重建索引] 页面,重新创建索引。';
|
||||
$lang->upgrade->errorEngineInnodb = '您当前的数据库不支持使用InnoDB数据表引擎,请修改为MyISAM后重试。';
|
||||
$lang->upgrade->duplicateProject = "同一个项目集内项目名称不能重复,请调整重名的项目名称";
|
||||
|
||||
$lang->upgrade->projectType['project'] = "把历史的{$lang->projectCommon}作为项目升级";
|
||||
$lang->upgrade->projectType['execution'] = "把历史的{$lang->projectCommon}作为执行升级";
|
||||
@@ -138,6 +140,4 @@ $lang->upgrade->createExecutionTip = <<<EOT
|
||||
<p>升级后历史的{$lang->projectCommon}数据将对应新版本中项目下的执行。</p>
|
||||
EOT;
|
||||
|
||||
$lang->upgrade->projectNameUnique = "『%s』已经有『%s』这条记录了。请至左侧{$lang->projectCommon}处修改该{$lang->projectCommon}名称。";
|
||||
|
||||
include dirname(__FILE__) . '/version.php';
|
||||
|
||||
+19
-10
@@ -4418,18 +4418,27 @@ class upgradeModel extends model
|
||||
/* Use historical projects as project upgrades. */
|
||||
$projects = $this->dao->select('id,name,begin,end,status,PM,acl')->from(TABLE_PROJECT)->where('id')->in($projectIdList)->fetchAll('id');
|
||||
|
||||
$hasExistedProjects = $this->dao->select('name')->from(TABLE_PROJECT)->where('type')->eq('project')->fetchPairs('name');
|
||||
$projectPairs = $this->dao->select('name,id')->from(TABLE_PROJECT)
|
||||
->where('deleted')->eq('0')
|
||||
->andWhere('type')->eq('project')
|
||||
->andWhere('parent')->eq($programID)
|
||||
->fetchPairs();
|
||||
|
||||
$this->lang->error->unique = $this->lang->upgrade->projectNameUnique;
|
||||
|
||||
$nameList = array();
|
||||
foreach($projectIdList as $projectID)
|
||||
$duplicateList = '';
|
||||
foreach($projects as $projectID => $project)
|
||||
{
|
||||
$projectName = $projects[$projectID]->name;
|
||||
if(isset($hasExistedProjects[$projectName]) or isset($nameList[$projectName])) dao::$errors['name'][] = 'project#' . $projectID . sprintf($this->lang->error->unique, $this->lang->project->name, $projectName);
|
||||
$nameList[$projectName] = $projectName;
|
||||
if(isset($projectPairs[$project->name]))
|
||||
{
|
||||
$duplicateList .= "$projectID,";
|
||||
$duplicateList .= "{$projectPairs[$project->name]},";
|
||||
}
|
||||
}
|
||||
|
||||
if($duplicateList)
|
||||
{
|
||||
echo "<script>new parent.$.zui.ModalTrigger({url: parent.$.createLink('upgrade', 'renameObject', 'type=project&duplicateList=$duplicateList', '', 1), type: 'iframe', width:'40%'}).show();</script>";
|
||||
die;
|
||||
}
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
|
||||
foreach($projectIdList as $projectID)
|
||||
{
|
||||
@@ -4492,7 +4501,7 @@ class upgradeModel extends model
|
||||
|
||||
$this->dao->insert(TABLE_PROJECT)->data($project)
|
||||
->batchcheck('name', 'notempty')
|
||||
->check('name', 'unique', "type='project'")
|
||||
->check('name', 'unique', "type='project' AND deleted=0")
|
||||
->exec();
|
||||
if(dao::isError()) return false;
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* The html template file of renameObject method of upgrade module of ZenTaoPMS.
|
||||
*
|
||||
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
|
||||
* @license ZPL (http://zpl.pub/page/zplv12.html)
|
||||
* @author Guangming Sun<sunguangming@cnezsoft.com>
|
||||
* @package upgrade
|
||||
* @version $Id: renameobject.html.php 4129 2021-11-30 13:07:14Z sunguangming $
|
||||
*/
|
||||
?>
|
||||
<?php include '../../common/view/header.lite.html.php';?>
|
||||
<style>.group-end {border-bottom: 1px solid #efefef;}</style>
|
||||
<div id='mainContent' class='main-content'>
|
||||
<div class='center-block'>
|
||||
<div class='main-header'>
|
||||
<h2><?php if($type == 'project') echo $lang->upgrade->duplicateProject;?></h2>
|
||||
</div>
|
||||
<form method='post' enctype='multipart/form-data' target='hiddenwin'>
|
||||
<table class='table table-form'>
|
||||
<tr>
|
||||
<th class='w-40px text-left'><?php echo $lang->$type->id;?></th>
|
||||
<th class='c-name text-left'><?php echo $lang->$type->name;?></th>
|
||||
<th class='c-name text-left'><?php echo $lang->upgrade->editedName;?></th>
|
||||
</tr>
|
||||
<?php foreach($objectGroup as $objectName => $objectList):?>
|
||||
<?php foreach($objectList as $key => $object):?>
|
||||
<tr <?php if($object->id == end($objectList)->id) echo "class='group-end'";?>>
|
||||
<td><?php echo $object->id;?></td>
|
||||
<td><?php echo $object->name;?></td>
|
||||
<td><?php echo html::input("project[$object->id]", '', "class='form-control'");?></td>
|
||||
</tr>
|
||||
<?php endforeach;?>
|
||||
<?php endforeach;?>
|
||||
<tr>
|
||||
<td colspan='3' class='text-center form-actions'><?php echo html::submitButton();?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php include '../../common/view/footer.lite.html.php';?>
|
||||
Reference in New Issue
Block a user