* Fix bug #45092.
This commit is contained in:
@@ -94,8 +94,10 @@ class todo extends control
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$form = form::batchData($this->config->todo->batchCreate->form);
|
||||
$todosData = $this->todoZen->beforeBatchCreate($form);
|
||||
$form = form::batchData($this->config->todo->batchCreate->form);
|
||||
$todosData = $this->todoZen->beforeBatchCreate($form);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
|
||||
$todoIdList = $this->todo->batchCreate($todosData);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
|
||||
|
||||
+11
-3
@@ -230,13 +230,19 @@ class todoZen extends todo
|
||||
*
|
||||
* @param form $form
|
||||
* @access protected
|
||||
* @return object
|
||||
* @return array|false
|
||||
*/
|
||||
protected function beforeBatchCreate(form $form): array
|
||||
protected function beforeBatchCreate(form $form): array|false
|
||||
{
|
||||
$todos = $form->get();
|
||||
foreach($todos as $todo)
|
||||
foreach($todos as $rawID => $todo)
|
||||
{
|
||||
if($todo->end < $todo->begin)
|
||||
{
|
||||
dao::$errors["end[{$rawID}]"] = sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin);
|
||||
continue;
|
||||
}
|
||||
|
||||
$account = $this->app->user->account;
|
||||
$todo->date = $this->post->futureDate ? FUTURE_TIME : $this->post->date;
|
||||
$todo->account = $account;
|
||||
@@ -251,6 +257,8 @@ class todoZen extends todo
|
||||
|
||||
unset($todo->switchTime);
|
||||
}
|
||||
|
||||
if(dao::isError()) return false;
|
||||
return $todos;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user