From 778bc369ea79577b44ee0375a579d7b24ef499cc Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 14 Apr 2022 15:12:44 +0800 Subject: [PATCH] * Fix bug#15988. --- module/project/model.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/module/project/model.php b/module/project/model.php index 38430574f8..8b5db8db7e 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -218,12 +218,14 @@ class projectModel extends model ->groupBy('root') ->fetchAll('root'); - $estimates = $this->dao->select('t2.parent as project, sum(estimate) as estimate')->from(TABLE_TASK)->alias('t1') + $condition = $this->config->systemMode == 'classic' ? 't2.id as project' : 't2.parent as project'; + $estimates = $this->dao->select("$condition, sum(estimate) as estimate")->from(TABLE_TASK)->alias('t1') ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.execution = t2.id') - ->where('t2.parent')->in($projectIdList) + ->where('t1.parent')->lt(1) + ->beginIF($this->config->systemMode == 'new')->andWhere('t2.parent')->in($projectIdList)->fi() + ->beginIF($this->config->systemMode == 'classic')->andWhere('t2.id')->in($projectIdList)->fi() ->andWhere('t1.deleted')->eq(0) ->andWhere('t2.deleted')->eq(0) - ->andWhere('t1.parent')->lt(1) ->groupBy('project') ->fetchAll('project');