* Use the product's name instead of the product's name if the product is a shadow one.

This commit is contained in:
liugang
2022-09-20 17:50:07 +08:00
parent 43e8fd4bca
commit cb9c662a97
3 changed files with 8 additions and 3 deletions

View File

@@ -236,6 +236,11 @@ class productModel extends model
$product = $this->dao->findById($productID)->from(TABLE_PRODUCT)->fetch();
if(!$product) return false;
if($product->shadow) $product->name = $this->dao->select('t2.name')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')
->where('t1.product')->eq($productID)
->fetch('name');
return $this->loadModel('file')->replaceImgURL($product, 'desc');
}

View File

@@ -57,13 +57,13 @@ class testtask extends control
}
else
{
$products = $this->product->getPairs();
$products = $this->product->getPairs('', 0, '', true);
}
if(empty($products) and !helper::isAjaxRequest()) helper::end($this->locate($this->createLink('product', 'showErrorNone', "moduleName=$tab&activeMenu=testtask&objectID=$objectID")));
}
else
{
$products = $this->product->getPairs();
$products = $this->product->getPairs('', 0, '', true);
}
$this->view->products = $this->products = $products;
}

View File

@@ -77,7 +77,7 @@ class testtaskModel extends model
$branch = $scopeAndStatus[0] == 'all' ? 'all' : $branch;
$executionNameField = $this->config->systemMode == 'new' ? "IF(t5.id IS NOT NULL, CONCAT(t5.name, ' / ', t3.name), t3.name)" : 't3.name';
return $this->dao->select("t1.*, t2.name AS productName, $executionNameField AS executionName, t4.name AS buildName, t4.branch AS branch")
return $this->dao->select("t1.*, IF(t2.shadow = 1, t5.name, t2.name) AS productName, $executionNameField AS executionName, t4.name AS buildName, t4.branch AS branch")
->from(TABLE_TESTTASK)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
->leftJoin(TABLE_EXECUTION)->alias('t3')->on('t1.execution = t3.id')