From 8cf7c265c2340a4a60fb616b1e1be16fdb6ec821 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Thu, 10 Sep 2015 14:27:10 +0800 Subject: [PATCH] * fix bug #740. --- module/testtask/control.php | 38 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 25 deletions(-) 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.*/