diff --git a/api/v1/entries/todos.php b/api/v1/entries/todos.php index a082536068..e01efef14f 100644 --- a/api/v1/entries/todos.php +++ b/api/v1/entries/todos.php @@ -32,7 +32,7 @@ class todosEntry extends entry $this->batchSetPost($fields); $this->setPost('date', $this->request('date', date("Y-m-d"))); - $this->setPost('type', $this->request('date', 'custom')); + $this->setPost('type', $this->request('type', 'custom')); $this->setPost('status', $this->request('status', 'wait')); $this->setPost('begin', str_replace(':', '', $this->request('begin'))); $this->setPost('end', str_replace(':', '', $this->request('end'))); diff --git a/module/todo/control.php b/module/todo/control.php index 0f4cff2b4b..beb881ee46 100644 --- a/module/todo/control.php +++ b/module/todo/control.php @@ -143,7 +143,11 @@ class todo extends control if(!empty($_POST)) { $changes = $this->todo->update($todoID); - if(dao::isError()) die(js::error(dao::getError())); + if(dao::isError()) + { + if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'message' => dao::getError())); + die(js::error(dao::getError())); + } if($changes) { $actionID = $this->loadModel('action')->create('todo', $todoID, 'edited');