*Finish task #45150.

This commit is contained in:
zhengrunyu
2021-12-01 10:14:15 +08:00
parent a4426db6f0
commit 3e4fa30030
8 changed files with 42 additions and 57 deletions
+6 -2
View File
@@ -17,8 +17,12 @@ $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->edit->requiredFields = 'name,code,begin,end';
$config->execution->start = new stdclass();
$config->execution->close = new stdclass();
$config->execution->create->requiredFields = 'name,code,begin,end';
$config->execution->edit->requiredFields = 'name,code,begin,end';
$config->execution->start->requiredFields = 'realBegan';
$config->execution->close->requiredFields = 'realEnd';
$config->execution->customBatchEditFields = 'days,type,teamname,status,desc,PO,QD,PM,RD';
+1 -1
View File
@@ -3442,7 +3442,7 @@ class execution extends control
public function ajaxUpdateKanban($executionID = 0, $enterTime = '', $browseType = '', $groupBy = '')
{
$enterTime = date('Y-m-d H:i:s', $enterTime);
$lastEditedTime = $this->dao->select("max(lastEditedTime) as lastEditedTime")->from(TABLE_KANBANLANE)->where('execution')->eq($executionID)->fetch('lastEditedTime');
$lastEditedTime = $this->dao->select("max(lastEditedTime) as lastEditedTime")->from(TABLE_KANBANLANE)->where('execution')->eq($executionID)->fetch();
if($lastEditedTime > $enterTime)
{
-4
View File
@@ -355,10 +355,6 @@ $lang->execution->unfinishedTask = "[%s] unfinished tasks. ";
$lang->execution->unresolvedBug = "[%s] unresolved bugs. ";
$lang->execution->projectNotEmpty = 'Project cannot be empty.';
$lang->execution->confirmStoryToTask = $lang->SRCommon . '%s are converted to tasks in the current. Do you want to convert them anyways?';
$lang->execution->realBeganNotEmpty = 'Actual Begin should not be empty.';
$lang->execution->realBeganNotFuture = 'Actual Begin should be < = today.';
$lang->execution->realEndNotEmpty = 'Actual End should not be empty.';
$lang->execution->realEndNotFuture = 'Actual End should be < = today.';
/* Statistics. */
$lang->execution->charts = new stdclass();
-4
View File
@@ -356,10 +356,6 @@ $lang->execution->unfinishedTask = "[%s]个未完成的任务,";
$lang->execution->unresolvedBug = "[%s]个未解决的bug";
$lang->execution->projectNotEmpty = '所属项目不能为空。';
$lang->execution->confirmStoryToTask = '%s' . $lang->SRCommon . '已经在当前' . $lang->execution->common . '中转了任务,请确认是否重复转任务。';
$lang->execution->realBeganNotEmpty = "实际开始不能为空。";
$lang->execution->realBeganNotFuture = "实际开始不能大于当前日期。";
$lang->execution->realEndNotEmpty = "实际完成不能为空。";
$lang->execution->realEndNotFuture = "实际完成不能大于当前日期。";
/* 统计。*/
$lang->execution->charts = new stdclass();
+18 -30
View File
@@ -708,27 +708,23 @@ class executionModel extends model
*/
public function start($executionID)
{
$oldExecution = $this->getById($executionID);
$now = helper::now();
$oldExecution = $this->getById($executionID);
$now = helper::now();
$requiredFields = $this->config->execution->start->requiredFields;
$execution = fixer::input('post')
->setDefault('status', 'doing')
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->remove('comment')->get();
->remove('comment')
->get();
if($execution->realBegan == '')
{
dao::$errors['realBegan'] = $this->lang->execution->realBeganNotEmpty;
return false;
}
if($execution->realBegan > helper::today())
{
dao::$errors['realBegan'] = $this->lang->execution->realBeganNotFuture;
return false;
}
$this->dao->update(TABLE_EXECUTION)->data($execution)->autoCheck()->where('id')->eq((int)$executionID)->exec();
$this->dao->update(TABLE_EXECUTION)->data($execution)
->autoCheck()
->check($requiredFields, 'notempty')
->checkIF($execution->realBegan != '', 'realBegan', 'le', helper::today())
->where('id')->eq((int)$executionID)
->exec();
if(!dao::isError()) return common::createChanges($oldExecution, $execution);
}
@@ -866,9 +862,10 @@ class executionModel extends model
*/
public function close($executionID)
{
$oldExecution = $this->getById($executionID);
$now = helper::now();
$oldExecution = $this->getById($executionID);
$now = helper::now();
$requiredFields = $this->config->execution->close->requiredFields;
$execution = fixer::input('post')
->setDefault('status', 'closed')
->setDefault('closedBy', $this->app->user->account)
@@ -878,20 +875,11 @@ class executionModel extends model
->remove('comment')
->get();
if($execution->realEnd == '')
{
dao::$errors['realEnd'] = $this->lang->execution->realEndNotEmpty;
return false;
}
if($execution->realEnd > helper::today())
{
dao::$errors['realEnd'] = $this->lang->execution->realEndNotFuture;
return false;
}
$this->dao->update(TABLE_EXECUTION)->data($execution)
->autoCheck()
->check($requiredFields,'notempty')
->checkIF($execution->realEnd != '', 'realEnd', 'le', helper::today())
->checkIF($execution->realEnd != '', 'realEnd', 'ge', $oldExecution->realBegan)
->where('id')->eq((int)$executionID)
->exec();
+6
View File
@@ -18,6 +18,12 @@ $config->project->edit = new stdclass();
$config->project->create->requiredFields = 'name,code,begin,end';
$config->project->edit->requiredFields = 'name,code,begin,end';
$config->project->start = new stdclass();
$config->project->start->requiredFields = 'realBegan';
$config->project->close = new stdclass();
$config->project->close->requiredFields = 'realEnd';
$config->project->sortFields = new stdclass();
$config->project->sortFields->id = 'id';
$config->project->sortFields->begin = 'begin';
-3
View File
@@ -180,9 +180,6 @@ $lang->project->createExecution = "该项目下没有{$lang->executionCom
$lang->project->unlinkExecutionMember = "该用户参与了%s%s%s个{$lang->execution->common},是否同时将其移除?(该用户所产生的数据不会受影响。)";
$lang->project->unlinkExecutionMembers = "移除的团队成员还参与了项目下的执行,是否同步从执行团队中移除?";
$lang->project->realEndNotEmpty = "实际完成不能为空。";
$lang->project->realEndNotFuture = "实际完成不能大于当前日期。";
$lang->project->tenThousand = '万';
$lang->project->unitList['CNY'] = '人民币';
+11 -13
View File
@@ -1172,15 +1172,20 @@ class projectModel extends model
{
$oldProject = $this->getById($projectID, $type);
$now = helper::now();
$requiredFields = $this->config->project->start->requiredFields;
$project = fixer::input('post')
->add('realBegan', helper::today())
->setDefault('status', 'doing')
->setDefault('lastEditedBy', $this->app->user->account)
->setDefault('lastEditedDate', $now)
->remove('comment')->get();
$this->dao->update(TABLE_PROJECT)->data($project)->autoCheck()->where('id')->eq((int)$projectID)->exec();
$this->dao->update(TABLE_PROJECT)->data($project)
->autoCheck()
->check($requiredFields, 'notempty')
->checkIF($project->realBegan != '', 'realBegan', 'le', helper::today())
->where('id')->eq((int)$projectID)
->exec();
if(!dao::isError()) return common::createChanges($oldProject, $project);
}
@@ -1316,6 +1321,7 @@ class projectModel extends model
{
$oldProject = $this->getById($projectID);
$now = helper::now();
$requiredFields = $this->config->project->close->requiredFields;
$project = fixer::input('post')
->setDefault('status', 'closed')
@@ -1326,19 +1332,11 @@ class projectModel extends model
->remove('comment')
->get();
if($project->realEnd == '')
{
dao::$errors['realEnd'] = $this->lang->project->realEndNotEmpty;
return false;
}
if($project->realEnd > helper::today())
{
dao::$errors['realEnd'] = $this->lang->project->realEndNotFuture;
return false;
}
$this->dao->update(TABLE_PROJECT)->data($project)
->autoCheck()
->check($requiredFields, 'notempty')
->checkIF($project->realEnd != '', 'realEnd', 'le', helper::today())
->checkIF($project->realEnd != '', 'realEnd', 'ge', $oldProject->realBegan)
->where('id')->eq((int)$projectID)
->exec();