diff --git a/module/custom/model.php b/module/custom/model.php index a0b8c39a1e..c69cdcd408 100644 --- a/module/custom/model.php +++ b/module/custom/model.php @@ -962,7 +962,15 @@ class customModel extends model */ public function hasScrumIssueData() { - if($this->config->edition == 'max') return $this->dao->select('*')->from(TABLE_ISSUE)->where('deleted')->eq('0')->andWhere('execution')->ne(0)->count(); + if($this->config->edition == 'max') + { + return $this->dao->select('t1.*')->from(TABLE_ISSUE)->alias('t1') + ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') + ->where('t1.deleted')->eq('0') + ->andWhere('t2.deleted')->eq('0') + ->andWhere('t2.model')->eq('scrum') + ->count(); + } return false; } @@ -974,7 +982,15 @@ class customModel extends model */ public function hasScrumRiskData() { - if($this->config->edition == 'max') return $this->dao->select('*')->from(TABLE_RISK)->where('deleted')->eq('0')->andWhere('execution')->ne(0)->count(); + if($this->config->edition == 'max') + { + return $this->dao->select('t1.*')->from(TABLE_RISK)->alias('t1') + ->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id') + ->where('t1.deleted')->eq('0') + ->andWhere('t2.deleted')->eq('0') + ->andWhere('t2.model')->eq('scrum') + ->count(); + } return false; }