From 84a42e2a20357d65d6a52ca8c6fc6fbaf04f6be4 Mon Sep 17 00:00:00 2001 From: daitingting Date: Wed, 17 Jul 2024 09:46:59 +0000 Subject: [PATCH] * [bug#52568,done,1h] Add vision for compatibling with viewing drill data. --- module/task/control.php | 4 ++-- module/task/model.php | 5 +++-- module/task/zen.php | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/module/task/control.php b/module/task/control.php index e8986d1e2e..23330e5bac 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -334,7 +334,7 @@ class task extends control */ public function view(int $taskID) { - $task = $this->task->getById($taskID, true); + $task = $this->task->getById($taskID, true, $vision = 'all'); // TODO: $vision is for compatibling with viewing drill data. if(!$task) { if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'fail', 'code' => 404, 'message' => '404 Not found')); @@ -343,7 +343,7 @@ class task extends control if(!$this->loadModel('common')->checkPrivByObject('execution', $task->execution)) return $this->sendError($this->lang->execution->accessDenied, $this->createLink('execution', 'all')); /* 为视图设置常用的公共变量和设置菜单为任务所属执行. Set common variables to view and set menu to the execution of the task. */ - $this->taskZen->commonAction($taskID); + $this->taskZen->commonAction($taskID, $vision = 'all'); /* 如果当前主导航是项目,则设置菜单为会话中保存的项目. Set menu to project which saved in session if current app tab is project. */ if($this->app->tab == 'project') $this->loadModel('project')->setMenu($this->session->project); diff --git a/module/task/model.php b/module/task/model.php index 64037ad909..7104ce1f12 100755 --- a/module/task/model.php +++ b/module/task/model.php @@ -1240,13 +1240,14 @@ class taskModel extends model * @access public * @return false|object */ - public function getByID(int $taskID, bool $setImgSize = false): false|object + public function getByID(int $taskID, bool $setImgSize = false, $vision = ''): false|object { + if($vision == '') $vision = $this->config->vision; // TODO: $vision is for compatibling with viewing drill data. $task = $this->dao->select('t1.*, t2.id AS storyID, t2.title AS storyTitle, t2.version AS latestStoryVersion, t2.status AS storyStatus') ->from(TABLE_TASK)->alias('t1') ->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id') ->where('t1.id')->eq($taskID) - ->andWhere('t1.vision')->eq($this->config->vision) + ->beginIf($vision != 'all')->andWhere('t1.vision')->eq($this->config->vision)->fi() ->fetch(); if(!$task) return false; diff --git a/module/task/zen.php b/module/task/zen.php index 7104564381..1ab54899c5 100644 --- a/module/task/zen.php +++ b/module/task/zen.php @@ -889,9 +889,9 @@ class taskZen extends task * @access protected * @return void */ - protected function commonAction(int $taskID): void + protected function commonAction(int $taskID, string $vision = ''): void { - $this->view->task = $this->task->getByID($taskID); + $this->view->task = $this->task->getByID($taskID, true, $vision); $this->view->execution = $this->execution->getByID($this->view->task->execution); $this->view->members = $this->loadModel('user')->getTeamMemberPairs($this->view->execution->id, 'execution','nodeleted'); $this->view->actions = $this->loadModel('action')->getList('task', $taskID);