From f2d6299356d0612f12c9ede03782704d8d6e6de9 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Mon, 21 Mar 2022 10:39:41 +0800 Subject: [PATCH] * Fix bug #20662. --- api/v1/entries/task.php | 2 +- module/file/model.php | 16 ++++++++++++++++ module/task/control.php | 4 ++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/api/v1/entries/task.php b/api/v1/entries/task.php index b06bd8f677..15cd194d6e 100644 --- a/api/v1/entries/task.php +++ b/api/v1/entries/task.php @@ -102,7 +102,7 @@ class taskEntry extends Entry $oldTask = $this->loadModel('task')->getByID($taskID); /* Set $_POST variables. */ - $fields = 'name,type,desc,assignedTo,pri,estimate,left,consumed,story,parent,execution,module,closedReason,status,estStarted,deadline,team,teamEstimate,multiple,mailto'; + $fields = 'name,type,desc,assignedTo,pri,estimate,left,consumed,story,parent,execution,module,closedReason,status,estStarted,deadline,team,teamEstimate,multiple,mailto,uid'; $this->batchSetPost($fields, $oldTask); $control = $this->loadController('task', 'edit'); diff --git a/module/file/model.php b/module/file/model.php index c9a81b9935..2532df4ce2 100644 --- a/module/file/model.php +++ b/module/file/model.php @@ -1023,4 +1023,20 @@ class fileModel extends model return array($info->ImageWidth->value, $info->ImageHeight->value, 'img'); } } + + /** + * Get file pairs. + * + * @param int $IDs + * @param string $value + * @access public + * @return void + */ + public function getPairs($IDs, $value = 'title') + { + return $this->dao->select("id,$value")->from(TABLE_FILE) + ->where('id')->in($IDs) + ->andWhere('deleted')->eq('0') + ->fetchPairs(); + } } diff --git a/module/task/control.php b/module/task/control.php index 3a077b1610..7cfe1ba105 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -426,6 +426,10 @@ class task extends control $changes = $this->task->update($taskID); if(dao::isError()) return print(js::error(dao::getError())); $files = $this->loadModel('file')->saveUpload('task', $taskID); + if(empty($files) and $this->post->uid != '') + { + $files = $this->file->getPairs($_SESSION['album']['used'][$this->post->uid]); + } } $task = $this->task->getById($taskID);