* [bug#61445,done,2h,0h] Gantt charts can link task when assigned to groups.
This commit is contained in:
@@ -429,9 +429,9 @@ function initGantt()
|
||||
gantt.config.details_on_dblclick = false;
|
||||
gantt.config.order_branch = false;
|
||||
gantt.config.drag_progress = false;
|
||||
gantt.config.drag_links = ganttType == 'assignedTo' ? false : true;
|
||||
gantt.config.drag_move = ganttType == 'assignedTo' ? false : true;
|
||||
gantt.config.drag_resize = ganttType == 'assignedTo' ? false : true;
|
||||
gantt.config.drag_links = true;
|
||||
gantt.config.drag_move = true;
|
||||
gantt.config.drag_resize = true;
|
||||
gantt.config.smart_rendering = true;
|
||||
gantt.config.smart_scales = true;
|
||||
gantt.config.static_background = true;
|
||||
@@ -638,7 +638,7 @@ function initGantt()
|
||||
}
|
||||
|
||||
/* The id of task item is like executionID-taskID. e.g. 1507-37829, 37829 is task id. */
|
||||
let taskID = ganttType == 'assignedTo' ? id : 0;
|
||||
let taskID = 0;
|
||||
let position = id.indexOf('-');
|
||||
if(position > 0) taskID = parseInt(id.substring(position + 1));
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ class programplanModel extends model
|
||||
$datas = $this->programplanTao->setStageSummary($datas, $stageIndex);
|
||||
|
||||
/* Set relation task data. */
|
||||
$datas['links'] = $this->programplanTao->buildGanttLinks($projectID);
|
||||
$datas['links'] = $this->programplanTao->buildGanttLinks($projectID, $datas['data']);
|
||||
$datas['data'] = isset($datas['data']) ? array_values($datas['data']) : array();
|
||||
return $returnJson ? json_encode($datas) : $datas;
|
||||
}
|
||||
@@ -217,8 +217,8 @@ class programplanModel extends model
|
||||
$groupID = 0;
|
||||
foreach($tasksGroup as $group => $tasks)
|
||||
{
|
||||
$groupID --;
|
||||
$groupKey = $groupID . $group;
|
||||
$groupID ++;
|
||||
$groupKey = $groupID . $group;
|
||||
$datas['data'][$groupKey] = $this->programplanTao->buildGroupDataForGantt($groupID, $group, $users);
|
||||
|
||||
$realStartDate = array();
|
||||
@@ -227,7 +227,13 @@ class programplanModel extends model
|
||||
foreach($tasks as $taskID => $task)
|
||||
{
|
||||
$dateLimit = $this->programplanTao->getTaskDateLimit($task, zget($plans, $task->execution, null));
|
||||
if(strpos($selectCustom, 'task') !== false) $datas['data'][$task->id] = $this->programplanTao->buildTaskDataForGantt($task, $dateLimit, $groupID, $tasks);
|
||||
if(strpos($selectCustom, 'task') !== false)
|
||||
{
|
||||
$data = $this->programplanTao->buildTaskDataForGantt($task, $dateLimit, $groupID, $tasks);
|
||||
$data->id = $groupID . '-' . $task->id;
|
||||
$data->parent = $task->parent > 0 && isset($tasks[$task->parent]) ? $groupID . '-' . $task->parent : $groupID;
|
||||
$datas['data'][$task->id] = $data;
|
||||
}
|
||||
|
||||
if(!empty($dateLimit['start'])) $realStartDate[] = strtotime($dateLimit['start']);
|
||||
if(!empty($dateLimit['end'])) $realEndDate[] = strtotime($dateLimit['end']);
|
||||
@@ -246,7 +252,7 @@ class programplanModel extends model
|
||||
}
|
||||
|
||||
$datas = $this->programplanTao->setStageSummary($datas, $stageIndex);
|
||||
$datas['links'] = $this->programplanTao->buildGanttLinks($executionID);
|
||||
$datas['links'] = $this->programplanTao->buildGanttLinks($executionID, $datas['data']);
|
||||
$datas['data'] = isset($datas['data']) ? array_values($datas['data']) : array();
|
||||
return $returnJson ? json_encode($datas) : $datas;
|
||||
}
|
||||
|
||||
@@ -817,23 +817,23 @@ class programplanTao extends programplanModel
|
||||
* Build gantt links.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param array $tasks
|
||||
* @access protected
|
||||
* @return array
|
||||
*/
|
||||
protected function buildGanttLinks(int $projectID): array
|
||||
protected function buildGanttLinks(int $projectID, array $tasks = array()): array
|
||||
{
|
||||
$this->app->loadConfig('execution');
|
||||
if($this->config->edition == 'open') return array();
|
||||
|
||||
$links = array();
|
||||
$relations = $this->dao->select('*')->from(TABLE_RELATIONOFTASKS)->where('project')->eq($projectID)->orderBy('task,pretask')->fetchAll();
|
||||
$tasks = $this->loadModel('task')->getProjectTaskList($projectID);
|
||||
foreach($relations as $relation)
|
||||
{
|
||||
$link = array();
|
||||
$link['id'] = $relation->id;
|
||||
$link['source'] = $tasks[$relation->pretask]->execution . '-' . $relation->pretask;
|
||||
$link['target'] = $tasks[$relation->task]->execution . '-' . $relation->task;
|
||||
$link['source'] = !empty($tasks[$relation->pretask]->id) ? $tasks[$relation->pretask]->id : $relation->pretask;
|
||||
$link['target'] = !empty($tasks[$relation->task]->id) ? $tasks[$relation->task]->id : $relation->task;
|
||||
$link['type'] = $this->config->execution->gantt->linkType[$relation->condition][$relation->action];
|
||||
$links[] = $link;
|
||||
}
|
||||
|
||||
@@ -56,9 +56,9 @@ r($tester->programplan->buildGanttLinks($planIdList)) && p() && e("0"); //禅道
|
||||
|
||||
$tester->programplan->config->edition = 'max';
|
||||
$links = $tester->programplan->buildGanttLinks($planIdList);
|
||||
r($links[0]) && p('source,target,type') && e('1-1,1-2,0'); //检查第一条任务关系
|
||||
r($links[1]) && p('source,target,type') && e('2-2,2-3,2'); //检查第二条任务关系
|
||||
r($links[2]) && p('source,target,type') && e('3-3,3-4,1'); //检查第三条任务关系
|
||||
r($links[3]) && p('source,target,type') && e('1-11,1-12,1'); //检查第四条任务关系
|
||||
r($links[4]) && p('source,target,type') && e('2-12,2-13,3'); //检查第五条任务关系
|
||||
r($links[5]) && p('source,target,type') && e('3-13,3-14,0'); //检查第六条任务关系
|
||||
r($links[0]) && p('source,target,type') && e('1,2,0'); //检查第一条任务关系
|
||||
r($links[1]) && p('source,target,type') && e('2,3,2'); //检查第二条任务关系
|
||||
r($links[2]) && p('source,target,type') && e('3,4,1'); //检查第三条任务关系
|
||||
r($links[3]) && p('source,target,type') && e('11,12,1'); //检查第四条任务关系
|
||||
r($links[4]) && p('source,target,type') && e('12,13,3'); //检查第五条任务关系
|
||||
r($links[5]) && p('source,target,type') && e('13,14,0'); //检查第六条任务关系
|
||||
|
||||
Reference in New Issue
Block a user