From 3d1e94daa1b556a07814d29fc040c3a6337ec0b5 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Thu, 27 May 2021 17:37:34 +0800 Subject: [PATCH] * Finish task #38381. --- module/todo/config.php | 2 +- module/todo/js/common.js | 6 +++++- module/todo/model.php | 38 ++++++++++++++++++++++---------------- 3 files changed, 28 insertions(+), 18 deletions(-) diff --git a/module/todo/config.php b/module/todo/config.php index 19d6479031..3c1cf4bdf0 100644 --- a/module/todo/config.php +++ b/module/todo/config.php @@ -27,4 +27,4 @@ $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', 'issue', 'risk', 'review', 'testtask'); +$config->todo->moduleList = array('bug', 'task', 'story', 'issue', 'risk', 'review', 'testtask', 'opportunity'); diff --git a/module/todo/js/common.js b/module/todo/js/common.js index ecff38d232..af797a3d15 100644 --- a/module/todo/js/common.js +++ b/module/todo/js/common.js @@ -45,6 +45,10 @@ function loadList(type, id) { link = createLink('risk', 'ajaxGetUserRisks', param); } + else if(type == 'opportunity') + { + link = createLink('opportunity', 'ajaxGetUseropportunities', param); + } else if(type == 'testtask') { link = createLink('testtask', 'ajaxGetUserTestTasks', param); @@ -58,7 +62,7 @@ function loadList(type, id) link = createLink('feedback', 'ajaxGetUserFeedback', param); } - if(type == 'bug' || type == 'task' || type == 'story' || type == 'issue' || type == 'risk' || type == 'testtask' || type == 'review' || type == 'feedback') + if(type == 'bug' || type == 'task' || type == 'story' || type == 'issue' || type == 'risk' || type == 'testtask' || type == 'review' || type == 'feedback' || type == 'opportunity') { $.get(link, function(data, status) { diff --git a/module/todo/model.php b/module/todo/model.php index df64c634f8..98728838f9 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -110,7 +110,7 @@ class todoModel extends model $validTodos = array(); for($i = 0; $i < $this->config->todo->batchCreate; $i++) { - if($todos->names[$i] != '' || isset($todos->bugs[$i + 1]) || isset($todos->tasks[$i + 1]) || isset($todos->stories[$i + 1]) || isset($todos->issues[$i + 1]) || isset($todos->risks[$i + 1]) || isset($todos->reviews[$i + 1]) || isset($todos->testtasks[$i + 1])) + if($todos->names[$i] != '' || isset($todos->bugs[$i + 1]) || isset($todos->tasks[$i + 1]) || isset($todos->stories[$i + 1]) || isset($todos->issues[$i + 1]) || isset($todos->risks[$i + 1]) || isset($todos->reviews[$i + 1]) || isset($todos->testtasks[$i + 1]) || isset($todos->opportunities[$i + 1])) { $todo = new stdclass(); $todo->account = $this->app->user->account; @@ -133,13 +133,14 @@ class todoModel extends model $todo->private = 0; $todo->idvalue = 0; - if($todo->type == 'bug') $todo->idvalue = isset($todos->bugs[$i + 1]) ? $todos->bugs[$i + 1] : 0; - if($todo->type == 'task') $todo->idvalue = isset($todos->tasks[$i + 1]) ? $todos->tasks[$i + 1] : 0; - if($todo->type == 'story') $todo->idvalue = isset($todos->stories[$i + 1]) ? $todos->stories[$i + 1] : 0; - if($todo->type == 'issue') $todo->idvalue = isset($todos->issues[$i + 1]) ? $todos->issues[$i + 1] : 0; - if($todo->type == 'risk') $todo->idvalue = isset($todos->risks[$i + 1]) ? $todos->risks[$i + 1] : 0; - if($todo->type == 'review') $todo->idvalue = isset($todos->reviews[$i + 1]) ? $todos->reviews[$i + 1] : 0; - if($todo->type == 'testtask') $todo->idvalue = isset($todos->testtasks[$i + 1]) ? $todos->testtasks[$i + 1] : 0; + if($todo->type == 'bug') $todo->idvalue = isset($todos->bugs[$i + 1]) ? $todos->bugs[$i + 1] : 0; + if($todo->type == 'task') $todo->idvalue = isset($todos->tasks[$i + 1]) ? $todos->tasks[$i + 1] : 0; + if($todo->type == 'story') $todo->idvalue = isset($todos->stories[$i + 1]) ? $todos->stories[$i + 1] : 0; + if($todo->type == 'issue') $todo->idvalue = isset($todos->issues[$i + 1]) ? $todos->issues[$i + 1] : 0; + if($todo->type == 'risk') $todo->idvalue = isset($todos->risks[$i + 1]) ? $todos->risks[$i + 1] : 0; + if($todo->type == 'opportunity') $todo->idvalue = isset($todos->opportunities[$i + 1]) ? $todos->opportunities[$i + 1] : 0; + if($todo->type == 'review') $todo->idvalue = isset($todos->reviews[$i + 1]) ? $todos->reviews[$i + 1] : 0; + if($todo->type == 'testtask') $todo->idvalue = isset($todos->testtasks[$i + 1]) ? $todos->testtasks[$i + 1] : 0; if($todo->type != 'custom' and $todo->idvalue) { @@ -283,14 +284,15 @@ 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 == '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($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($todo->end < $todo->begin) die(js::alert(sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin))); @@ -310,6 +312,7 @@ class todoModel extends model ->checkIF($todo->type == 'story' and $todo->idvalue == 0, 'idvalue', 'notempty') ->checkIF($todo->type == 'issue' and $todo->idvalue == 0, 'idvalue', 'notempty') ->checkIF($todo->type == 'risk' and $todo->idvalue == 0, 'idvalue', 'notempty') + ->checkIF($todo->type == 'opportunity' and $todo->idvalue == 0, 'idvalue', 'notempty') ->checkIF($todo->type == 'review' and $todo->idvalue == 0, 'idvalue', 'notempty') ->checkIF($todo->type == 'testtask' and $todo->idvalue == 0, 'idvalue', 'notempty') ->checkIF($todo->type == 'feedback' and $todo->idvalue == 0, 'idvalue', 'notempty') @@ -385,6 +388,7 @@ class todoModel extends model if($todo->type == 'bug') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_BUG)->fetch('title'); if($todo->type == 'issue' and isset($this->config->maxVersion)) $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_ISSUE)->fetch('title'); if($todo->type == 'risk' and isset($this->config->maxVersion)) $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_RISK)->fetch('name'); + if($todo->type == 'opportunity' and isset($this->config->maxVersion)) $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_OPPORTUNITY)->fetch('name'); if($todo->type == 'review' and isset($this->config->maxVersion)) $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_REVIEW)->fetch('title'); if($todo->type == 'testtask') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TESTTASK)->fetch('name'); $todo->date = str_replace('-', '', $todo->date); @@ -500,6 +504,7 @@ class todoModel extends model if($todo->type == 'testtask') $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_TESTTASK)->fetch('name'); if($todo->type == 'issue' && isset($this->config->maxVersion)) $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_ISSUE)->fetch('title'); if($todo->type == 'risk' && isset($this->config->maxVersion)) $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_RISK)->fetch('name'); + if($todo->type == 'opportunity' && isset($this->config->maxVersion)) $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_OPPORTUNITY)->fetch('name'); if($todo->type == 'review' && isset($this->config->maxVersion)) $todo->name = $this->dao->findById($todo->idvalue)->from(TABLE_REVIEW)->fetch('title'); $todo->begin = date::formatTime($todo->begin); $todo->end = date::formatTime($todo->end); @@ -784,6 +789,7 @@ class todoModel extends model if($type == 'bug') $projectIdList[$type] = $this->dao->select('id,project')->from(TABLE_BUG)->where('id')->in($todoIdList)->fetchPairs('id', 'project'); if($type == 'issue') $projectIdList[$type] = $this->dao->select('id,project')->from(TABLE_ISSUE)->where('id')->in($todoIdList)->fetchPairs('id', 'project'); if($type == 'risk') $projectIdList[$type] = $this->dao->select('id,project')->from(TABLE_RISK)->where('id')->in($todoIdList)->fetchPairs('id', 'project'); + if($type == 'opportunity') $projectIdList[$type] = $this->dao->select('id,project')->from(TABLE_OPPORTUNITY)->where('id')->in($todoIdList)->fetchPairs('id', 'project'); if($type == 'review') $projectIdList[$type] = $this->dao->select('id,project')->from(TABLE_REVIEW)->where('id')->in($todoIdList)->fetchPairs('id', 'project'); if($type == 'testtask') $projectIdList[$type] = $this->dao->select('id,project')->from(TABLE_TESTTASK)->where('id')->in($todoIdList)->fetchPairs('id', 'project'); }