*Finish task #46100.

This commit is contained in:
songchenxuan
2021-12-22 10:48:55 +08:00
parent 35a4af824f
commit 1c8df7822a
2 changed files with 36 additions and 29 deletions
+34 -27
View File
@@ -776,39 +776,44 @@ class story extends control
{
if(!$executionID)
{
$branches = $this->branch->getPairs($productID);
$product = $this->product->getByID($productID);
$branchProduct = $product->type == 'normal' ? false : true;
$modules = array($productID => $this->tree->getOptionMenu($productID, 'story', 0, array_keys($branches)));
$plans = array($productID => $this->productplan->getBranchPlanPairs($productID, '', true));
$products = array($productID => $product);
$branches = array($productID => $branches);
$branches = $this->branch->getList($productID, $executionID, 'all');
$branchOption = array();
$branchTagOption = array();
foreach($branches as $branchInfo) $branchTagOption[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : '');
$product = $this->product->getByID($productID);
$branchProduct = $product->type == 'normal' ? false : true;
$modules = array($productID => $this->tree->getOptionMenu($productID, 'story', 0, array_keys($branches)));
$plans = array($productID => $this->productplan->getBranchPlanPairs($productID, '', true));
$products = array($productID => $product);
$branchTagOption = array($productID => $branchTagOption);
}
else
{
$modules = array();
$branches = array();
$execution = $this->execution->getByID($executionID);
$branchProduct = false;
$linkedProducts = $this->loadModel('product')->getProducts($executionID);
$modules = array();
$branches = array();
$branchTagOption = array();
$execution = $this->execution->getByID($executionID);
$branchProduct = false;
$linkedProducts = $this->loadModel('product')->getProducts($executionID);
foreach($linkedProducts as $linkedProduct)
{
$branchList = $this->branch->getPairs($linkedProduct->id, '', $executionID);
$branches[$linkedProduct->id] = array(BRANCH_MAIN => $this->lang->branch->main) + $branchList;
$modules[$linkedProduct->id] = $this->tree->getOptionMenu($linkedProduct->id, 'story', 0, array_keys($branchList));
$plans[$linkedProduct->id] = $this->productplan->getBranchPlanPairs($linkedProduct->id, array_keys($branchList), true);
$branchList = $this->branch->getList($linkedProduct->id, $executionID, 'all');
foreach($branchList as $branchInfo) $branches[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : '');
$branchTagOption[$linkedProduct->id] = array(BRANCH_MAIN => $this->lang->branch->main) + $branches;
$modules[$linkedProduct->id] = $this->tree->getOptionMenu($linkedProduct->id, 'story', 0, array_keys($branchList));
$plans[$linkedProduct->id] = $this->productplan->getBranchPlanPairs($linkedProduct->id, array_keys($branchList), true);
if(empty($plans[$linkedProduct->id])) $plans[$linkedProduct->id][0] = $plans[$linkedProduct->id];
if($linkedProduct->type != 'normal') $branchProduct = true;
}
$products = $linkedProducts;
}
$this->view->title = (isset($product) ? $product->name : $execution->name) . $this->lang->colon . $this->lang->story->batchEdit;
$this->view->branches = $branches;
$this->view->modules = $modules;
$this->view->productName = isset($product) ? $product->name : '';
$this->view->title = (isset($product) ? $product->name : $execution->name) . $this->lang->colon . $this->lang->story->batchEdit;
$this->view->branchTagOption = $branchTagOption;
$this->view->modules = $modules;
$this->view->productName = isset($product) ? $product->name : '';
}
else
{
@@ -819,9 +824,11 @@ class story extends control
$products = $this->product->getByIdList($productIdList);
foreach($products as $storyProduct)
{
$branchList = $this->branch->getPairs($storyProduct->id);
$branchList = array();
$branches = $this->branch->getList($storyProduct->id, 0, 'all');
foreach($branches as $branchInfo) $branchList[$branchInfo->id] = $branchInfo->name . ($branchInfo->status == 'closed' ? ' (' . $this->lang->branch->statusList['closed'] . ')' : '');
$branchIdList = array_keys($branchList) ? array_keys($branchList) : 0;
$branches[$storyProduct->id] = $branchList;
$branchTagOption[$storyProduct->id] = $branchList;
$modules[$storyProduct->id] = $this->tree->getOptionMenu($storyProduct->id, 'story', 0, $branchIdList);
if($storyProduct->type == 'normal') $modules[$storyProduct->id][0] = $modules[$storyProduct->id];
@@ -832,9 +839,9 @@ class story extends control
if($storyProduct->type != 'normal') $branchProduct = true;
}
$this->view->title = $this->lang->story->batchEdit;
$this->view->branches = $branches;
$this->view->modules = $modules;
$this->view->title = $this->lang->story->batchEdit;
$this->view->branchTagOption = $branchTagOption;
$this->view->modules = $modules;
}
/* Set ditto option for users. */
+2 -2
View File
@@ -72,8 +72,8 @@ foreach(explode(',', $showFields) as $field)
<?php if($branchProduct):?>
<td class='text-left<?php echo zget($visibleFields, 'branch', ' hidden')?>'>
<?php $disabled = $products[$story->product]->type == 'normal' ? "disabled='disabled'" : '';?>
<?php if($products[$story->product]->type == 'normal') $branches[$story->product] = array();?>
<?php echo html::select("branches[$storyID]", $branches[$story->product], $story->branch, "class='form-control chosen' onchange='loadBranches($story->product, this.value, $storyID);' $disabled");?>
<?php if($products[$story->product]->type == 'normal') $branchTagOption[$story->product] = array();?>
<?php echo html::select("branches[$storyID]", $branchTagOption[$story->product], $story->branch, "class='form-control chosen' onchange='loadBranches($story->product, this.value, $storyID);' $disabled");?>
</td>
<?php endif;?>
<td class='text-left<?php echo zget($visibleFields, 'module')?>'>