Merge branch 'sprint/zentaopms271_lanzongjun' into 'master'

* Finish Bug #30480

See merge request easycorp/zentaopms!6498
This commit is contained in:
孙广明
2022-12-08 06:05:50 +00:00
3 changed files with 34 additions and 3 deletions
+1 -1
View File
@@ -356,7 +356,7 @@ class product extends control
$this->view->productName = $productName;
$this->view->moduleID = $moduleID;
$this->view->stories = $stories;
$this->view->plans = $this->loadModel('productplan')->getPairs($productID, ($branch === 'all' or empty($branch)) ? '' : $branch, 'unexpired', true);
$this->view->plans = $this->loadModel('productplan')->getPairs($productID, ($branch === 'all' or empty($branch)) ? '' : $branch, 'unexpired,noclosed', true);
$this->view->productPlans = isset($productPlans) ? array(0 => '') + $productPlans : array();
$this->view->summary = $this->product->summary($stories, $storyType);
$this->view->moduleTree = $moduleTree;
+20
View File
@@ -1355,4 +1355,24 @@ class productplanModel extends model
if(!empty($unlinkBugs)) $this->dao->update(TABLE_BUG)->set('plan')->eq(0)->where('plan')->eq($plan->parent)->andWhere('id')->in($unlinkBugs)->exec();
$this->dao->update(TABLE_BUG)->set('plan')->eq($plan->id)->where('plan')->eq($plan->parent)->exec();
}
/**
* Get plan list by ids.
*
* @param array $planIds
* @param boo $order
* @access public
* @return array
*/
public function getListByIds($planIds, $order = false)
{
$plans = $this->dao->select('*')->from(TABLE_PRODUCTPLAN)
->where('id')->in($planIds)
->orderBy('begin desc')
->fetchAll('id');
if($order) $plans = $this->relationBranch($plans);
return $plans;
}
}
+13 -2
View File
@@ -739,7 +739,7 @@ class project extends control
{
$linkedBranchList[$branchID] = $branchID;
if($branch != BRANCH_MAIN) $productPlans[$productID] = isset($plans[$productID][BRANCH_MAIN]) ? $plans[$productID][BRANCH_MAIN] : array();
if(!isset($productPlans[$productID])) $productPlans[$productID] = isset($plans[$productID][BRANCH_MAIN]) ? $plans[$productID][BRANCH_MAIN] : array();
$productPlans[$productID] += isset($plans[$productID][$branchID]) ? $plans[$productID][$branchID] : array();
if(!empty($projectStories[$productID][$branchID]) or !empty($projectBranches[$productID][$branchID]))
@@ -751,6 +751,17 @@ class project extends control
}
}
$productPlansOrder = array();
foreach($productPlans as $productID => $plan)
{
$orderPlans = $this->loadModel('productPlan')->getListByIds(array_keys($plan), true);
$orderPlansMap = array_keys($orderPlans);
foreach($orderPlansMap as $planMapID)
{
$productPlansOrder[$productID][$planMapID] = $productPlans[$productID][$planMapID];
}
}
if($project->model != 'kanban') $canChangeModel = $this->project->checkCanChangeModel($projectID, $project->model);
$this->view->title = $this->lang->project->edit;
@@ -764,7 +775,7 @@ class project extends control
$this->view->projectID = $projectID;
$this->view->allProducts = array('0' => '') + $allProducts;
$this->view->multiBranchProducts = $this->loadModel('product')->getMultiBranchPairs();
$this->view->productPlans = array_filter($productPlans);
$this->view->productPlans = array_filter($productPlansOrder);
$this->view->linkedProducts = $linkedProducts;
$this->view->branches = $branches;
$this->view->executions = $this->execution->getPairs($projectID);