* Fix bug #43120.
This commit is contained in:
@@ -35,7 +35,7 @@ $config->todo->batchCreate->form['switchTime'] = array('required' => false, 'typ
|
||||
$config->todo->batchCreate->form['vision'] = array('required' => false, 'type' => 'string', 'default' => $this->config->vision);
|
||||
|
||||
$config->todo->edit->form = array();
|
||||
$config->todo->edit->form['name'] = array('required' => true, 'type' => 'string', 'default' => 'todo');
|
||||
$config->todo->edit->form['name'] = array('required' => true, 'type' => 'string', 'default' => '');
|
||||
$config->todo->edit->form['status'] = array('required' => true, 'type' => 'string');
|
||||
$config->todo->edit->form['pri'] = array('required' => true, 'type' => 'int');
|
||||
$config->todo->edit->form['type'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
|
||||
@@ -126,6 +126,11 @@ class todo extends control
|
||||
{
|
||||
if(!empty($_POST))
|
||||
{
|
||||
if($this->post->type != 'custom')
|
||||
{
|
||||
if($this->post->type && in_array($this->post->type, $this->config->todo->moduleList)) $this->config->todo->edit->requiredFields = str_replace(',name,', ',', ",{$this->config->todo->edit->requiredFields},");
|
||||
$this->config->todo->edit->form['name']['required'] = false;
|
||||
}
|
||||
$form = form::data($this->config->todo->edit->form);
|
||||
$form = $this->todoZen->addCycleYearConfig($form);
|
||||
|
||||
|
||||
+1
-2
@@ -116,8 +116,7 @@ class todoTao extends todoModel
|
||||
*/
|
||||
protected function updateRow(int $todoID, object $todo): bool
|
||||
{
|
||||
$requiredFields = isset($todo->type) && in_array($todo->type, $this->config->todo->moduleList) ? str_replace(',name,', '', ",{$this->config->todo->edit->requiredFields},") : $this->config->todo->edit->requiredFields;
|
||||
if(isset($todo->type) && in_array($todo->type, $this->config->todo->moduleList)) $requiredFields .= ',objectID';
|
||||
$requiredFields = isset($todo->type) && in_array($todo->type, $this->config->todo->moduleList) ? str_replace(',name,', ',objectID,', ",{$this->config->todo->edit->requiredFields},") : $this->config->todo->edit->requiredFields;
|
||||
$this->dao->update(TABLE_TODO)->data($todo)
|
||||
->autoCheck()
|
||||
->checkIF($requiredFields, $requiredFields, 'notempty')
|
||||
|
||||
+11
-3
@@ -292,11 +292,19 @@ class todoZen extends todo
|
||||
if(isset($object->title)) $todo->name = $object->title;
|
||||
}
|
||||
|
||||
if($todo->end < $todo->begin)
|
||||
$requiredFields = isset($todo->type) && in_array($todo->type, $this->config->todo->moduleList) ? str_replace(',name,', ',', ",{$this->config->todo->edit->requiredFields},") : $this->config->todo->edit->requiredFields;
|
||||
$requiredFields = trim($requiredFields, ',');
|
||||
foreach(explode(',', $requiredFields) as $field)
|
||||
{
|
||||
dao::$errors['end'] = sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin);
|
||||
return false;
|
||||
if(!empty($field) && empty($todo->$field)) dao::$errors[$field] = sprintf($this->lang->error->notempty, $this->lang->todo->$field);
|
||||
}
|
||||
if($hasObject && !$objectID)
|
||||
{
|
||||
dao::$errors[$todo->type] = sprintf($this->lang->error->notempty, $this->lang->todo->name);
|
||||
unset(dao::$errors['objectID']);
|
||||
}
|
||||
if($todo->end < $todo->begin) dao::$errors['end'] = sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin);
|
||||
if(dao::isError()) return false;
|
||||
|
||||
/* Handle cycle configuration item. */
|
||||
if(!empty($oldTodo->cycle)) $this->handleCycleConfig($todo);
|
||||
|
||||
Reference in New Issue
Block a user