From bc3bd8316c1cd21f91070f46c110c7420d52c933 Mon Sep 17 00:00:00 2001 From: guanxiying Date: Mon, 5 Jul 2021 14:47:15 +0800 Subject: [PATCH] * Fix bug #12828. --- module/todo/js/common.js | 1 + module/todo/model.php | 9 ++++++++- module/todo/view/edit.html.php | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/module/todo/js/common.js b/module/todo/js/common.js index d719367493..e2a16621bf 100644 --- a/module/todo/js/common.js +++ b/module/todo/js/common.js @@ -37,6 +37,7 @@ function loadList(type, id) if(data.length != 0) { $(divClass).html(data).find('select').chosen(); + if(config.currentMethod == 'edit') $(divClass).html(data).find('select').val(idvalue).trigger('chosen:updated'); } else { diff --git a/module/todo/model.php b/module/todo/model.php index 6c8acbd854..210cb38b08 100644 --- a/module/todo/model.php +++ b/module/todo/model.php @@ -206,7 +206,6 @@ class todoModel extends model public function update($todoID) { $oldTodo = $this->dao->findById((int)$todoID)->from(TABLE_TODO)->fetch(); - if(in_array($oldTodo->type, $this->config->todo->moduleList)) $oldTodo->name = ''; $objectType = $this->post->type; $hasObject = in_array($objectType, $this->config->todo->moduleList); @@ -224,6 +223,14 @@ class todoModel extends model ->remove(implode(',', $this->config->todo->moduleList) . ',uid') ->get(); + if($todo->type != 'custom') + { + $type = $todo->type; + $object = $this->loadModel($type)->getByID($objectType); + if(isset($object->name)) $todo->name = $object->name; + if(isset($object->title)) $todo->name = $object->title; + } + if($todo->end < $todo->begin) { dao::$errors[] = sprintf($this->lang->error->gt, $this->lang->todo->end, $this->lang->todo->begin); diff --git a/module/todo/view/edit.html.php b/module/todo/view/edit.html.php index e15574fa6c..44f7d0dbdc 100644 --- a/module/todo/view/edit.html.php +++ b/module/todo/view/edit.html.php @@ -15,6 +15,7 @@ todo->moduleList)?> todo->getUserObjectsMethod)?> +idvalue);?>