Merge branch 'fixbug_liumengyi_32423' into 'master'

* Fix bug  32423 32540 32157.

See merge request easycorp/zentaopms!7110
This commit is contained in:
孙广明
2023-03-01 07:49:18 +00:00
9 changed files with 35 additions and 20 deletions
-1
View File
@@ -36,7 +36,6 @@
</td>
<td><?php if($disabled) echo $lang->build->notice->changeProduct;?></td>
</tr>
<tr>
<tr class='<?php if((!empty($product) and $product->type == 'normal') or empty($product) or empty($build->execution)) echo 'hidden'?>'>
<?php
if(empty($product)) $product = new stdclass();
+1 -7
View File
@@ -115,14 +115,8 @@ $(function()
$('[data-toggle="popover"]').popover();
if(isStage)
if(isWaterfall)
{
$('#attribute').change(function()
{
var attribute = $(this).val();
hidePlanBox(attribute);
})
hidePlanBox(executionAttr);
}
})
+10 -2
View File
@@ -613,7 +613,7 @@ class executionModel extends model
if(in_array($execution->status, array('closed', 'suspended'))) $this->computeBurn($executionID);
if(empty($execution->project) or $execution->project == $oldExecution->project) $this->checkBeginAndEndDate($oldExecution->project, $execution->begin, $execution->end);
if(empty($execution->project) or $execution->project == $oldExecution->project) $this->checkBeginAndEndDate($oldExecution->project, $execution->begin, $execution->end, $execution);
if(dao::isError()) return false;
/* Child stage inherits parent stage permissions. */
@@ -1506,16 +1506,24 @@ class executionModel extends model
* @param int $projectID
* @param string $begin
* @param string $end
* @param object $execution
* @access public
* @return void
*/
public function checkBeginAndEndDate($projectID, $begin, $end)
public function checkBeginAndEndDate($projectID, $begin, $end, $execution = null)
{
$project = $this->loadModel('project')->getByID($projectID);
if(empty($project)) return;
if($begin < $project->begin) dao::$errors['begin'] = sprintf($this->lang->execution->errorCommonBegin, $project->begin);
if($end > $project->end) dao::$errors['end'] = sprintf($this->lang->execution->errorCommonEnd, $project->end);
if(($project->model == 'waterfall' or $project->model == 'waterfallplus') and isset($execution) and $execution->parent != $projectID)
{
$this->app->loadLang('programplan');
$parent = $this->getByID($execution->parent);
if($begin < $parent->begin) dao::$errors['begin'] = sprintf($this->lang->programplan->error->letterParent, $parent->begin);
if($end > $parent->end) dao::$errors['end'] = sprintf($this->lang->programplan->error->greaterParent, $parent->end);
}
}
/*
+1 -1
View File
@@ -14,7 +14,7 @@
<?php include '../../common/view/datepicker.html.php';?>
<?php include '../../common/view/kindeditor.html.php';?>
<?php js::import($jsRoot . 'misc/date.js');?>
<?php js::set('isStage', $execution->type == 'stage');?>
<?php js::set('isWaterfall', (isset($project) and ($project->model == 'waterfall' or $project->model == 'waterfallplus')));?>
<?php js::set('executionAttr', $execution->attribute);?>
<?php js::set('manageProductsLang', $lang->project->manageProducts);?>
<?php js::set('manageProductPlanLang', $lang->project->manageProductPlan);?>
+2 -1
View File
@@ -115,7 +115,8 @@ $lang->programplan->error->planFinishSmall = 'The "End" date must be > the "Begi
$lang->programplan->error->percentOver = 'The sum of "Workload %" cannot exceed 100% of one stage.';
$lang->programplan->error->createdTask = 'The task has been decomposed. Sub phases cannot be added.';
$lang->programplan->error->parentWorkload = 'The sum of the workload of the child phase cannot be greater than that of the parent phase: %s.';
$lang->programplan->error->parentDuration = 'The planned start and planned completion of the child phase cannot exceed the parent phase.';
$lang->programplan->error->letterParent = "The planned start of the child stage cannot be less than the begin of parent stage: %s.";
$lang->programplan->error->greaterParent = "The planned end of the child stage cannot be greater the end of parent stage: %s";
$lang->programplan->error->sameName = 'Stage name cannot be the same!';
$lang->programplan->error->sameCode = 'Stage code cannot be the same!';
$lang->programplan->error->taskDrag = 'The %s task cannot be dragged';
+2 -1
View File
@@ -115,7 +115,8 @@ $lang->programplan->error->planFinishSmall = 'The "End" date must be > the "Begi
$lang->programplan->error->percentOver = 'The sum of "Workload %" cannot exceed 100% of one stage.';
$lang->programplan->error->createdTask = 'The task is decomposed. Sub stages cannot be added.';
$lang->programplan->error->parentWorkload = 'The sum of the workload in the sub stage cannot be > that in the parent stage: %s.';
$lang->programplan->error->parentDuration = 'The planned start and planned completion of the child phase cannot exceed the parent phase.';
$lang->programplan->error->letterParent = "The planned start of the child stage cannot be less than the begin of parent stage: %s.";
$lang->programplan->error->greaterParent = "The planned end of the child stage cannot be greater the end of parent stage: %s";
$lang->programplan->error->sameName = 'Stage name cannot be the same!';
$lang->programplan->error->sameCode = 'Stage code cannot be the same!';
$lang->programplan->error->taskDrag = 'The %s task cannot be dragged';
+2 -1
View File
@@ -115,7 +115,8 @@ $lang->programplan->error->planFinishSmall = 'The "End" date must be > the "Begi
$lang->programplan->error->percentOver = 'The sum of "Workload %" cannot exceed 100% of one stage.';
$lang->programplan->error->createdTask = 'The task has been decomposed. Sub phases cannot be added.';
$lang->programplan->error->parentWorkload = 'The sum of the workload of the child phase cannot be greater than that of the parent phase: %s.';
$lang->programplan->error->parentDuration = 'The planned start and planned completion of the child phase cannot exceed the parent phase.';
$lang->programplan->error->letterParent = "The planned start of the child stage cannot be less than the begin of parent stage: %s.";
$lang->programplan->error->greaterParent = "The planned end of the child stage cannot be greater the end of parent stage: %s";
$lang->programplan->error->sameName = 'Stage name cannot be the same!';
$lang->programplan->error->sameCode = 'Stage code cannot be the same!';
$lang->programplan->error->taskDrag = 'The %s task cannot be dragged';
+2 -1
View File
@@ -115,7 +115,8 @@ $lang->programplan->error->planFinishSmall = '"计划完成时间"必须大于"
$lang->programplan->error->percentOver = '相同父阶段的子阶段工作量占比之和不超过100%';
$lang->programplan->error->createdTask = '已分解任务,不可添加子阶段';
$lang->programplan->error->parentWorkload = '子阶段的工作量之和不能大于父阶段的工作量:%s';
$lang->programplan->error->parentDuration = '子阶段计划开始、计划完成不能超过父阶段';
$lang->programplan->error->letterParent = "子阶段计划开始不能超过父阶段的计划开始时间 %s";
$lang->programplan->error->greaterParent = "子阶段计划完成不能超过父阶段的计划完成时间 %s";
$lang->programplan->error->sameName = '阶段名称不能相同!';
$lang->programplan->error->sameCode = '阶段代号不能相同!';
$lang->programplan->error->taskDrag = '%s的任务不可以拖动';
+15 -5
View File
@@ -777,10 +777,13 @@ class programplanModel extends model
{
dao::$errors[$index]['end'] = $this->lang->programplan->error->planFinishSmall;
}
if(isset($parentStage) and ($plan->end > $parentStage->end || $plan->begin < $parentStage->begin))
if(isset($parentStage) and $plan->begin < $parentStage->begin)
{
if($plan->begin < $parentStage->begin and empty(dao::$errors[$index]['begin'])) dao::$errors[$index]['begin'] = $this->lang->programplan->error->parentDuration;
if($plan->end > $parentStage->end and empty(dao::$errors[$index]['end'])) dao::$errors[$index]['end'] = $this->lang->programplan->error->parentDuration;
dao::$errors[$index]['begin'] = sprintf($this->lang->programplan->error->letterParent, $parentStage->begin);
}
if(isset($parentStage) and $plan->end > $parentStage->end)
{
dao::$errors[$index]['end'] = sprintf($this->lang->programplan->error->greaterParent, $parentStage->end);
}
if($plan->begin < $project->begin and empty(dao::$errors[$index]['begin']))
{
@@ -1075,9 +1078,14 @@ class programplanModel extends model
if(dao::isError()) return false;
if($plan->parent) $parentStage = $this->getByID($plan->parent);
if(isset($parentStage) and ($plan->end > $parentStage->end || $plan->begin < $parentStage->begin))
if(isset($parentStage) and $plan->begin < $parentStage->begin)
{
dao::$errors['message'][] = $this->lang->programplan->error->parentDuration;
dao::$errors['begin'] = sprintf($this->lang->programplan->error->letterParent, $parentStage->begin);
return false;
}
if(isset($parentStage) and $plan->end > $parentStage->end)
{
dao::$errors['end'] = sprintf($this->lang->programplan->error->greaterParent, $parentStage->end);
return false;
}
@@ -1507,6 +1515,8 @@ class programplanModel extends model
$startTasks = $this->dao->select('count(1) as count')->from(TABLE_TASK)->where('deleted')->eq(0)->andWhere('execution')->in($allChildren)->andWhere('consumed')->ne(0)->fetch('count');
foreach($children as $childID => $childExecution) $statusCount[$childExecution->status] = empty($statusCount[$childExecution->status]) ? 1 : $statusCount[$childExecution->status] ++;
if(empty($statusCount)) continue;
if(isset($statusCount['wait']) and count($statusCount) == 1 and helper::isZeroDate($parent->realBegan) and $startTasks == 0)
{
if($parent->status != 'wait')