* Add the project when adding execution.

This commit is contained in:
qiyu-xie
2021-03-12 14:43:29 +08:00
parent 39bc711931
commit eee180eb5e
8 changed files with 56 additions and 27 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ $app->loadLang('task');
$config->execution->task = new stdclass();
$config->execution->create = new stdclass();
$config->execution->edit = new stdclass();
$config->execution->create->requiredFields = 'name,code,begin,end';
$config->execution->create->requiredFields = 'project,name,code,begin,end';
$config->execution->edit->requiredFields = 'name,code,begin,end';
$config->execution->customBatchEditFields = 'days,type,teamname,status,desc,PO,QD,PM,RD';
+5 -4
View File
@@ -1136,8 +1136,8 @@ class execution extends control
die(js::confirm($this->lang->execution->importPlanStory, inlink('create', "productID=&executionID=$executionID&copyExecutionID=&planID=$planID&confirm=yes"), inlink('create', "productID=&executionID=$executionID"), 'parent', 'parent'));
}
}
$this->view->title = $this->lang->execution->tips;
$this->view->tips = $this->fetch('execution', 'tips', "executionID=$executionID");
$this->view->title = $this->lang->execution->tips;
$this->view->tips = $this->fetch('execution', 'tips', "executionID=$executionID");
$this->view->executionID = $executionID;
$this->display();
exit;
@@ -1180,7 +1180,7 @@ class execution extends control
if(!empty($_POST))
{
$executionID = $copyExecutionID == '' ? $this->execution->create() : $this->execution->create($copyExecutionID);
$executionID = $this->execution->create($copyExecutionID);
if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError()));
$this->execution->updateProducts($executionID);
@@ -1226,7 +1226,7 @@ class execution extends control
$this->view->title = $this->lang->execution->create;
$this->view->position[] = $this->view->title;
$this->view->executions = array('' => '') + $this->executions;
$this->view->executions = array('' => '') + $this->execution->getList();
$this->view->groups = $this->loadModel('group')->getPairs();
$this->view->allProducts = array(0 => '') + $this->loadModel('product')->getProductPairsByProject($this->session->PRJ);
$this->view->acl = $acl;
@@ -1234,6 +1234,7 @@ class execution extends control
$this->view->name = $name;
$this->view->code = $code;
$this->view->team = $team;
$this->view->allProjects = array('' => '') + $this->project->getPairsByModel();
$this->view->executionID = $executionID;
$this->view->productID = $productID;
$this->view->products = $products;
+2 -2
View File
@@ -1,6 +1,6 @@
function setCopyProject(projectID)
function setCopyProject(executionID)
{
location.href = createLink('project', 'create', 'productID=&projectID=0&copyProjectID=' + projectID);
location.href = createLink('execution', 'create', 'productID=&executionID=0&copyExecutionID=' + executionID);
}
$(function()
+1
View File
@@ -16,6 +16,7 @@ $lang->execution->id = $lang->executionCommon . ' ID';
$lang->execution->type = 'Typ';
$lang->execution->name = 'Name';
$lang->execution->code = 'Alias';
$lang->execution->project = 'Project';
$lang->execution->statge = 'Stage';
$lang->execution->pri = 'Priorität';
$lang->execution->openedBy = 'OpenedBy';
+2 -6
View File
@@ -16,6 +16,7 @@ $lang->execution->id = $lang->executionCommon . ' ID';
$lang->execution->type = 'Type';
$lang->execution->name = "{$lang->executionCommon} Name";
$lang->execution->code = 'Code';
$lang->execution->project = 'Project';
$lang->execution->statge = 'Stage';
$lang->execution->pri = 'Priority';
$lang->execution->openedBy = 'OpenedBy';
@@ -306,12 +307,7 @@ $lang->execution->fixFirstWithLeft = 'Update hours left too';
$lang->execution->unfinishedExecution = "This {$lang->executionCommon} has ";
$lang->execution->unfinishedTask = "[%s] unfinished tasks. ";
$lang->execution->unresolvedBug = "[%s] unresolved bugs. ";
$lang->execution->action = new stdclass();
$lang->execution->action->opened = '$date, created by <strong>$actor</strong> . $extra' . "\n";
$lang->execution->action->managed = '$date, managed by <strong>$actor</strong> . $extra' . "\n";
$lang->execution->action->edited = '$date, edited by <strong>$actor</strong> . $extra' . "\n";
$lang->execution->action->extra = "The linked {$lang->productCommon}s are %s.";
$lang->execution->projectNotEmpty = 'Project cannot be empty.';
/* Statistics. */
$lang->execution->charts = new stdclass();
+2 -6
View File
@@ -17,6 +17,7 @@ $lang->execution->id = $lang->executionCommon . '编号';
$lang->execution->type = $lang->executionCommon . '类型';
$lang->execution->name = $lang->executionCommon . '名称';
$lang->execution->code = $lang->executionCommon . '代号';
$lang->execution->project = '所属项目';
$lang->execution->execName = '执行名称';
$lang->execution->execCode = '执行代号';
$lang->execution->statge = '阶段';
@@ -310,12 +311,7 @@ $lang->execution->fixFirstWithLeft = '修改剩余工时';
$lang->execution->unfinishedExecution = "该{$lang->executionCommon}下还有";
$lang->execution->unfinishedTask = "[%s]个未完成的任务,";
$lang->execution->unresolvedBug = "[%s]个未解决的bug,";
$lang->execution->action = new stdclass();
$lang->execution->action->opened = '$date, 由 <strong>$actor</strong> 创建。$extra' . "\n";
$lang->execution->action->managed = '$date, 由 <strong>$actor</strong> 维护。$extra' . "\n";
$lang->execution->action->edited = '$date, 由 <strong>$actor</strong> 编辑。$extra' . "\n";
$lang->execution->action->extra = '相关产品为 %s。';
$lang->execution->projectNotEmpty = '所属项目不能为空。';
/* 统计。*/
$lang->execution->charts = new stdclass();
+36 -6
View File
@@ -326,9 +326,15 @@ class executionModel extends model
{
$this->lang->execution->team = $this->lang->execution->teamname;
if(empty($_POST['project']))
{
dao::$errors['message'][] = $this->lang->execution->projectNotEmpty;
return false;
}
/* Determine whether to add a sprint or a stage according to the model of the execution. */
$execution = $this->getByID($this->session->PRJ);
$sprintType = $this->config->systemMode == 'new' ? zget($this->config->execution->modelList, $execution->model, '') : 'sprint';
$project = $this->getByID($_POST['project']);
$sprintType = $this->config->systemMode == 'new' ? zget($this->config->execution->modelList, $project->model, '') : 'sprint';
/* If the execution model is a stage, determine whether the product is linked. */
if($sprintType == 'stage' and empty($this->post->products[0]))
@@ -346,8 +352,7 @@ class executionModel extends model
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', helper::now())
->setDefault('team', substr($this->post->name,0, 30))
->setIF($this->config->systemMode == 'new', 'project', $this->session->PRJ)
->setIF($this->config->systemMode == 'new', 'parent', $this->session->PRJ)
->setIF($this->config->systemMode == 'new', 'parent', $this->post->project)
->setIF($this->post->acl == 'open', 'whitelist', '')
->join('whitelist', ',')
->add('type', $sprintType)
@@ -387,7 +392,7 @@ class executionModel extends model
$this->file->updateObjectID($this->post->uid, $executionID, 'execution');
/* Update the path. */
if(isset($this->config->maxVersion)) $this->loadModel('programplan')->setTreePath($executionID);
$this->setTreePath($executionID);
/* Copy team of execution. */
if($copyExecutionID != '')
@@ -419,7 +424,7 @@ class executionModel extends model
$member->hours = $this->config->execution->defaultWorkhours;
$this->dao->insert(TABLE_TEAM)->data($member)->exec();
$this->addExecutionMembers($this->session->PRJ, array($member));
$this->addExecutionMembers($sprint->project, array($member));
}
/* Create doc lib. */
@@ -3547,4 +3552,29 @@ class executionModel extends model
->fetchPairs('project', 'name');
return $productpairs;
}
/**
** Set stage tree path.
**
** @param int $executionID
** @access public
** @return bool
**/
public function setTreePath($executionID)
{
$execution = $this->dao->select('id,type,parent,path,grade')->from(TABLE_PROJECT)->where('id')->eq($executionID)->fetch();
$parent = $this->dao->select('id,type,parent,path,grade')->from(TABLE_PROJECT)->where('id')->eq($execution->parent)->fetch();
if($parent->type == 'project')
{
$path['path'] = ",{$parent->id},{$execution->id},";
$path['grade'] = 1;
}
elseif($parent->type == 'stage')
{
$path['path'] = $parent->path . "{$execution->id},";
$path['grade'] = $parent->grade + 1;
}
$this->dao->update(TABLE_PROJECT)->set('path')->eq($path['path'])->set('grade')->eq($path['grade'])->where('id')->eq($execution->id)->exec();
}
}
+7 -2
View File
@@ -46,6 +46,11 @@
</div>
<form class='form-indicator main-form form-ajax' method='post' target='hiddenwin' id='dataform'>
<table class='table table-form'>
<tr>
<th class='w-120px'><?php echo $lang->execution->project;?></th>
<td class="col-main"><?php echo html::select("project", $allProjects, '', "class='form-control chosen' required onchange='loadBranches(this)'");?></td>
<td></td><td></td>
</tr>
<tr>
<th class='w-120px'><?php echo $lang->execution->name;?></th>
<td class="col-main"><?php echo html::input('name', $name, "class='form-control' required");?></td>
@@ -201,13 +206,13 @@
</div>
<?php else:?>
<div id='copyProjects' class='row'>
<?php foreach ($executions as $id => $name):?>
<?php foreach ($executions as $id => $execution):?>
<?php if(empty($id)):?>
<?php if($copyExecutionID != 0):?>
<div class='col-md-4 col-sm-6'><a href='javascript:;' data-id='' class='cancel'><?php echo html::icon($lang->icons['cancel']) . ' ' . $lang->execution->cancelCopy;?></a></div>
<?php endif;?>
<?php else: ?>
<div class='col-md-4 col-sm-6'><a href='javascript:;' data-id='<?php echo $id;?>' class='nobr <?php echo ($copyExecutionID == $id) ? ' active' : '';?>'><?php echo html::icon($lang->icons[$iconObject], 'text-muted') . ' ' . $name;?></a></div>
<div class='col-md-4 col-sm-6'><a href='javascript:;' data-id='<?php echo $id;?>' class='nobr <?php echo ($copyExecutionID == $id) ? ' active' : '';?>'><?php echo html::icon($lang->icons[$execution->type], 'text-muted') . ' ' . $execution->name;?></a></div>
<?php endif; ?>
<?php endforeach;?>
</div>