diff --git a/module/project/view/tasklist.html.php b/module/project/view/tasklist.html.php index 7bc0d52fee..a20ae55108 100644 --- a/module/project/view/tasklist.html.php +++ b/module/project/view/tasklist.html.php @@ -112,7 +112,7 @@ if($canBatchEdit) { - $actionLink = $this->createLink('task', 'batchEdit', "projectID=$projectID&from=projectTask&orderBy=$orderBy"); + $actionLink = $this->createLink('task', 'batchEdit', "projectID=$projectID&orderBy=$orderBy"); echo html::commonButton($lang->edit, "onclick=\"changeAction('projectTaskForm', 'batchEdit', '$actionLink')\""); } if($canBatchClose) diff --git a/module/task/control.php b/module/task/control.php index e87ae07d43..658880cf75 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -261,59 +261,13 @@ class task extends control * Batch edit task. * * @param int $projectID - * @param string $from example:projectTask, taskBatchEdit * @param string $orderBy * @access public * @return void */ - public function batchEdit($projectID = 0, $from = '', $orderBy = '') + public function batchEdit($projectID = 0, $orderBy = '') { - /* Get form data for project-task. */ - if($from == 'projectTask') - { - /* Initialize vars. */ - $orderBy = str_replace('status', 'statusCustom', $this->cookie->projectTaskOrder); - if(!$orderBy) $orderBy = 'statusCustom,id_desc'; - $project = $this->project->getById($projectID); - $taskIDList = $this->post->taskIDList ? $this->post->taskIDList : array(); - $editedTasks = array(); - $columns = 13; - $showSuhosinInfo = false; - - /* Set project menu. */ - $this->project->setMenu($this->project->getPairs(), $project->id); - - /* Get all tasks. */ - $allTasks = $this->dao->select('*')->from(TABLE_TASK)->alias('t1')->where($this->session->taskQueryCondition)->orderBy($orderBy)->fetchAll('id'); - if(!$allTasks) $allTasks = array(); - - /* Initialize the tasks whose need to edited. */ - foreach($allTasks as $task) if(in_array($task->id, $taskIDList)) $editedTasks[$task->id] = $task; - - /* Judge whether the editedTasks is too large. */ - $showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting(count($editedTasks), $columns); - - /* Set the sessions. */ - $this->app->session->set('showSuhosinInfo', $showSuhosinInfo); - - /* Assign. */ - $this->view->title = $project->name . $this->lang->colon . $this->lang->task->batchEdit; - $this->view->position[] = $this->lang->task->common; - $this->view->position[] = $this->lang->task->batchEdit; - - $members = $this->project->getTeamMemberPairs($projectID, 'nodeleted'); - $members = $members + array('closed' => 'Closed'); - - if($showSuhosinInfo) $this->view->suhosinInfo = $this->lang->suhosinInfo; - $this->view->project = $project; - $this->view->modules = $this->tree->getOptionMenu($projectID, $viewType = 'task'); - $this->view->editedTasks = $editedTasks; - $this->view->members = $members; - - $this->display(); - } - /* Get form data for task-batchEdit. */ - elseif($from == 'taskBatchEdit') + if($this->post->names) { $allChanges = $this->task->batchUpdate(); @@ -345,6 +299,45 @@ class task extends control } die(js::locate($this->session->taskList, 'parent')); } + + $taskIDList = $this->post->taskIDList ? $this->post->taskIDList : die(js::locate($this->session->taskList, 'parent')); + + /* Initialize vars. */ + $orderBy = str_replace('status', 'statusCustom', $this->cookie->projectTaskOrder); + if(!$orderBy) $orderBy = 'statusCustom,id_desc'; + $project = $this->project->getById($projectID); + $tasks = array(); + $columns = 13; + $showSuhosinInfo = false; + + /* Set project menu. */ + $this->project->setMenu($this->project->getPairs(), $project->id); + + /* Get all tasks. */ + $tasks = $this->dao->select('*')->from(TABLE_TASK)->where('id')->in($taskIDList)->fetchAll('id'); + + /* Judge whether the editedTasks is too large. */ + $showSuhosinInfo = $this->loadModel('common')->judgeSuhosinSetting(count($tasks), $columns); + + /* Set the sessions. */ + $this->app->session->set('showSuhosinInfo', $showSuhosinInfo); + + /* Assign. */ + $this->view->title = $project->name . $this->lang->colon . $this->lang->task->batchEdit; + $this->view->position[] = $this->lang->task->common; + $this->view->position[] = $this->lang->task->batchEdit; + + $members = $this->project->getTeamMemberPairs($projectID, 'nodeleted'); + $members = $members + array('closed' => 'Closed'); + + if($showSuhosinInfo) $this->view->suhosinInfo = $this->lang->suhosinInfo; + $this->view->project = $project; + $this->view->modules = $this->tree->getOptionMenu($projectID, $viewType = 'task'); + $this->view->taskIDList = $taskIDList; + $this->view->tasks = $tasks; + $this->view->members = $members; + + $this->display(); } /** diff --git a/module/task/view/batchedit.html.php b/module/task/view/batchedit.html.php index 45817ac6e2..73e52124be 100755 --- a/module/task/view/batchedit.html.php +++ b/module/task/view/batchedit.html.php @@ -11,7 +11,7 @@ */ ?> -
id}&from=taskBatchEdit")?>"> +id}")?>"> @@ -30,22 +30,22 @@ - + - - - type != 'sprint') echo "";?> - - - - - - - - - - - + + + type != 'sprint') echo "";?> + + + + + + + + + + +
task->common . $lang->colon . $lang->task->batchEdit;?>
task->closedBy;?> task->closedReason;?>
id . html::hidden("taskIDList[$task->id]", $task->id);?>id]", $task->name, 'class=text-1');?>" . html::select("modules[$task->id]", $modules, $task->module, 'class=select-1') . "id]", $members, $task->assignedTo, 'class=select-1');?>id]", $lang->task->typeList, $task->type, 'class=select-1');?>id]", $lang->task->statusList, $task->status, 'class=select-1');?>id]", (array)$lang->task->priList, $task->pri, 'class=select-1');?>id]", $task->estimate, "class='text-1 a-center'");?>consumed, "class='text-1 a-center' disabled");?>id]", '', "class='text-1 a-center'");?>id]", $task->left, "class='text-1 a-center'");?>id]", $members, $task->finishedBy, 'class=select-1');?>id]", $members, $task->closedBy, 'class=select-1');?>id]", $lang->task->reasonList, $task->closedReason, 'class=select-1');?>name, 'class=text-1');?>" . html::select("modules[$taskID]", $modules, $tasks[$taskID]->module, 'class=select-1') . "assignedTo, 'class=select-1');?>task->typeList, $tasks[$taskID]->type, 'class=select-1');?>task->statusList, $tasks[$taskID]->status, 'class=select-1');?>task->priList, $tasks[$taskID]->pri, 'class=select-1');?>estimate, "class='text-1 a-center'");?>consumed, "class='text-1 a-center' disabled");?>left, "class='text-1 a-center'");?>finishedBy, 'class=select-1');?>closedBy, 'class=select-1');?>task->reasonList, $tasks[$taskID]->closedReason, 'class=select-1');?>