* Finish task #40016,40017.
This commit is contained in:
@@ -229,6 +229,7 @@ class upgrade extends control
|
||||
$linkedProducts = array();
|
||||
$linkedSprints = array();
|
||||
$unlinkSprints = array();
|
||||
$sprintProducts = array();
|
||||
|
||||
/* Compute checked products and sprints, unchecked products and sprints. */
|
||||
foreach($_POST['products'] as $lineID => $products)
|
||||
@@ -241,7 +242,8 @@ class upgrade extends control
|
||||
{
|
||||
foreach($_POST['sprints'][$lineID][$productID] as $sprintID)
|
||||
{
|
||||
$linkedSprints[$sprintID] = $sprintID;
|
||||
$linkedSprints[$sprintID] = $sprintID;
|
||||
$sprintProducts[$sprintID] = $productID;
|
||||
unset($_POST['sprintIdList'][$lineID][$productID][$sprintID]);
|
||||
}
|
||||
$unlinkSprints[$productID] = $this->post->sprintIdList[$lineID][$productID];
|
||||
@@ -250,11 +252,21 @@ class upgrade extends control
|
||||
}
|
||||
|
||||
/* Create Program. */
|
||||
list($programID, $projectID, $lineID) = $this->upgrade->createProgram($linkedProducts, $linkedSprints);
|
||||
list($programID, $projectList, $lineID) = $this->upgrade->createProgram($linkedProducts, $linkedSprints);
|
||||
if(dao::isError()) die(js::error(dao::getError()));
|
||||
|
||||
/* Process merged products and projects. */
|
||||
$this->upgrade->processMergedData($programID, $projectID, $lineID, $linkedProducts, $linkedSprints);
|
||||
if($_POST['projectType'] == 'execution')
|
||||
{
|
||||
$this->upgrade->processMergedData($programID, $projectList, $lineID, $linkedProducts, $linkedSprints);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach($linkedSprints as $sprint)
|
||||
{
|
||||
$this->upgrade->processMergedData($programID, $projectList[$sprint], $lineID, $sprintProducts[$sprint], array($sprint => $sprint));
|
||||
}
|
||||
}
|
||||
|
||||
/* Process unlinked sprint and product. */
|
||||
foreach($linkedProducts as $productID => $product)
|
||||
|
||||
@@ -16,6 +16,7 @@ div.divider {vertical-align: middle;}
|
||||
.main-row .side-col .nav li.active div a {background: #006af1; color: #fff; border-radius: 4px;}
|
||||
.main-row .side-col .nav li div a {width: 80%; display: inline-block; padding: 8px 15px;}
|
||||
|
||||
#lineBox > .cell {height: 700px;}
|
||||
#source > .cell {padding: 0; position: relative; height: 450px;}
|
||||
#source > .cell > .lineGroup-title {position: absolute; top: 0; left: 0; right: 0; padding: 10px;}
|
||||
#source > .cell > .line-groups {position: absolute; top: 40px; left: 0; bottom: 0; right: 0; overflow: auto; padding: 0 10px 10px 10px;}
|
||||
|
||||
@@ -13,22 +13,23 @@ $(function()
|
||||
var options = {
|
||||
selector: 'input',
|
||||
listenClick: false,
|
||||
clickBehavior:"single",
|
||||
select: function(e)
|
||||
{
|
||||
$('[data-id=' + e.id + ']').prop('checked', true);
|
||||
},
|
||||
unselect: function(e)
|
||||
{
|
||||
$('[data-id=' + e.id + ']').prop('checked', false);
|
||||
},
|
||||
finish: function(e)
|
||||
{
|
||||
|
||||
var lineID = $('.nav li.active').attr('lineid');
|
||||
var checkedLines = true;
|
||||
var checkedProduct = true;
|
||||
var checkedProject = true;
|
||||
|
||||
/* All products selected. */
|
||||
$("[id^='products\[" + lineID + "\]']").each(function()
|
||||
{
|
||||
if(!$(this).prop('checked')) checkedProduct = false;
|
||||
})
|
||||
$('#checkAllProducts').prop('checked', checkedProduct);
|
||||
$("[id^='productLines\[" + lineID + "\]']").prop('checked', checkedProduct);
|
||||
|
||||
/* All projects selected. */
|
||||
$("[id^='sprints\[" + lineID + "\]']").each(function()
|
||||
{
|
||||
@@ -46,18 +47,9 @@ $(function()
|
||||
$('#checkAllProducts').prop('checked', checkedProject);
|
||||
$("[id^='productLines\[" + lineID + "\]']").prop('checked', checkedProject);
|
||||
|
||||
/* All products selected. */
|
||||
$("[id^='products\[" + lineID + "\]']").each(function()
|
||||
{
|
||||
if(!$(this).prop('checked')) checkedProduct = false;
|
||||
})
|
||||
$('#checkAllProducts').prop('checked', checkedProduct);
|
||||
$("[id^='productLines\[" + lineID + "\]']").prop('checked', checkedProduct);
|
||||
|
||||
/* Select the product line of the current page. */
|
||||
if($('.nav li.active').find('[id^=productLines]').prop('checked'))
|
||||
{
|
||||
|
||||
var lineID = $('.nav li.active').attr('lineid');
|
||||
$('#checkAllProducts').prop('checked', true);
|
||||
$('#checkAllProjects').prop('checked', true);
|
||||
@@ -81,14 +73,29 @@ $(function()
|
||||
})
|
||||
$('#checkAllLines').prop('checked', checkedLines);
|
||||
|
||||
/* If the project is checked, the relevant form will be displayed according to the selected mode. */
|
||||
$('[id^=sprints]').each(function()
|
||||
{
|
||||
if($(this).prop('checked'))
|
||||
{
|
||||
hiddenProject();
|
||||
var projectType = $('input[name="projectType"]:checked').val();
|
||||
if(projectType == 'project') $('.projectName').addClass('hidden');
|
||||
if(projectType == 'execution') $('.projectName').removeClass('hidden');
|
||||
if(projectType == 'project')
|
||||
{
|
||||
$('.projectName').addClass('hidden');
|
||||
$('.projectAcl').addClass('hidden');
|
||||
$('.programAcl').removeClass('hidden');
|
||||
$('[name=projectAcl]').attr('disabled', 'disabled');
|
||||
$('[name=programAcl]').removeAttr('disabled');
|
||||
}
|
||||
if(projectType == 'execution')
|
||||
{
|
||||
$('.projectName').removeClass('hidden');
|
||||
$('.programAcl').addClass('hidden');
|
||||
$('.projectAcl').removeClass('hidden');
|
||||
$('[name=programAcl]').attr('disabled', 'disabled');
|
||||
$('[name=projectAcl]').removeAttr('disabled');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
})
|
||||
@@ -120,6 +127,33 @@ $(function()
|
||||
$('[name^=products]').prop('checked', false);
|
||||
$('[name^=sprints]').prop('checked', false);
|
||||
}
|
||||
|
||||
/* If the project is checked, the relevant form will be displayed according to the selected mode. */
|
||||
$('[id^=sprints]').each(function()
|
||||
{
|
||||
if($(this).prop('checked'))
|
||||
{
|
||||
hiddenProject();
|
||||
var projectType = $('input[name="projectType"]:checked').val();
|
||||
if(projectType == 'project')
|
||||
{
|
||||
$('.projectName').addClass('hidden');
|
||||
$('.projectAcl').addClass('hidden');
|
||||
$('.programAcl').removeClass('hidden');
|
||||
$('[name=projectAcl]').attr('disabled', 'disabled');
|
||||
$('[name=programAcl]').removeAttr('disabled');
|
||||
}
|
||||
if(projectType == 'execution')
|
||||
{
|
||||
$('.projectName').removeClass('hidden');
|
||||
$('.programAcl').addClass('hidden');
|
||||
$('.projectAcl').removeClass('hidden');
|
||||
$('[name=programAcl]').attr('disabled', 'disabled');
|
||||
$('[name=projectAcl]').removeAttr('disabled');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$('#checkAllProducts').click(function()
|
||||
@@ -139,6 +173,7 @@ $(function()
|
||||
$('[name^=products]').prop('checked', false);
|
||||
$('[name^=sprints]').prop('checked', false);
|
||||
}
|
||||
hiddenProject();
|
||||
})
|
||||
|
||||
$('#checkAllProjects').click(function()
|
||||
@@ -158,6 +193,7 @@ $(function()
|
||||
$('[name^=products]').prop('checked', false);
|
||||
$('[name^=sprints]').prop('checked', false);
|
||||
}
|
||||
hiddenProject();
|
||||
})
|
||||
|
||||
programBegin = $('.programParams #begin').val();
|
||||
@@ -170,7 +206,7 @@ $(function()
|
||||
|
||||
$('[name^=productLines]').change(function()
|
||||
{
|
||||
var value = $(this).val();
|
||||
var value = $(this).val();
|
||||
var hidden = $('#line' + value).is(':hidden');
|
||||
if($(this).prop('checked'))
|
||||
{
|
||||
@@ -178,8 +214,8 @@ $(function()
|
||||
{
|
||||
$('#checkAllProducts').prop('checked', true);
|
||||
$('#checkAllProjects').prop('checked', true);
|
||||
$('[data-line=' + value + ']').prop('checked', true);
|
||||
}
|
||||
$('[data-line=' + value + ']').prop('checked', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -188,8 +224,8 @@ $(function()
|
||||
{
|
||||
$('#checkAllProducts').prop('checked', false);
|
||||
$('#checkAllProjects').prop('checked', false);
|
||||
$('[data-line=' + value + ']').prop('checked', false);
|
||||
}
|
||||
$('[data-line=' + value + ']').prop('checked', false);
|
||||
}
|
||||
|
||||
var checked = true;
|
||||
@@ -198,6 +234,34 @@ $(function()
|
||||
if(!$(this).prop('checked') && $(this).val()) checked = false;
|
||||
})
|
||||
$('#checkAllLines').prop('checked', checked);
|
||||
|
||||
/* If the project is checked, the relevant form will be displayed according to the selected mode. */
|
||||
$('[id^=sprints]').each(function()
|
||||
{
|
||||
if($(this).prop('checked'))
|
||||
{
|
||||
var projectType = $('input[name="projectType"]:checked').val();
|
||||
if(projectType == 'project')
|
||||
{
|
||||
$('.projectName').addClass('hidden');
|
||||
$('.projectAcl').addClass('hidden');
|
||||
$('.programAcl').removeClass('hidden');
|
||||
$('[name=projectAcl]').attr('disabled', 'disabled');
|
||||
$('[name=programAcl]').removeAttr('disabled');
|
||||
}
|
||||
if(projectType == 'execution')
|
||||
{
|
||||
$('.projectName').removeClass('hidden');
|
||||
$('.programAcl').addClass('hidden');
|
||||
$('.projectAcl').removeClass('hidden');
|
||||
$('[name=programAcl]').attr('disabled', 'disabled');
|
||||
$('[name=projectAcl]').removeAttr('disabled');
|
||||
}
|
||||
hiddenProject();
|
||||
return false;
|
||||
}
|
||||
})
|
||||
hiddenProject();
|
||||
})
|
||||
|
||||
$('[name^=lines]').change(function()
|
||||
@@ -297,6 +361,32 @@ $(function()
|
||||
})
|
||||
$('#checkAllProducts').prop('checked', checkedProduct);
|
||||
$('#checkAllProjects').prop('checked', checkedProduct);
|
||||
|
||||
$('[id^=sprints]').each(function()
|
||||
{
|
||||
if($(this).prop('checked'))
|
||||
{
|
||||
hiddenProject();
|
||||
var projectType = $('input[name="projectType"]:checked').val();
|
||||
if(projectType == 'project')
|
||||
{
|
||||
$('.projectName').addClass('hidden');
|
||||
$('.projectAcl').addClass('hidden');
|
||||
$('.programAcl').removeClass('hidden');
|
||||
$('[name=projectAcl]').attr('disabled', 'disabled');
|
||||
$('[name=programAcl]').removeAttr('disabled');
|
||||
}
|
||||
if(projectType == 'execution')
|
||||
{
|
||||
$('.projectName').removeClass('hidden');
|
||||
$('.programAcl').addClass('hidden');
|
||||
$('.projectAcl').removeClass('hidden');
|
||||
$('[name=programAcl]').attr('disabled', 'disabled');
|
||||
$('[name=projectAcl]').removeAttr('disabled');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
$('[name^=products]').change(function()
|
||||
@@ -385,6 +475,10 @@ $(function()
|
||||
$('.createExecutionTip').removeClass('hidden');
|
||||
$('.createProjectTip').addClass('hidden');
|
||||
$('.projectName').removeClass('hidden');
|
||||
$('.programAcl').addClass('hidden');
|
||||
$('.projectAcl').removeClass('hidden');
|
||||
$('[name=programAcl]').attr('disabled', 'disabled');
|
||||
$('[name=projectAcl]').removeAttr('disabled');
|
||||
}
|
||||
|
||||
if($(this).val() == 'project')
|
||||
@@ -392,6 +486,10 @@ $(function()
|
||||
$('.createProjectTip').removeClass('hidden');
|
||||
$('.createExecutionTip').addClass('hidden');
|
||||
$('.projectName').addClass('hidden');
|
||||
$('.projectAcl').addClass('hidden');
|
||||
$('.programAcl').removeClass('hidden');
|
||||
$('[name=projectAcl]').attr('disabled', 'disabled');
|
||||
$('[name=programAcl]').removeAttr('disabled');
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
@@ -112,6 +112,8 @@ $lang->upgrade->repo = 'Repo';
|
||||
$lang->upgrade->mergeRepo = 'Merge Repo';
|
||||
$lang->upgrade->setProgram = 'Set the project to which the program belongs';
|
||||
$lang->upgrade->dataMethod = 'Data migration method';
|
||||
$lang->upgrade->begin = 'Begin Date';
|
||||
$lang->upgrade->end = 'End Date';
|
||||
|
||||
$lang->upgrade->newProgram = 'Create';
|
||||
$lang->upgrade->projectEmpty = 'Project must be not empty.';
|
||||
@@ -130,11 +132,12 @@ $lang->upgrade->projectType['project'] = "Upgrade the historical {$lang->proje
|
||||
$lang->upgrade->projectType['execution'] = "Upgrade the historical {$lang->projectCommon} as an execution";
|
||||
|
||||
$lang->upgrade->createProjectTip = <<<EOT
|
||||
<p>The historical {$lang->projectCommon} after the upgrade corresponds to the projects in the new version one by one.</p>
|
||||
<p>The system will create an execution with the same name as the {$lang->projectCommon} according to the history {$lang->projectCommon}, and replace the previous {$lang->projectCommon} Data such as tasks, requirements, and bugs are migrated to execution.</p>
|
||||
<p>After the upgrade, the existing {$lang->projectCommon} will be Project in the new version.</p>
|
||||
<p>ZenTao will create an item in Execute with the same name of {$lang->projectCommon} according to the data in {$lang->projectCommon}, and move the tasks, stories, and bugs in {$lang->projectCommon} to it.</p>
|
||||
EOT;
|
||||
$lang->upgrade->createExecutionTip = <<<EOT
|
||||
<p>ZenTao will upgrade existing {$lang->projectCommon} as Iteration.</p>
|
||||
<p>After the upgrade, the data of existing {$lang->projectCommon} will be in a Project - Execute of the new version .</p>
|
||||
EOT;
|
||||
|
||||
$lang->upgrade->createExecutionTip = <<<EOT
|
||||
<p>The historical {$lang->projectCommon} after the upgrade corresponds to the executions in the new version one by one.</p>
|
||||
EOT;
|
||||
include dirname(__FILE__) . '/version.php';
|
||||
|
||||
@@ -100,6 +100,8 @@ $lang->upgrade->repo = 'Repo';
|
||||
$lang->upgrade->mergeRepo = 'Merge Repo';
|
||||
$lang->upgrade->setProgram = 'Set the project to which the program belongs';
|
||||
$lang->upgrade->dataMethod = 'Data migration method';
|
||||
$lang->upgrade->begin = 'Begin Date';
|
||||
$lang->upgrade->end = 'End Date';
|
||||
|
||||
$lang->upgrade->newProgram = 'Create';
|
||||
$lang->upgrade->projectEmpty = 'Project must be not empty.';
|
||||
@@ -115,11 +117,12 @@ $lang->upgrade->projectType['project'] = "Upgrade the historical {$lang->proje
|
||||
$lang->upgrade->projectType['execution'] = "Upgrade the historical {$lang->projectCommon} as an execution";
|
||||
|
||||
$lang->upgrade->createProjectTip = <<<EOT
|
||||
<p>The historical {$lang->projectCommon} after the upgrade corresponds to the projects in the new version one by one.</p>
|
||||
<p>The system will create an execution with the same name as the {$lang->projectCommon} according to the history {$lang->projectCommon}, and replace the previous {$lang->projectCommon} Data such as tasks, requirements, and bugs are migrated to execution.</p>
|
||||
<p>After the upgrade, the existing {$lang->projectCommon} will be Project in the new version.</p>
|
||||
<p>ZenTao will create an item in Execute with the same name of {$lang->projectCommon} according to the data in {$lang->projectCommon}, and move the tasks, stories, and bugs in {$lang->projectCommon} to it.</p>
|
||||
EOT;
|
||||
$lang->upgrade->createExecutionTip = <<<EOT
|
||||
<p>ZenTao will upgrade existing {$lang->projectCommon} as Iteration.</p>
|
||||
<p>After the upgrade, the data of existing {$lang->projectCommon} will be in a Project - Execute of the new version .</p>
|
||||
EOT;
|
||||
|
||||
$lang->upgrade->createExecutionTip = <<<EOT
|
||||
<p>The historical {$lang->projectCommon} after the upgrade corresponds to the executions in the new version one by one.</p>
|
||||
EOT;
|
||||
include dirname(__FILE__) . '/version.php';
|
||||
|
||||
@@ -113,6 +113,8 @@ $lang->upgrade->repo = 'Repo';
|
||||
$lang->upgrade->mergeRepo = 'Merge Repo';
|
||||
$lang->upgrade->setProgram = 'Set the project to which the program belongs';
|
||||
$lang->upgrade->dataMethod = 'Data migration method';
|
||||
$lang->upgrade->begin = 'Begin Date';
|
||||
$lang->upgrade->end = 'End Date';
|
||||
|
||||
$lang->upgrade->newProgram = 'Create';
|
||||
$lang->upgrade->projectEmpty = 'Project must be not empty.';
|
||||
@@ -131,11 +133,12 @@ $lang->upgrade->projectType['project'] = "Upgrade the historical {$lang->proje
|
||||
$lang->upgrade->projectType['execution'] = "Upgrade the historical {$lang->projectCommon} as an execution";
|
||||
|
||||
$lang->upgrade->createProjectTip = <<<EOT
|
||||
<p>The historical {$lang->projectCommon} after the upgrade corresponds to the projects in the new version one by one.</p>
|
||||
<p>The system will create an execution with the same name as the {$lang->projectCommon} according to the history {$lang->projectCommon}, and replace the previous {$lang->projectCommon} Data such as tasks, requirements, and bugs are migrated to execution.</p>
|
||||
<p>After the upgrade, the existing {$lang->projectCommon} will be Project in the new version.</p>
|
||||
<p>ZenTao will create an item in Execute with the same name of {$lang->projectCommon} according to the data in {$lang->projectCommon}, and move the tasks, stories, and bugs in {$lang->projectCommon} to it.</p>
|
||||
EOT;
|
||||
$lang->upgrade->createExecutionTip = <<<EOT
|
||||
<p>ZenTao will upgrade existing {$lang->projectCommon} as Iteration.</p>
|
||||
<p>After the upgrade, the data of existing {$lang->projectCommon} will be in a Project - Execute of the new version .</p>
|
||||
EOT;
|
||||
|
||||
$lang->upgrade->createExecutionTip = <<<EOT
|
||||
<p>The historical {$lang->projectCommon} after the upgrade corresponds to the executions in the new version one by one.</p>
|
||||
EOT;
|
||||
include dirname(__FILE__) . '/version.php';
|
||||
|
||||
@@ -113,6 +113,8 @@ $lang->upgrade->repo = 'Repo';
|
||||
$lang->upgrade->mergeRepo = 'Merge Repo';
|
||||
$lang->upgrade->setProgram = 'Set the project to which the program belongs';
|
||||
$lang->upgrade->dataMethod = 'Data migration method';
|
||||
$lang->upgrade->begin = 'Begin Date';
|
||||
$lang->upgrade->end = 'End Date';
|
||||
|
||||
$lang->upgrade->newProgram = 'Create';
|
||||
$lang->upgrade->projectEmpty = 'Project must be not empty.';
|
||||
@@ -128,11 +130,12 @@ $lang->upgrade->projectType['project'] = "Upgrade the historical {$lang->proje
|
||||
$lang->upgrade->projectType['execution'] = "Upgrade the historical {$lang->projectCommon} as an execution";
|
||||
|
||||
$lang->upgrade->createProjectTip = <<<EOT
|
||||
<p>The historical {$lang->projectCommon} after the upgrade corresponds to the projects in the new version one by one.</p>
|
||||
<p>The system will create an execution with the same name as the {$lang->projectCommon} according to the history {$lang->projectCommon}, and replace the previous {$lang->projectCommon} Data such as tasks, requirements, and bugs are migrated to execution.</p>
|
||||
<p>After the upgrade, the existing {$lang->projectCommon} will be Project in the new version.</p>
|
||||
<p>ZenTao will create an item in Execute with the same name of {$lang->projectCommon} according to the data in {$lang->projectCommon}, and move the tasks, stories, and bugs in {$lang->projectCommon} to it.</p>
|
||||
EOT;
|
||||
$lang->upgrade->createExecutionTip = <<<EOT
|
||||
<p>ZenTao will upgrade existing {$lang->projectCommon} as Iteration.</p>
|
||||
<p>After the upgrade, the data of existing {$lang->projectCommon} will be in a Project - Execute of the new version .</p>
|
||||
EOT;
|
||||
|
||||
$lang->upgrade->createExecutionTip = <<<EOT
|
||||
<p>The historical {$lang->projectCommon} after the upgrade corresponds to the executions in the new version one by one.</p>
|
||||
EOT;
|
||||
include dirname(__FILE__) . '/version.php';
|
||||
|
||||
@@ -100,6 +100,8 @@ $lang->upgrade->repo = '版本库';
|
||||
$lang->upgrade->mergeRepo = '归并版本库';
|
||||
$lang->upgrade->setProgram = '设置项目所属项目集';
|
||||
$lang->upgrade->dataMethod = '数据迁移方式';
|
||||
$lang->upgrade->begin = '开始日期';
|
||||
$lang->upgrade->end = '结束日期';
|
||||
|
||||
$lang->upgrade->newProgram = '新建';
|
||||
$lang->upgrade->projectEmpty = '所属项目不能为空!';
|
||||
@@ -120,6 +122,7 @@ $lang->upgrade->createProjectTip = <<<EOT
|
||||
EOT;
|
||||
|
||||
$lang->upgrade->createExecutionTip = <<<EOT
|
||||
<p>升级后历史的{$lang->projectCommon}一一对应新版本中的迭代。</p>
|
||||
<p>系统会把历史的{$lang->projectCommon}作为迭代进行升级。</p>
|
||||
<p>升级后历史的{$lang->projectCommon}数据将对应新版本中项目下的执行。</p>
|
||||
EOT;
|
||||
include dirname(__FILE__) . '/version.php';
|
||||
|
||||
+85
-54
@@ -4261,7 +4261,7 @@ class upgradeModel extends model
|
||||
$program->openedBy = $account;
|
||||
$program->openedDate = helper::now();
|
||||
$program->openedVersion = $this->config->version;
|
||||
$program->acl = 'open';
|
||||
$program->acl = isset($data->programAcl) ? $data->programAcl : 'open';
|
||||
$program->days = $this->computeDaysDelta($program->begin, $program->end);
|
||||
|
||||
$this->app->loadLang('program');
|
||||
@@ -4327,66 +4327,97 @@ class upgradeModel extends model
|
||||
|
||||
if(isset($data->newProject))
|
||||
{
|
||||
if(!$this->post->longTime and !$this->post->end) die(js::alert(sprintf($this->lang->error->notempty, $this->lang->program->end)));
|
||||
if(!$this->post->longTime and !$this->post->end) die(js::alert(sprintf($this->lang->error->notempty, $this->lang->upgrade->end)));
|
||||
|
||||
/* Insert project. */
|
||||
$project = new stdclass();
|
||||
$project->name = $data->projectName;
|
||||
$project->type = 'project';
|
||||
$project->model = 'scrum';
|
||||
$project->parent = $programID;
|
||||
$project->status = $data->projectStatus;
|
||||
$project->begin = $data->begin;
|
||||
$project->end = isset($data->end) ? $data->end : LONG_TIME;
|
||||
$project->days = $this->computeDaysDelta($project->begin, $project->end);
|
||||
$project->PM = $data->PM;
|
||||
$project->auth = 'extend';
|
||||
$project->openedBy = $account;
|
||||
$project->openedDate = helper::now();
|
||||
$project->openedVersion = $this->config->version;
|
||||
$project->lastEditedBy = $account;
|
||||
$project->lastEditedDate = helper::now();
|
||||
$project->acl = $data->acl;
|
||||
|
||||
$programDate = $this->dao->select('begin,end')->from(TABLE_PROGRAM)->where('id')->eq($programID)->fetch();
|
||||
if($data->begin < $programDate->begin) $this->dao->update(TABLE_PROGRAM)->set('begin')->eq($data->begin)->where('id')->eq($programID)->exec();
|
||||
if($data->end > $programDate->end) $this->dao->update(TABLE_PROGRAM)->set('end')->eq($data->end)->where('id')->eq($programID)->exec();
|
||||
|
||||
$this->dao->insert(TABLE_PROJECT)->data($project)
|
||||
->batchcheck('name', 'notempty')
|
||||
->check('name', 'unique', "deleted='0' and type = 'project'")
|
||||
->exec();
|
||||
if(dao::isError()) return false;
|
||||
|
||||
$projectID = $this->dao->lastInsertId();
|
||||
$this->dao->update(TABLE_PROJECT)
|
||||
->set('grade')->eq(2)
|
||||
->set('path')->eq(",{$programID},{$projectID},")
|
||||
->set('`order`')->eq($projectID * 5)
|
||||
->where('id')->eq($projectID)
|
||||
->exec();
|
||||
|
||||
/* Create doc lib. */
|
||||
/* Create a project. */
|
||||
$this->loadModel('action');
|
||||
$this->app->loadLang('doc');
|
||||
$lib = new stdclass();
|
||||
$lib->project = $projectID;
|
||||
$lib->name = $this->lang->doclib->main['project'];
|
||||
$lib->type = 'project';
|
||||
$lib->main = '1';
|
||||
$lib->acl = $project->acl != 'program' ? $project->acl : 'custom';
|
||||
$this->dao->insert(TABLE_DOCLIB)->data($lib)->exec();
|
||||
|
||||
$this->loadModel('action')->create('project', $projectID, 'openedbysystem');
|
||||
if($data->projectStatus == 'closed') $this->loadModel('action')->create('project', $projectID, 'closedbysystem');
|
||||
if($data->projectType == 'execution')
|
||||
{
|
||||
$projectList = $this->createProject($programID, $data);
|
||||
}
|
||||
else
|
||||
{
|
||||
$nameList = $this->dao->select('id,name')->from(TABLE_PROJECT)->where('id')->in($projectIdList)->fetchPairs();
|
||||
foreach($projectIdList as $project)
|
||||
{
|
||||
$data->projectName = $nameList[$project];
|
||||
$projectList[$project] = $this->createProject($programID, $data);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$projectID = $data->projects;
|
||||
$this->dao->update(TABLE_PROJECT)->set('status')->eq($data->projectStatus)->where('id')->eq($projectID)->exec();
|
||||
if($data->projectStatus == 'closed') $this->loadModel('action')->create('project', $projectID, 'openedbysystem');
|
||||
$projectList = $data->projects;
|
||||
$this->dao->update(TABLE_PROJECT)->set('status')->eq($data->projectStatus)->where('id')->eq($projectList)->exec();
|
||||
if($data->projectStatus == 'closed') $this->loadModel('action')->create('project', $projectList, 'openedbysystem');
|
||||
}
|
||||
|
||||
return array($programID, $projectID, $lineID);
|
||||
return array($programID, $projectList, $lineID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a project.
|
||||
*
|
||||
* @param int $programID
|
||||
* @param object $data
|
||||
* @access public
|
||||
* @return int|bool
|
||||
*/
|
||||
public function createProject($programID = 0, $data = null)
|
||||
{
|
||||
$now = helper::now();
|
||||
$account = isset($this->app->user->account) ? $this->app->user->account : '';
|
||||
|
||||
/* Insert project. */
|
||||
$project = new stdclass();
|
||||
$project->name = $data->projectName;
|
||||
$project->type = 'project';
|
||||
$project->model = 'scrum';
|
||||
$project->parent = $programID;
|
||||
$project->status = $data->projectStatus;
|
||||
$project->begin = $data->begin;
|
||||
$project->end = isset($data->end) ? $data->end : LONG_TIME;
|
||||
$project->days = $this->computeDaysDelta($project->begin, $project->end);
|
||||
$project->PM = $data->PM;
|
||||
$project->auth = 'extend';
|
||||
$project->openedBy = $account;
|
||||
$project->openedDate = $now;
|
||||
$project->openedVersion = $this->config->version;
|
||||
$project->lastEditedBy = $account;
|
||||
$project->lastEditedDate = $now;
|
||||
$project->acl = isset($data->projectAcl) ? $data->projectAcl : 'open';
|
||||
|
||||
$programDate = $this->dao->select('begin,end')->from(TABLE_PROGRAM)->where('id')->eq($programID)->fetch();
|
||||
if($data->begin < $programDate->begin) $this->dao->update(TABLE_PROGRAM)->set('begin')->eq($data->begin)->where('id')->eq($programID)->exec();
|
||||
if($data->end > $programDate->end) $this->dao->update(TABLE_PROGRAM)->set('end')->eq($data->end)->where('id')->eq($programID)->exec();
|
||||
|
||||
$this->dao->insert(TABLE_PROJECT)->data($project)
|
||||
->batchcheck('name', 'notempty')
|
||||
->check('name', 'unique', "deleted='0' and type = 'project'")
|
||||
->exec();
|
||||
if(dao::isError()) return false;
|
||||
|
||||
$projectID = $this->dao->lastInsertId();
|
||||
$this->dao->update(TABLE_PROJECT)
|
||||
->set('grade')->eq(2)
|
||||
->set('path')->eq(",{$programID},{$projectID},")
|
||||
->set('`order`')->eq($projectID * 5)
|
||||
->where('id')->eq($projectID)
|
||||
->exec();
|
||||
|
||||
/* Create doc lib. */
|
||||
$lib = new stdclass();
|
||||
$lib->project = $projectID;
|
||||
$lib->name = $this->lang->doclib->main['project'];
|
||||
$lib->type = 'project';
|
||||
$lib->main = '1';
|
||||
$lib->acl = $project->acl != 'program' ? $project->acl : 'custom';
|
||||
$this->dao->insert(TABLE_DOCLIB)->data($lib)->exec();
|
||||
|
||||
$this->action->create('project', $projectID, 'openedbysystem');
|
||||
if($data->projectStatus == 'closed') $this->action->create('project', $projectID, 'closedbysystem');
|
||||
return $projectID;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<table class='table table-form'>
|
||||
<table class='table table-form programParams'>
|
||||
<caption class='strong'><?php echo $lang->upgrade->dataMethod;?></caption>
|
||||
<tr><td><?php echo html::radio('projectType', $this->lang->upgrade->projectType, 'project');?></td></tr>
|
||||
<tr><td class='createProjectTip'><?php echo $lang->upgrade->createProjectTip?></td></tr>
|
||||
@@ -96,7 +96,8 @@
|
||||
</tr>
|
||||
<tr class='programParams'>
|
||||
<th><?php echo $lang->project->acl;?></th>
|
||||
<td><?php echo nl2br(html::radio('acl', $lang->project->subAclList, 'open', '', 'block'));?></td>
|
||||
<td class='programAcl'><?php echo nl2br(html::radio('programAcl', $lang->program->aclList, 'open', '', 'block'));?></td>
|
||||
<td class='projectAcl hidden'><?php echo nl2br(html::radio('projectAcl', $lang->project->subAclList, 'open', '', 'block'));?></td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class='table-foot text-center'><?php echo html::submitButton();?></div>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
echo '<br />' . $lang->upgrade->mergeByProductLine;
|
||||
?>
|
||||
</div>
|
||||
<div class='main-row'>
|
||||
<div class='main-row mergeByLine'>
|
||||
<div class='side-col' id='lineBox'>
|
||||
<div class='cell'>
|
||||
<div class='detial'>
|
||||
|
||||
Reference in New Issue
Block a user