From a8951152f2a0fd8990ea457395608ae0ffe96576 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Wed, 17 May 2023 14:51:56 +0800 Subject: [PATCH] * Fix bug for API, can get project tasks (this project have not executions) now. --- api/v1/entries/tasks.php | 15 +++++++++++++++ module/execution/control.php | 2 ++ 2 files changed, 17 insertions(+) diff --git a/api/v1/entries/tasks.php b/api/v1/entries/tasks.php index 02aceb35b1..dde0393806 100644 --- a/api/v1/entries/tasks.php +++ b/api/v1/entries/tasks.php @@ -54,6 +54,21 @@ class tasksEntry extends entry } else { + /* If $executionID is a project that have no execution, get real executionID. */ + $project = $this->loadModel('project')->getByID($executionID); + if($project and $project->type == 'project' and !$project->multiple) + { + $executions = $this->loadModel('execution')->getList($project->id); + foreach($executions as $execution) + { + if(!$execution->multiple) + { + $executionID = $execution->id; + break; + } + } + } + /* Get tasks by execution. */ $control = $this->loadController('execution', 'task'); $control->task($executionID, $this->param('status', 'all'), 0, $this->param('order', 'id_desc'), 0, $this->param('limit', 100), $this->param('page', 1)); diff --git a/module/execution/control.php b/module/execution/control.php index 234acba3dc..b6ccdd538a 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -44,6 +44,8 @@ class execution extends control if(!isset($this->app->user)) return; $mode = $this->app->tab == 'execution' ? 'multiple' : ''; + /* this->app->tab will always be my if use API. */ + if(defined('RUN_MODE') and RUN_MODE == 'api') $mode = ''; $this->executions = $this->execution->getPairs(0, 'all', "nocode,{$mode}"); $skipCreateStep = array('computeburn', 'ajaxgetdropmenu', 'executionkanban', 'ajaxgetteammembers', 'all'); if(!in_array($this->methodName, $skipCreateStep) and $this->app->tab == 'execution')