From f3921abf0ab22e6651c168a89f4d193ecbb70bc2 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Fri, 4 Jun 2021 22:41:29 +0800 Subject: [PATCH] * Finish task #38922. --- module/todo/config.php | 2 +- module/todo/control.php | 3 ++- module/todo/model.php | 13 ++++--------- module/todo/view/batchedit.html.php | 11 +++++------ 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/module/todo/config.php b/module/todo/config.php index 39cf19eb87..91e5d79ecf 100644 --- a/module/todo/config.php +++ b/module/todo/config.php @@ -27,7 +27,7 @@ $config->todo->custom = new stdclass(); $config->todo->custom->batchCreateFields = 'type,pri,desc,beginAndEnd'; $config->todo->custom->batchEditFields = 'pri,beginAndEnd,status'; -$config->todo->moduleList = array('bug', 'task', 'story', 'review', 'testtask'); +$config->todo->moduleList = array('bug', 'task', 'story', 'testtask'); $config->todo->getUserObjectsMethod = array(); $config->todo->getUserObjectsMethod['bug'] = 'ajaxGetUserBugs'; diff --git a/module/todo/control.php b/module/todo/control.php index 0838a29101..e938ff903e 100644 --- a/module/todo/control.php +++ b/module/todo/control.php @@ -193,6 +193,7 @@ class todo extends control $bugs = $this->bug->getUserBugPairs($account); $tasks = $this->task->getUserTaskPairs($account, $status); $storys = $this->loadModel('story')->getUserStoryPairs($account); + if(isset($this->config->bizVersion) or isset($this->config->maxVersion)) $this->view->feedbacks = $this->loadModel('feedback')->getUserFeedbackPairs($account); if(isset($this->config->maxVersion)) { $issues = $this->loadModel('issue')->getUserIssuePairs($account); @@ -202,7 +203,7 @@ class todo extends control $testtasks = $this->loadModel('testtask')->getUserTestTaskPairs($account); $reviews = array(); - if(isset($this->config->qcVersion)) $reviews = $this->loadModel('review')->getUserReviewPairs($account); + if(isset($this->config->qcVersion) or isset($this->config->maxVersion)) $reviews = $this->loadModel('review')->getUserReviewPairs($account); $allTodos = $this->todo->getList($type, $account, $status); if($this->post->todoIDList) $todoIDList = $this->post->todoIDList; diff --git a/module/todo/model.php b/module/todo/model.php index d90479fefe..d3aca615f3 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -297,16 +297,11 @@ class todoModel extends model $todo->name = ($todo->type == 'custom' or $todo->type == 'cycle' or $todo->type == 'feedback') ? $data->names[$todoID] : ''; $todo->begin = isset($data->begins[$todoID]) ? $data->begins[$todoID] : 2400; $todo->end = isset($data->ends[$todoID]) ? $data->ends[$todoID] : 2400; - if($todo->type == 'task') $todo->idvalue = isset($data->tasks[$todoID]) ? $data->tasks[$todoID] : 0; - if($todo->type == 'bug') $todo->idvalue = isset($data->bugs[$todoID]) ? $data->bugs[$todoID] : 0; - if($todo->type == 'story') $todo->idvalue = isset($data->storys[$todoID]) ? $data->storys[$todoID] : 0; - if($todo->type == 'issue') $todo->idvalue = isset($data->issues[$todoID]) ? $data->issues[$todoID] : 0; - if($todo->type == 'risk') $todo->idvalue = isset($data->risks[$todoID]) ? $data->risks[$todoID] : 0; - if($todo->type == 'opportunity') $todo->idvalue = isset($data->opportunities[$todoID]) ? $data->opportunities[$todoID] : 0; - if($todo->type == 'review') $todo->idvalue = isset($data->reviews[$todoID]) ? $data->reviews[$todoID] : 0; - if($todo->type == 'testtask') $todo->idvalue = isset($data->testtasks[$todoID]) ? $data->testtasks[$todoID] : 0; - if($todo->type == 'feedback') $todo->idvalue = isset($data->feedbacks[$todoID]) ? $data->feedbacks[$todoID] : 0; + if(in_array($todo->type, $this->config->todo->moduleList)) + { + $todo->idvalue = isset($data->{$this->config->todo->objectList[$todo->type]}[$todoID]) ? $data->{$this->config->todo->objectList[$todo->type]}[$todoID] : 0; + } if($todo->end < $todo->begin) die(js::alert(sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin))); $todos[$todoID] = $todo; diff --git a/module/todo/view/batchedit.html.php b/module/todo/view/batchedit.html.php index 2786648b85..e3efe5ad05 100644 --- a/module/todo/view/batchedit.html.php +++ b/module/todo/view/batchedit.html.php @@ -73,11 +73,6 @@ { echo html::input("names[$todo->id]", $todo->name, "class='form-control'"); } - elseif($todo->type == 'feedback') - { - echo html::input("names[$todo->id]", $todo->name, "class='form-control'"); - echo html::hidden("feedbacks[$todo->id]", $todo->idvalue, "class='form-control'"); - } elseif($todo->type == 'task') { echo html::select("tasks[$todo->id]", $tasks, $todo->idvalue, 'class="form-control chosen"'); @@ -88,7 +83,7 @@ } elseif($todo->type == 'story') { - echo html::select("storys[$todo->id]", $storys, $todo->idvalue, 'class="form-control chosen"'); + echo html::select("stories[$todo->id]", $storys, $todo->idvalue, 'class="form-control chosen"'); } elseif($todo->type == 'issue') { @@ -110,6 +105,10 @@ { echo html::select("opportunities[$todo->id]", $opportunities, $todo->idvalue, 'class="form-control chosen"'); } + elseif($todo->type == 'feedback') + { + echo html::select("feedbacks[$todo->id]", $feedbacks, $todo->idvalue, 'class="form-control chosen"'); + } ?>