* Modify linked products when edit product.

This commit is contained in:
xieqiyu
2022-02-28 10:15:16 +08:00
parent 09f4270792
commit 9024dae71e
3 changed files with 56 additions and 6 deletions
+49 -3
View File
@@ -394,14 +394,60 @@ class branchModel extends model
foreach($productID as $id) $this->linkBranch4Project($id);
}
$linkedBranchProject = $this->dao->select('project,branch')->from(TABLE_PROJECTSTORY)
$linkedBranchProject = array();
$storyLinkedBranchProject = $this->dao->select('project,branch')->from(TABLE_PROJECTSTORY)
->where('product')->eq($productID)
->andWhere('branch')->gt(0)
->fetchGroup('project','branch');
->fetchGroup('project', 'branch');
foreach($storyLinkedBranchProject as $projectID => $branchList)
{
foreach($branchList as $branchID => $branch) $linkedBranchProject[$projectID][$branchID] = $branchID;
}
$bugLinkedBranchProject = $this->dao->select('project,branch')->from(TABLE_BUG)
->where('product')->eq($productID)
->andWhere('branch')->gt(0)
->andWhere('project')->ne(0)
->fetchGroup('project', 'branch');
foreach($bugLinkedBranchProject as $projectID => $branchList)
{
foreach($branchList as $branchID => $branch) $linkedBranchProject[$projectID][$branchID] = $branchID;
}
$bugLinkedBranchExecution = $this->dao->select('execution,branch')->from(TABLE_BUG)
->where('product')->eq($productID)
->andWhere('branch')->gt(0)
->andWhere('execution')->ne(0)
->fetchGroup('execution', 'branch');
foreach($bugLinkedBranchExecution as $executionID => $branchList)
{
foreach($branchList as $branchID => $branch) $linkedBranchProject[$executionID][$branchID] = $branchID;
}
$caseLinkedBranchProject = $this->dao->select('project,branch')->from(TABLE_CASE)
->where('product')->eq($productID)
->andWhere('branch')->gt(0)
->andWhere('project')->ne(0)
->fetchGroup('project', 'branch');
foreach($caseLinkedBranchProject as $projectID => $branchList)
{
foreach($branchList as $branchID => $branch) $linkedBranchProject[$projectID][$branchID] = $branchID;
}
$caseLinkedBranchExecution = $this->dao->select('execution,branch')->from(TABLE_CASE)
->where('product')->eq($productID)
->andWhere('branch')->gt(0)
->andWhere('execution')->ne(0)
->fetchGroup('execution', 'branch');
foreach($caseLinkedBranchExecution as $executionID => $branchList)
{
foreach($branchList as $branchID => $branch) $linkedBranchProject[$executionID][$branchID] = $branchID;
}
foreach($linkedBranchProject as $projectID => $branchList)
{
foreach($branchList as $branchID => $branch)
foreach($branchList as $branchID)
{
$data = new stdClass();
$data->product = $productID;
+1 -1
View File
@@ -2607,7 +2607,7 @@ class storyModel extends model
if(!empty($normalProducts)) $storyQuery .= " OR ";
$storyQuery .= "(`product` " . helper::dbIN(array_keys($branchProducts)) . " AND `branch` " . helper::dbIN($branches) . ")";
}
if(empty($branchProducts) and empty($branchProducts)) $storyQuery .= '1 = 1';
if(empty($normalProducts) and empty($branchProducts)) $storyQuery .= '1 = 1';
$storyQuery .= ') ';
if($this->app->moduleName == 'release' or $this->app->moduleName == 'build')
+6 -2
View File
@@ -82,9 +82,13 @@
$branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : '');
}
foreach($branchTagOption as $branchID => $branchName) $branchTagOption[$branchID] = '/' . $product->name . '/' . $branchName;
}
$modules[$caseProductID][$caseBranch] = $this->tree->getOptionMenu($cases[$caseID]->product, 'case', 0, $caseBranch);
$modules[$caseProductID][$caseBranch] = $this->tree->getOptionMenu($cases[$caseID]->product, 'case', 0, $caseBranch);
}
else
{
$modules[$caseProductID][0] = $this->tree->getOptionMenu($cases[$caseID]->product, 'case');
}
}
$caseProductID = isset($caseProductID) ? $caseProductID : $productID;
$moduleList = $modules[$caseProductID];