diff --git a/module/project/control.php b/module/project/control.php index c2d01dc119..c274eb6ae7 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -207,6 +207,14 @@ class project extends control $this->config->project->search['params']['module']['values'] = $this->tree->getTaskOptionMenu($projectID, $startModuleID = 0); $this->search->setSearchParams($this->config->project->search); + /* team member paors. */ + $memberPairs = array(); + $memberPairs[] = ""; + foreach($this->view->teamMembers as $key => $member) + { + $memberPairs[$key] = $member->realname; + } + /* Assign. */ $this->view->tasks = $tasks; $this->view->summary = $this->project->summary($tasks); @@ -225,6 +233,7 @@ class project extends control $this->view->moduleID = $moduleID; $this->view->moduleTree = $this->tree->getTaskTreeMenu($projectID, $productID = 0, $startModuleID = 0, array('treeModel', 'createTaskLink')); $this->view->projectTree = $this->project->tree(); + $this->view->memberPairs = $memberPairs; $this->display(); } @@ -1513,12 +1522,14 @@ class project extends control */ public function batchUnlinkStory($projectID) { - foreach($this->post->storyIDList as $storyID) + if(isset($_POST['storyIDList'])) { - $this->project->unlinkStory($projectID, $storyID); + foreach($this->post->storyIDList as $storyID) + { + $this->project->unlinkStory($projectID, $storyID); + } } - echo js::locate($this->createLink('project', 'story', "projectID=$projectID")); - exit; + die(js::locate($this->createLink('project', 'story', "projectID=$projectID"))); } /** diff --git a/module/project/view/task.html.php b/module/project/view/task.html.php index 6398d7bc8c..c30801db8a 100644 --- a/module/project/view/task.html.php +++ b/module/project/view/task.html.php @@ -140,8 +140,9 @@
" . html::selectButton() . '
'; @@ -157,6 +158,16 @@ $misc = $canBatchClose ? "onclick=\"setFormAction('$actionLink','hiddenwin')\"" : "class='disabled'"; echo "
  • " . html::a('#', $lang->close, '', $misc) . "
  • "; echo ""; + + if($canBatchAssignTo) + { + $actionLink = $this->createLink('task', 'batchAssignTo', "projectID=$projectID"); + echo "
    "; + echo html::select('assignedTo', $memberPairs, '', 'class="form-control chosen"'); + echo ""; + echo html::a("javascript:setFormAction(\"$actionLink\")", $lang->task->assign); + echo '
    '; + } } echo "
    " . $summary . "
    "; ?> diff --git a/module/task/control.php b/module/task/control.php index cc1d7be4fd..6b9e47c7a1 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -394,6 +394,32 @@ class task extends control $this->display(); } + /** + * Batch update assign of task. + * + * @param int $project + * @access public + * @return void + */ + public function batchAssignTo($project) + { + if(!empty($_POST)) + { + $taskIDList = $this->post->taskIDList; + unset($_POST['taskIDList']); + foreach($taskIDList as $taskID) + { + $this->loadModel('action'); + $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); + $this->action->logHistory($actionID, $changes); + $this->sendmail($taskID, $actionID); + } + die(js::locate($this->createLink('project', 'task', "projectID=$project"), 'parent')); + } + } + /** * View a task. *