From 28135d19852d4693d376fa87a5f344bef06f2935 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Wed, 17 May 2023 15:59:49 +0800 Subject: [PATCH] * Get project tasks (project have no executions), modify code in api and json. --- module/execution/control.php | 4 ++-- module/execution/model.php | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 49e51cdbd7..7874a3750b 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -44,8 +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 = ''; + /* Can not use $this->app->tab in API. */ + if((defined('RUN_MODE') and RUN_MODE == 'api') or $this->viewType == 'json') $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') diff --git a/module/execution/model.php b/module/execution/model.php index 09d4814b95..e632f68b5a 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1632,11 +1632,13 @@ class executionModel extends model } } + /* Can not use $this->app->tab in API. */ + $filterMulti = ((defined('RUN_MODE') and RUN_MODE == 'api') or $this->app->getViewType() == 'json') ? false : (!$this->session->multiple and $this->app->tab == 'execution'); /* Order by status's content whether or not done */ $executions = $this->dao->select("*, IF(INSTR('done,closed', status) < 2, 0, 1) AS isDone, INSTR('doing,wait,suspended,closed', status) AS sortStatus")->from(TABLE_EXECUTION) ->where('deleted')->eq(0) ->andWhere('vision')->eq($this->config->vision) - ->beginIF(!$this->session->multiple and $this->app->tab == 'execution')->andWhere('multiple')->eq('1')->fi() + ->beginIF($filterMulti)->andWhere('multiple')->eq('1')->fi() ->beginIF(strpos($mode, 'multiple') !== false)->andWhere('multiple')->eq('1')->fi() ->beginIF($type == 'all')->andWhere('type')->in('stage,sprint,kanban')->fi() ->beginIF($projectID)->andWhere('project')->eq($projectID)->fi()