From 0afa3c761321087ced75110dc3d33bf12e2ff63d Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Thu, 25 May 2023 08:07:25 +0000 Subject: [PATCH] * Fix #bug #31742, Project type project creation R&D requirements Upload attachments cannot be viewed from the document module. --- module/doc/model.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/module/doc/model.php b/module/doc/model.php index a6296c87d3..35a83f76ba 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -1904,6 +1904,14 @@ class docModel extends model } elseif($type == 'project') { + $project = $this->loadModel('project')->getByID($objectID); + $storyIDList = ''; + if(!$project->hasProduct) + { + $projectIDList = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($objectID)->orWhere('project')->eq($objectID)->fetchPairs('id', 'id'); + $storyIDList = $this->dao->select('story')->from(TABLE_PROJECTSTORY)->where('project')->in($projectIDList)->fetchPairs('story', 'story'); + } + if($this->config->edition == 'max') { $issueIdList = $this->dao->select('id')->from(TABLE_ISSUE)->where('project')->eq($objectID)->andWhere('deleted')->eq('0')->andWhere('project')->in($this->app->user->view->projects)->get(); @@ -1920,9 +1928,17 @@ class docModel extends model if(!empty($buildPairs)) $buildIdList = implode(',', $buildPairs); $executionIdList = join(',', $executionIdList); + $storyIDList = join(',', $storyIDList); } elseif($type == 'execution') { + $execution = $this->loadModel('execution')->getByID($objectID); + $project = $this->loadModel('project')->getByID($execution->project); + $storyIDList = ''; + + if(!$project->hasProduct) $storyIDList = $this->dao->select('story')->from(TABLE_PROJECTSTORY)->where('project')->eq($objectID)->fetchPairs('story', 'story'); + if($storyIDList) $storyIDList = join(',', $storyIDList); + $taskPairs = $this->dao->select('id')->from(TABLE_TASK)->where('execution')->eq($objectID)->andWhere('deleted')->eq('0')->andWhere('execution')->in($userView)->fetchPairs('id'); if(!empty($taskPairs)) $taskIdList = implode(',', $taskPairs); @@ -1952,6 +1968,7 @@ class docModel extends model ->beginIF($type == 'project' or $type == 'execution') ->orWhere("(objectType = 'task' and objectID in ($taskIdList))") ->orWhere("(objectType = 'build' and objectID in ($buildIdList))") + ->beginIF($storyIDList)->orWhere("(objectType = 'story' and objectID in ($storyIDList))")->fi() ->fi() ->markRight(1) ->beginIF($searchTitle !== false)->andWhere('title')->like("%{$searchTitle}%")->fi()