diff --git a/module/testtask/control.php b/module/testtask/control.php index 935e84ee7a..92ade38aac 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -103,42 +103,30 @@ class testtask extends control /* Create testtask from build of project.*/ if($projectID != 0 and $build != 0) { - $products = $this->dao->select('t2.id, t2.name') - ->from(TABLE_PROJECTPRODUCT)->alias('t1') - ->leftJoin(TABLE_PRODUCT)->alias('t2') - ->on('t1.product = t2.id') + $products = $this->dao->select('t2.id, t2.name')->from(TABLE_PROJECTPRODUCT)->alias('t1') + ->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id') ->where('t1.project')->eq($projectID) + ->andWhere('t2.deleted')->eq(0) ->fetchPairs('id'); - foreach($products as $key => $value) - { - $productID = $key; - break; - } - - $projects = $this->dao->select('id, name')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetchPairs('id'); - $builds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->eq($build)->fetchPairs('id'); + $productID = key($products); + $projects = $this->dao->select('id, name')->from(TABLE_PROJECT)->where('id')->eq($projectID)->andWhere('deleted')->eq(0)->fetchPairs('id'); + $builds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->eq($build)->andWhere('deleted')->eq(0)->fetchPairs('id'); } /* Create testtask from testtask of project.*/ if($projectID != 0 and $build == 0) { - $products = $this->dao->select('t2.id, t2.name') - ->from(TABLE_PROJECTPRODUCT)->alias('t1') - ->leftJoin(TABLE_PRODUCT)->alias('t2') - ->on('t1.product = t2.id') + $products = $this->dao->select('t2.id, t2.name')->from(TABLE_PROJECTPRODUCT)->alias('t1') + ->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id') ->where('t1.project')->eq($projectID) + ->andWhere('t2.deleted')->eq(0) ->fetchPairs('id'); - foreach($products as $key => $value) - { - $productID = $key; - break; - } - - $projects = $this->dao->select('id, name')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetchPairs('id'); - $builds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('project')->eq($projectID)->fetchPairs('id'); - $builds = array('trunk' => 'Trunk') + $builds; + $productID = key($products); + $projects = $this->dao->select('id, name')->from(TABLE_PROJECT)->where('id')->eq($projectID)->andWhere('deleted')->eq(0)->fetchPairs('id'); + $builds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('project')->eq($projectID)->andWhere('deleted')->eq(0)->fetchPairs('id'); + $builds = array('trunk' => 'Trunk') + $builds; } /* Create testtask from testtask of test.*/