diff --git a/module/todo/js/common.js b/module/todo/js/common.js index d2afa91671..bfdb5196e9 100644 --- a/module/todo/js/common.js +++ b/module/todo/js/common.js @@ -97,9 +97,9 @@ function setBeginsAndEnds(i, beginOrEnd) } } -function switchDateList(number) +function switchTimeList(number) { - if($('#switchDate' + number).prop('checked')) + if($('#switchTime' + number).prop('checked')) { $('#begins' + number).attr('disabled', 'disabled').trigger('chosen:updated'); $('#ends' + number).attr('disabled', 'disabled').trigger('chosen:updated'); diff --git a/module/todo/model.php b/module/todo/model.php index 309997419a..9aba516abf 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -99,6 +99,8 @@ class todoModel extends model public function batchCreate() { $todos = fixer::input('post')->get(); + + $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])) @@ -126,17 +128,9 @@ class todoModel extends model if($todo->type == 'task') $todo->idvalue = isset($todos->tasks[$i + 1]) ? $todos->tasks[$i + 1] : 0; if($todo->type == 'story') $todo->idvalue = isset($todos->storys[$i + 1]) ? $todos->storys[$i + 1] : 0; - if($todo->end <= $todo->begin) die(js::alert(sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin))); + if($todo->end < $todo->begin) die(js::alert(sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin))); - $this->dao->insert(TABLE_TODO)->data($todo)->autoCheck()->exec(); - if(dao::isError()) - { - echo js::error(dao::getError()); - die(js::reload('parent')); - } - $todoID = $this->dao->lastInsertID(); - $this->loadModel('score')->create('todo', 'create', $todoID); - $this->loadModel('action')->create('todo', $todoID, 'opened'); + $validTodos[] = $todo; } else { @@ -148,6 +142,19 @@ class todoModel extends model unset($todos->ends[$i]); } } + + foreach($validTodos as $todo) + { + $this->dao->insert(TABLE_TODO)->data($todo)->autoCheck()->exec(); + if(dao::isError()) + { + echo js::error(dao::getError()); + die(js::reload('parent')); + } + $todoID = $this->dao->lastInsertID(); + $this->loadModel('score')->create('todo', 'create', $todoID); + $this->loadModel('action')->create('todo', $todoID, 'opened'); + } } /** @@ -173,7 +180,7 @@ class todoModel extends model ->remove('uid') ->get(); - if($todo->end <= $todo->begin) + if($todo->end < $todo->begin) { dao::$errors[] = sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin); return false; @@ -247,7 +254,7 @@ class todoModel extends model 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->end <= $todo->begin) die(js::alert(sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin))); + 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/batchcreate.html.php b/module/todo/view/batchcreate.html.php index 34d60bb0f3..352fc49c32 100755 --- a/module/todo/view/batchcreate.html.php +++ b/module/todo/view/batchcreate.html.php @@ -25,10 +25,10 @@