diff --git a/module/task/control.php b/module/task/control.php index d76f89ebac..c10819bf31 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -43,7 +43,7 @@ class task extends control * @access public * @return void */ - public function create($projectID = 0, $storyID = '', $moduleID = 0, $taskID = 0, $todoID = 0) + public function create($projectID = 0, $storyID = 0, $moduleID = 0, $taskID = 0, $todoID = 0) { $this->project->getLimitedProject(); $limitedProjects = !empty($_SESSION['limitedProjects']) ? $_SESSION['limitedProjects'] : ''; @@ -460,7 +460,7 @@ class task extends control /* Get edited tasks. */ $tasks = $this->dao->select('*')->from(TABLE_TASK)->where('id')->in($taskIDList)->fetchAll('id'); - $teams = $this->dao->select('*')->from(TABLE_TEAM)->where('root')->in($taskIDList)->andWhere('type')->eq('task')->fetchAll('root'); + $teams = $this->dao->select('*')->from(TABLE_TEAM)->where('root')->in($taskIDList)->andWhere('type')->eq('task')->fetchGroup('root', 'account'); /* Judge whether the editedTasks is too large and set session. */ $countInputVars = count($tasks) * (count(explode(',', $this->config->task->custom->batchEditFields)) + 3); @@ -572,19 +572,19 @@ class task extends control { if(!empty($_POST)) { + $this->loadModel('action'); $taskIDList = $this->post->taskIDList; $taskIDList = array_unique($taskIDList); unset($_POST['taskIDList']); if(!is_array($taskIDList)) die(js::locate($this->createLink('project', 'task', "projectID=$project"), 'parent')); $taskIDList = array_unique($taskIDList); - $muletipleTasks = $this->dao->select('root')->from(TABLE_TEAM)->where('type')->eq('task')->andWhere('root')->in($taskIDList)->fetchPairs(); + $muletipleTasks = $this->dao->select('root , account')->from(TABLE_TEAM)->where('type')->eq('task')->andWhere('root')->in($taskIDList)->fetchGroup('root', 'account'); $tasks = $this->task->getByList($taskIDList); foreach($tasks as $taskID => $task) { - $this->loadModel('action'); - if(in_array($taskID, $muletipleTasks) and $task->assignedTo != $this->app->user->account) continue; - + if(isset($muletipleTasks[$taskID]) and $task->assignedTo != $this->app->user->account) continue; + if(isset($muletipleTasks[$taskID]) and !isset($muletipleTasks[$taskID][$this->post->assignedTo])) continue; $changes = $this->task->assign($taskID); if(dao::isError()) die(js::error(dao::getError())); $actionID = $this->action->create('task', $taskID, 'Assigned', $this->post->comment, $this->post->assignedTo); diff --git a/module/task/view/create.html.php b/module/task/view/create.html.php index fede9e1420..c9665e8bb3 100644 --- a/module/task/view/create.html.php +++ b/module/task/view/create.html.php @@ -163,7 +163,11 @@ } $priList = $lang->task->priList; if(end($priList)) unset($priList[0]); - if(!isset($priList[$task->pri])) $task->pri = reset($priList); + if(!isset($priList[$task->pri])) + { + reset($priList); + $task->pri = key($priList); + } ?> pri, "class='form-control'");?> diff --git a/module/task/view/edit.html.php b/module/task/view/edit.html.php index b01134b9fc..bd1c2240b4 100644 --- a/module/task/view/edit.html.php +++ b/module/task/view/edit.html.php @@ -122,7 +122,8 @@ task->assignedTo;?> team) and $task->assignedTo != $this->app->user->account) ? "disabled='disabled'" :'';?> - assignedTo, "class='form-control chosen' {$disableAssignedTo}");?> + team) ? array_intersect_key($members, $task->team) : $members;?> + assignedTo, "class='form-control chosen' {$disableAssignedTo}");?> ' id='teamTr'> task->team;?>