diff --git a/module/programplan/model.php b/module/programplan/model.php index 7d8772b0d8..1718b6022a 100755 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -217,8 +217,9 @@ class programplanModel extends model if(empty($selectCustom)) $selectCustom = $this->loadModel('setting')->getItem("owner={$owner}&module={$module}§ion={$section}&key={$object}"); - $tasks = array(); - $tasks = $this->dao->select('*')->from(TABLE_TASK)->where('deleted')->eq(0)->andWhere('execution')->in($planIdList)->fetchAll('id'); + $tasks = $this->dao->select('*')->from(TABLE_TASK)->where('deleted')->eq(0)->andWhere('execution')->in($planIdList)->fetchAll('id'); + $taskTeams = $this->dao->select('root,account')->from(TABLE_TEAM)->where('type')->eq('task')->andWhere('root')->in(array_keys($tasks))->fetchGroup('root', 'account'); + $users = $this->loadModel('user')->getPairs('noletter'); if($baselineID) { @@ -272,6 +273,15 @@ class programplanModel extends model $data->endDate = $end; $data->duration = 0; + /* If multi task then show the teams. */ + if($task->mode == 'multi' and !empty($taskTeams[$task->id])) + { + $teams = array_keys($taskTeams[$task->id]); + $assigneds = array(); + foreach($teams as $assignedTo) $assigneds[] = zget($users, $assignedTo); + $data->owner_id = join(',', $assigneds); + } + if($data->endDate > $data->start_date) $data->duration = helper::diffDate($data->endDate, $data->start_date) + 1; if($data->start_date) $data->start_date = date('d-m-Y', strtotime($data->start_date)); if($data->start_date == '' or $data->endDate == '') $data->duration = 0;