diff --git a/module/bug/control.php b/module/bug/control.php index 68fd686a73..efadf99b73 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1940,12 +1940,12 @@ class bug extends control * @access public * @return string */ - public function ajaxGetUserBugs($userID = '', $id = '') + public function ajaxGetUserBugs($userID = '', $id = '' , $appendID = '') { if($userID == '') $userID = $this->app->user->id; $user = $this->loadModel('user')->getById($userID, 'id'); $account = $user->account; - $bugs = $this->bug->getUserBugPairs($account); + $bugs = $this->bug->getUserBugPairs($account, true, '', '', '', $appendID); if($id) return print(html::select("bugs[$id]", $bugs, '', 'class="form-control"')); return print(html::select('bug', $bugs, '', 'class=form-control')); diff --git a/module/bug/model.php b/module/bug/model.php index 75c34e87f2..41794afdba 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1566,7 +1566,7 @@ class bugModel extends model * @access public * @return array */ - public function getUserBugPairs($account, $appendProduct = true, $limit = 0, $skipProductIDList = array(), $skipExecutionIDList = array()) + public function getUserBugPairs($account, $appendProduct = true, $limit = 0, $skipProductIDList = array(), $skipExecutionIDList = array(), $appendBugID = '') { $bugs = array(); $stmt = $this->dao->select('t1.id, t1.title, t2.name as product') @@ -1578,6 +1578,7 @@ class bugModel extends model ->beginIF(!empty($skipProductIDList))->andWhere('t1.product')->notin($skipProductIDList)->fi() ->beginIF(!empty($skipExecutionIDList))->andWhere('t1.execution')->notin($skipExecutionIDList)->fi() ->andWhere('t1.deleted')->eq(0) + ->beginIF(!empty($appendBugID))->orWhere('t1.id')->in($appendBugID)->fi() ->orderBy('id desc') ->beginIF($limit > 0)->limit($limit)->fi() ->query(); diff --git a/module/story/control.php b/module/story/control.php index 712dc61afa..f9ba70237b 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -2563,11 +2563,11 @@ class story extends control * @access public * @return string */ - public function ajaxGetUserStories($userID = '', $id = '') + public function ajaxGetUserStories($userID = '', $id = '', $appendID = '') { if($userID == '') $userID = $this->app->user->id; $user = $this->loadModel('user')->getById($userID, 'id'); - $stories = $this->story->getUserStoryPairs($user->account); + $stories = $this->story->getUserStoryPairs($user->account, 10, 'story', '', $appendID); if($id) return print(html::select("stories[$id]", $stories, '', 'class="form-control"')); echo html::select('story', $stories, '', 'class=form-control'); diff --git a/module/story/model.php b/module/story/model.php index 5bc7690b74..e3005017b4 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -3029,7 +3029,7 @@ class storyModel extends model * @access public * @return array */ - public function getUserStoryPairs($account, $limit = 10, $type = 'story', $skipProductIDList = array()) + public function getUserStoryPairs($account, $limit = 10, $type = 'story', $skipProductIDList = array(), $appendStoryID = '') { return $this->dao->select('id, title') ->from(TABLE_STORY) @@ -3040,6 +3040,7 @@ class storyModel extends model ->andWhere('assignedTo')->eq($account) ->andWhere('product')->ne(0) ->beginIF(!empty($skipProductIDList))->andWhere('product')->notin($skipProductIDList)->fi() + ->beginIF(!empty($appendStoryID))->orWhere('id')->in($appendStoryID)->fi() ->orderBy('id_desc') ->limit($limit) ->fetchPairs('id', 'title'); diff --git a/module/task/control.php b/module/task/control.php index 943641bc5a..b384f1621a 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -1644,17 +1644,17 @@ class task extends control * * @param int $userID * @param string $id - * @param string $status * @access public * @return string */ - public function ajaxGetUserTasks($userID = '', $id = '', $status = 'wait,doing') + public function ajaxGetUserTasks($userID = '', $id = '', $status = '', $appendID = '') { if($userID == '') $userID = $this->app->user->id; $user = $this->loadModel('user')->getById($userID, 'id'); $account = $user->account; - $tasks = $this->task->getUserTaskPairs($account, $status); + $status = empty($status) ? 'wait,doing' : $status; + $tasks = $this->task->getUserTaskPairs($account, $status, '', $appendID); $suspendedTasks = $this->task->getUserSuspendedTasks($account); foreach($tasks as $taskid => $task) { diff --git a/module/task/model.php b/module/task/model.php index e038af079d..12f2b6f488 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -2336,17 +2336,17 @@ class taskModel extends model * @access public * @return array */ - public function getUserTaskPairs($account, $status = 'all', $skipExecutionIDList = array()) + public function getUserTaskPairs($account, $status = 'all', $skipExecutionIDList = array(), $appendTaskID = '') { $stmt = $this->dao->select('t1.id, t1.name, t2.name as execution') ->from(TABLE_TASK)->alias('t1') ->leftjoin(TABLE_PROJECT)->alias('t2')->on('t1.execution = t2.id') ->where('t1.assignedTo')->eq($account) ->andWhere('t1.deleted')->eq(0) - ->andWhere('t1.status')->ne('closed') ->beginIF($this->config->vision)->andWhere('t1.vision')->eq($this->config->vision)->fi() ->beginIF($status != 'all')->andWhere('t1.status')->in($status)->fi() ->beginIF(!empty($skipExecutionIDList))->andWhere('t1.execution')->notin($skipExecutionIDList)->fi() + ->beginIF(!empty($appendTaskID))->orWhere('t1.id')->in($appendTaskID)->fi() ->query(); $tasks = array(); diff --git a/module/testtask/control.php b/module/testtask/control.php index 557624257f..c04c28d0e2 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -1427,13 +1427,14 @@ class testtask extends control * @access public * @return void */ - public function ajaxGetUserTestTasks($userID = '', $id = '', $status = 'all') + public function ajaxGetUserTestTasks($userID = '', $id = '', $status = '', $appendID = '') { if($userID == '') $userID = $this->app->user->id; $user = $this->loadModel('user')->getById($userID, 'id'); $account = $user->account; - $testTasks = $this->testtask->getUserTestTaskPairs($account, 0, $status); + $status = empty($status) ? 'wait,doing' : $status; + $testTasks = $this->testtask->getUserTestTaskPairs($account, 0, $status, '', '', $appendID); if($id) return print(html::select("testtasks[$id]", $testTasks, '', 'class="form-control"')); return print(html::select('testtask', $testTasks, '', 'class="form-control"')); diff --git a/module/testtask/model.php b/module/testtask/model.php index ea4012adf0..51b28b36da 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -1040,17 +1040,17 @@ class testtaskModel extends model * @access public * @return array */ - public function getUserTestTaskPairs($account, $limit = 0, $status = 'all', $skipProductIDList = array(), $skipExecutionIDList = array()) + public function getUserTestTaskPairs($account, $limit = 0, $status = 'all', $skipProductIDList = array(), $skipExecutionIDList = array(), $appendTestTaskID = '') { $stmt = $this->dao->select('t1.id, t1.name, t2.name as execution') ->from(TABLE_TESTTASK)->alias('t1') ->leftjoin(TABLE_EXTENSION)->alias('t2')->on('t1.execution = t2.id') ->where('t1.owner')->eq($account) - ->andWhere('t1.status')->ne('done') ->andWhere('t1.deleted')->eq(0) ->beginIF($status != 'all')->andWhere('t1.status')->in($status)->fi() ->beginIF(!empty($skipProductIDList))->andWhere('t1.product')->notin($skipProductIDList)->fi() ->beginIF(!empty($skipExecutionIDList))->andWhere('t1.execution')->notin($skipExecutionIDList)->fi() + ->beginIF(!empty($appendTestTaskID))->orWhere('t1.id')->in($appendTestTaskID)->fi() ->beginIF($limit)->limit($limit)->fi() ->query(); diff --git a/module/todo/control.php b/module/todo/control.php index 8803f186fd..3022c06dc5 100644 --- a/module/todo/control.php +++ b/module/todo/control.php @@ -196,18 +196,6 @@ class todo extends control $user = $this->loadModel('user')->getById($userID, 'id'); $account = $user->account; - $bugs = $this->bug->getUserBugPairs($account); - $tasks = $this->task->getUserTaskPairs($account, $status); - $storys = $this->loadModel('story')->getUserStoryPairs($account); - if($this->config->edition != 'open') $this->view->feedbacks = $this->loadModel('feedback')->getUserFeedbackPairs($account); - if($this->config->edition == 'max') - { - $issues = $this->loadModel('issue')->getUserIssuePairs($account); - $risks = $this->loadmodel('risk')->getUserRiskPairs($account); - $opportunities = $this->loadmodel('opportunity')->getUserOpportunityPairs($account); - } - $testtasks = $this->loadModel('testtask')->getUserTestTaskPairs($account); - $reviews = array(); if($this->config->edition == 'max') $reviews = $this->loadModel('review')->getUserReviewPairs($account); $allTodos = $this->todo->getList($type, $account, $status); @@ -219,14 +207,30 @@ class todo extends control if(in_array($todo->id, $todoIDList)) { $editedTodos[$todo->id] = $todo; - } + if($todo->type != 'custom') + { + if(!isset($objectIDList[$todo->type])) $objectIDList[$todo->type] = array(); + $objectIDList[$todo->type][$todo->idvalue] = $todo->idvalue; + } + } } + $bugs = $this->bug->getUserBugPairs($account, true, '', '', '', isset($objectIDList['bug']) ? $objectIDList['bug'] : ''); + $tasks = $this->task->getUserTaskPairs($account, 'wait,doing', '', isset($objectIDList['task']) ? $objectIDList['task'] : ''); + $storys = $this->loadModel('story')->getUserStoryPairs($account, 10, 'story', '', isset($objectIDList['story']) ? $objectIDList['story'] : ''); + if($this->config->edition != 'open') $this->view->feedbacks = $this->loadModel('feedback')->getUserFeedbackPairs($account); + if($this->config->edition == 'max') + { + $issues = $this->loadModel('issue')->getUserIssuePairs($account); + $risks = $this->loadmodel('risk')->getUserRiskPairs($account); + $opportunities = $this->loadmodel('opportunity')->getUserOpportunityPairs($account); + } + $testtasks = $this->loadModel('testtask')->getUserTestTaskPairs($account, '', '', '', '', isset($objectIDList['testtask']) ? $objectIDList['testtask'] : ''); + /* Judge whether the edited todos is too large. */ $countInputVars = count($editedTodos) * $columns; $showSuhosinInfo = common::judgeSuhosinSetting($countInputVars); - unset($this->lang->todo->typeList['cycle']); /* Set Custom*/ foreach(explode(',', $this->config->todo->list->customBatchEditFields) as $field) $customFields[$field] = $this->lang->todo->$field; diff --git a/module/todo/js/common.js b/module/todo/js/common.js index dd873085d9..92719b2de8 100644 --- a/module/todo/js/common.js +++ b/module/todo/js/common.js @@ -10,7 +10,7 @@ function switchDateTodo(switcher) } } -function loadList(type, id) +function loadList(type, id, defaultType, idvalue) { if(id) { @@ -23,8 +23,10 @@ function loadList(type, id) divID = '#nameBox'; } - var param = 'userID=' + userID; - if(id) param += '&id=' + id; + var param = 'userID=' + userID + '&id=' + id; + if(type == "task" || type == "testtask") param += '&status='; + if(type == defaultType && idvalue != 0) param += '&idvalue=' + idvalue; + if(moduleList.indexOf(type) !== -1) { link = createLink(type, objectsMethod[type], param); diff --git a/module/todo/js/edit.js b/module/todo/js/edit.js index 33569d40b3..e83c70fa19 100644 --- a/module/todo/js/edit.js +++ b/module/todo/js/edit.js @@ -1,6 +1,6 @@ $(function() { - loadList($('#type').val()); + loadList($('#type').val(), '', defaultType, idvalue); $('#pri').on('change', function() { diff --git a/module/todo/view/batchedit.html.php b/module/todo/view/batchedit.html.php index 4f469e9b4f..321df5cfd2 100644 --- a/module/todo/view/batchedit.html.php +++ b/module/todo/view/batchedit.html.php @@ -60,7 +60,7 @@ } else { - echo html::select("types[$todo->id]", $lang->todo->typeList, $todo->type, "onchange='loadList(this.value, " . $todo->id . ")' class='form-control'"); + echo html::select("types[$todo->id]", $lang->todo->typeList, $todo->type, "onchange='loadList(this.value, {$todo->id}, \"{$todo->type}\", {$todo->idvalue})' class='form-control'"); } ?> diff --git a/module/todo/view/edit.html.php b/module/todo/view/edit.html.php index 75c22f4e60..ab453962dd 100644 --- a/module/todo/view/edit.html.php +++ b/module/todo/view/edit.html.php @@ -16,6 +16,7 @@ todo->moduleList)?> todo->getUserObjectsMethod)?> idvalue);?> +type);?> $lang->todo->name, 'idvalue' => $lang->todo->idvalue));?> vision);?> @@ -124,7 +125,7 @@