diff --git a/module/todo/lang/zh-cn.php b/module/todo/lang/zh-cn.php index 7b32fbd6e7..c780ca14b0 100644 --- a/module/todo/lang/zh-cn.php +++ b/module/todo/lang/zh-cn.php @@ -50,6 +50,7 @@ $lang->todo->name = '名称'; $lang->todo->status = '状态'; $lang->todo->desc = '描述'; $lang->todo->private = '私人事务'; +$lang->todo->idvalue = '任务或Bug'; $lang->todo->week = '星期'; $lang->todo->today = '今天'; diff --git a/module/todo/model.php b/module/todo/model.php index a2b10ce5a8..f484998d62 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -36,15 +36,18 @@ class todoModel extends model ->specialChars('type,name,desc') ->cleanInt('date, pri, begin, end, private') ->setIF($this->post->type != 'custom', 'name', '') - ->setIF($this->post->type == 'bug', 'idvalue', $this->post->bug) - ->setIF($this->post->type == 'task', 'idvalue', $this->post->task) + ->setIF($this->post->type == 'bug' and $this->post->bug, 'idvalue', $this->post->bug) + ->setIF($this->post->type == 'task' and $this->post->task, 'idvalue', $this->post->task) ->setIF($this->post->begin == false, 'begin', '2400') ->setIF($this->post->end == false, 'end', '2400') ->remove('bug, task') ->get(); + $this->dao->insert(TABLE_TODO)->data($todo) ->autoCheck() ->checkIF($todo->type == 'custom', $this->config->todo->create->requiredFields, 'notempty') + ->checkIF($todo->type == 'bug' and $todo->idvalue == 0, 'idvalue', 'notempty') + ->checkIF($todo->type == 'task' and $todo->idvalue == 0, 'idvalue', 'notempty') ->exec(); return $this->dao->lastInsertID(); }