This commit is contained in:
wangyidong
2021-07-16 15:49:26 +08:00
parent 46688484f6
commit 0f11bf5a2c
2 changed files with 19 additions and 6 deletions
+12 -3
View File
@@ -519,7 +519,16 @@ class bug extends control
/* Get products and projects. */
$products = $this->config->CRProduct ? $this->products : $this->product->getPairs('noclosed', 0, 'program_asc');
$projects = array(0 => '');
if($projectID)
if($executionID)
{
$products = array();
$linkedProducts = $this->loadModel('execution')->getProducts($executionID);
foreach($linkedProducts as $product) $products[$product->id] = $product->name;
$project = $this->loadModel('project')->getByID($projectID);
$projects = array($projectID => $project->name);
}
elseif($projectID)
{
$products = array();
$productList = $this->config->CRProduct ? $this->product->getOrderedProducts('all', 40, $projectID) : $this->product->getOrderedProducts('normal', 40, $projectID);
@@ -899,7 +908,7 @@ class bug extends control
$this->view->product = $product;
$this->view->productName = $this->products[$productID];
$this->view->plans = $this->loadModel('productplan')->getPairs($productID, $bug->branch);
$this->view->projects = array(0 => '') + $this->product->getProjectPairsByProduct($productID, $bug->branch);
$this->view->projects = array(0 => '') + $this->product->getProjectPairsByProduct($productID, $bug->branch, $bug->project);
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $bug->branch);
$this->view->currentModuleID = $currentModuleID;
$this->view->executions = array(0 => '') + $this->product->getExecutionPairsByProduct($bug->product, $bug->branch ? "0,{$bug->branch}" : 0, 'id_desc', $projectID);
@@ -1563,7 +1572,7 @@ class bug extends control
$this->loadModel('gitlab');
$relation = $this->gitlab->getRelationByObject('bug', $bugID);
if(!empty($relation)) $this->gitlab->deleteIssue('bug', $bugID, $relation->issueID);
$this->bug->delete(TABLE_BUG, $bugID);
if($bug->toTask != 0)
{
+7 -3
View File
@@ -874,19 +874,23 @@ class productModel extends model
*
* @param int $productID
* @param int $branch
* @param int $appendProject
* @access public
* @return array
*/
public function getProjectPairsByProduct($productID, $branch = 0)
public function getProjectPairsByProduct($productID, $branch = 0, $appendProject = 0)
{
return $this->dao->select('t2.id,t2.name')->from(TABLE_PROJECTPRODUCT)->alias('t1')
$projects = $this->dao->select('t2.id,t2.name')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->where('t1.product')->eq($productID)
->andWhere('t2.type')->eq('project')
->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->projects)->fi()
->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi()
->andWhere('t2.deleted')->eq('0')
->fetchPairs();
->fetchPairs('id', 'name');
if($appendProject) $projects += $this->dao->select('id,name')->from(TABLE_PROJECT)->where('id')->in($appendProject)->fetchPairs('id', 'name');
return $projects;
}
/**