* [refac bug #62083] Sync code to 21.7 branch from feature/deliverable.

This commit is contained in:
wangyidong
2025-05-16 16:44:58 +08:00
committed by 刘刚
parent 250001a017
commit 4ccab2ff58
3 changed files with 13 additions and 4 deletions
+1 -1
View File
@@ -633,7 +633,7 @@ class programplanModel extends model
/** Get the number of sub-stage associated start tasks and the number of sub-stages under the state. */
$statusCount = array();
$children = $this->execution->getChildExecutions($parent->id);
$allChildren = $this->dao->select('id')->from(TABLE_EXECUTION)->where('deleted')->eq(0)->andWhere('path')->like("{$parent->path}%")->fetchPairs();
$allChildren = $this->dao->select('id')->from(TABLE_EXECUTION)->where('deleted')->eq(0)->andWhere('path')->like("{$parent->path}%")->andWhere('id')->ne($id)->fetchPairs();
$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 $childExecution)
{
+11 -2
View File
@@ -276,10 +276,12 @@ class programplanTao extends programplanModel
$taskTeams = $this->dao->select('task,account')->from(TABLE_TASKTEAM)->where('task')->in(array_keys($tasks))->fetchGroup('task', 'account');
$users = $this->loadModel('user')->getPairs('noletter');
$firstTask = reset($tasks);
$taskDateLimit = $this->dao->select('taskDateLimit')->from(TABLE_PROJECT)->where('id')->eq($firstTask->project)->fetch('taskDateLimit');
foreach($tasks as $task)
{
$plan = zget($plans, $task->execution, null);
$dateLimit = $this->getTaskDateLimit($task, $plan);
$dateLimit = $this->getTaskDateLimit($task, $plan, $taskDateLimit == 'limit' ? zget($tasks, $task->parent, null) : null);
$data = $this->buildTaskDataForGantt($task, $dateLimit);
$data->id = $task->execution . '-' . $task->id;
$data->parent = $task->parent > 0 && isset($tasks[$task->parent]) ? $task->execution . '-' . $task->parent : $task->execution;
@@ -872,16 +874,23 @@ class programplanTao extends programplanModel
*
* @param object $task
* @param object|null $execution
* @param object|null $parent
* @access protected
* @return array
*/
protected function getTaskDateLimit(object $task, object|null $execution = null): array
protected function getTaskDateLimit(object $task, object|null $execution = null, object|null $parent = null): array
{
$estStart = helper::isZeroDate($task->estStarted) ? '' : $task->estStarted;
$estEnd = helper::isZeroDate($task->deadline) ? '' : $task->deadline;
$realBegan = helper::isZeroDate($task->realStarted) ? '' : $task->realStarted;
$realEnd = (in_array($task->status, array('done', 'closed')) and !helper::isZeroDate($task->finishedDate)) ? $task->finishedDate : '';
if($parent)
{
if(empty($estStart) && !helper::isZeroDate($parent->estStarted)) $estStart = $parent->estStarted;
if(empty($estEnd) && !helper::isZeroDate($parent->deadline)) $estEnd = $parent->deadline;
}
$start = $estStart;
$end = $estEnd;
if(empty($start) and $execution) $start = $execution->begin;
+1 -1
View File
@@ -433,7 +433,7 @@ class programplanZen extends programplan
/* Get data for gantt. */
$stages = array();
if($type == 'gantt' ) $stages = $this->programplan->getDataForGantt($projectID, $productID, $baselineID, $selectCustom, false, $browseType, $queryID);
if($type == 'gantt') $stages = $this->programplan->getDataForGantt($projectID, $productID, $baselineID, $selectCustom, false, $browseType, $queryID);
if($type == 'assignedTo') $stages = $this->programplan->getDataForGanttGroupByAssignedTo($projectID, $productID, $baselineID, $selectCustom, false, $browseType, $queryID);
return $stages;