Merge branch 'pailei2_zhouxin_50796' into 'pailei2'
Pailei2 zhouxin 50796 See merge request easycorp/zentaopms!2341
This commit is contained in:
@@ -1658,6 +1658,8 @@ class execution extends control
|
||||
if($this->post->names)
|
||||
{
|
||||
$allChanges = $this->execution->batchUpdate();
|
||||
if(dao::isError()) return print(js::error(dao::getError()));
|
||||
|
||||
if(!empty($allChanges))
|
||||
{
|
||||
foreach($allChanges as $executionID => $changes)
|
||||
|
||||
@@ -347,6 +347,8 @@ $lang->execution->errorSameProducts = "{$lang->executionCommon} cannot
|
||||
$lang->execution->errorSameBranches = "{$lang->executionCommon} cannot be linked to the same branch twice";
|
||||
$lang->execution->errorBegin = "The start time of {$lang->executionCommon} cannot be less than the start time of the project %s.";
|
||||
$lang->execution->errorEnd = "The end time of {$lang->executionCommon} cannot be greater than the end time %s of the project.";
|
||||
$lang->execution->errorLetterProject = "The start time of stage cannot be less than the start time of the project %s.";
|
||||
$lang->execution->errorGreaterProject = "The end time of stage cannot be greater than the end time %s of the project.";
|
||||
$lang->execution->accessDenied = "Your access to {$lang->executionCommon} is denied!";
|
||||
$lang->execution->tips = 'Note';
|
||||
$lang->execution->afterInfo = "{$lang->executionCommon} is created. Next you can ";
|
||||
|
||||
@@ -347,6 +347,8 @@ $lang->execution->errorSameProducts = "{$lang->executionCommon}不能
|
||||
$lang->execution->errorSameBranches = "{$lang->executionCommon}不能关联多个相同的分支。";
|
||||
$lang->execution->errorBegin = "{$lang->executionCommon}的开始时间不能小于所属项目的开始时间%s。";
|
||||
$lang->execution->errorEnd = "{$lang->executionCommon}的截止时间不能大于所属项目的结束时间%s。";
|
||||
$lang->execution->errorLetterProject = "阶段的计划开始时间不能小于所属项目的计划开始时间%s。";
|
||||
$lang->execution->errorGreaterProject = "阶段的计划完成时间不能大于所属项目的计划完成时间%s。";
|
||||
$lang->execution->accessDenied = "您无权访问该{$lang->executionCommon}!";
|
||||
$lang->execution->tips = '提示';
|
||||
$lang->execution->afterInfo = "{$lang->executionCommon}添加成功,您现在可以进行以下操作:";
|
||||
|
||||
@@ -574,6 +574,7 @@ class executionModel extends model
|
||||
public function batchUpdate()
|
||||
{
|
||||
$this->loadModel('user');
|
||||
$this->loadModel('project');
|
||||
|
||||
$executions = array();
|
||||
$allChanges = array();
|
||||
@@ -629,11 +630,16 @@ class executionModel extends model
|
||||
if($projectModel == 'scrum' and empty($executionCode))
|
||||
{
|
||||
dao::$errors['code'][] = 'execution#' . $executionID . sprintf($this->lang->error->notempty, $this->lang->project->code);
|
||||
return false;
|
||||
}
|
||||
elseif(!empty($executionCode))
|
||||
{
|
||||
/* Check unique code for edited executions. */
|
||||
if(isset($codeList[$executionCode])) dao::$errors['code'][] = 'execution#' . $executionID . sprintf($this->lang->error->unique, $this->lang->project->code, $executionCode);
|
||||
if(isset($codeList[$executionCode]))
|
||||
{
|
||||
dao::$errors['code'][] = 'execution#' . $executionID . sprintf($this->lang->error->unique, $this->lang->project->code, $executionCode);
|
||||
return false;
|
||||
}
|
||||
$codeList[$executionCode] = $executionCode;
|
||||
}
|
||||
|
||||
@@ -644,29 +650,44 @@ class executionModel extends model
|
||||
|
||||
$executions[$executionID]->{$extendField->field} = htmlSpecialString($executions[$executionID]->{$extendField->field});
|
||||
$message = $this->checkFlowRule($extendField, $executions[$executionID]->{$extendField->field});
|
||||
if($message) return print(js::alert($message));
|
||||
|
||||
if($message)
|
||||
{
|
||||
dao::$errors['message'][] = $message;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(dao::isError()) return print(js::error(dao::getError()));
|
||||
|
||||
foreach($executions as $executionID => $execution)
|
||||
{
|
||||
$oldExecution = $oldExecutions[$executionID];
|
||||
$team = $this->loadModel('user')->getTeamMemberPairs($executionID, 'execution');
|
||||
$projectID = isset($execution->project) ? $execution->project : $oldExecution->project;
|
||||
$project = $this->project->getByID($projectID);
|
||||
|
||||
if($execution->begin < $project->begin)
|
||||
{
|
||||
dao::$errors['begin'] = sprintf($this->lang->execution->errorLetterProject, $project->begin);
|
||||
return false;
|
||||
}
|
||||
if($execution->end > $project->end)
|
||||
{
|
||||
dao::$errors['end'] = sprintf($this->lang->execution->errorGreaterProject, $project->end);
|
||||
return false;
|
||||
}
|
||||
|
||||
$this->dao->update(TABLE_EXECUTION)->data($execution)
|
||||
->autoCheck($skipFields = 'begin,end')
|
||||
->batchcheck($this->config->execution->edit->requiredFields, 'notempty')
|
||||
->checkIF($execution->begin != '', 'begin', 'date')
|
||||
->checkIF($execution->end != '', 'end', 'date')
|
||||
->checkIF($execution->end != '', 'end', 'gt', $execution->begin)
|
||||
->checkIF($execution->end != '', 'end', 'ge', $execution->begin)
|
||||
->checkIF((!empty($execution->name) and $this->config->systemMode == 'new'), 'name', 'unique', "id != $executionID and type in ('sprint','stage') and `project` = $projectID")
|
||||
->checkIF(!empty($execution->code), 'code', 'unique', "id != $executionID and type in ('sprint','stage')")
|
||||
->where('id')->eq($executionID)
|
||||
->limit(1)
|
||||
->exec();
|
||||
if(dao::isError()) return print(js::error('execution#' . $executionID . dao::getError(true)));
|
||||
|
||||
if(!empty($execution->project) and $oldExecution->project != $execution->project)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user