This commit is contained in:
mayue
2022-11-23 08:41:11 +08:00
parent 02580a0465
commit de42397894
3 changed files with 17 additions and 19 deletions
+12 -11
View File
@@ -100,10 +100,6 @@ class productplan extends control
if($parent) $this->view->parentPlan = $this->productplan->getById($parent);
$branchPairs = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($productID, 'active');
/* Get parent plan pairs. */
$parentPlanPairs = $this->productplan->getTopPlanPairs($productID, $branchID);
$this->view->parentPlanPairs = $parentPlanPairs;
/*Get default branch.*/
$branchList = $this->loadModel('branch')->getList($productID);
foreach($branchList as $branch)
@@ -115,12 +111,13 @@ class productplan extends control
$this->view->position[] = $this->lang->productplan->common;
$this->view->position[] = $this->lang->productplan->create;
$this->view->productID = $productID;
$this->view->lastPlan = $lastPlan;
$this->view->branch = $branchID;
$this->view->branches = $branchPairs;
$this->view->defaultBranch = $defaultBranch;
$this->view->parent = $parent;
$this->view->productID = $productID;
$this->view->lastPlan = $lastPlan;
$this->view->branch = $branchID;
$this->view->branches = $branchPairs;
$this->view->defaultBranch = $defaultBranch;
$this->view->parent = $parent;
$this->view->parentPlanPairs = $this->productplan->getTopPlanPairs($productID, $branchID, 'done,closed');
$this->display();
}
@@ -153,13 +150,17 @@ class productplan extends control
$plan = $this->productplan->getByID($planID);
$oldBranch = array($planID => $plan->branch);
/* Get the parent plan pair exclusion itself. */
$parentPlanPairs = $this->productplan->getTopPlanPairs($productID, $branchID);
unset($parentPlanPairs[$planID]);
$this->view->parentPlanPairs = $parentPlanPairs;
$this->commonAction($plan->product, $plan->branch);
$this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->productplan->edit;
$this->view->position[] = $this->lang->productplan->edit;
$this->view->productID = $plan->product;
$this->view->oldBranch = $oldBranch;
$this->view->plan = $plan;
$this->view->parentPlanPairs = $this->productplan->getTopPlanPairs($plan->product, $plan->branch, $planID);
$this->display();
}
+1 -2
View File
@@ -221,11 +221,10 @@ class productplanModel extends model
->beginIF($branch !== '')->andWhere('branch')->eq($branch)->fi()
->andWhere('parent')->le(0)
->andWhere('deleted')->eq(0)
->beginIF($exclude)->andWhere('status')->notin($exclude)
->orderBy('id_desc')
->fetchPairs();
if($exclude) unset($planPairs[$exclude]);
return $planPairs;
}
+4 -6
View File
@@ -7,12 +7,10 @@ $plan = new productPlan('admin');
$param = array();
$param[0] = array('productID' => 1, 'branch' => '', 'exclude' => '');
$param[1] = array('productID' => 1, 'branch' => '', 'exclude' => 1);
$param[2] = array('productID' => 41, 'branch' => 1, 'exclude' => '');
$param[3] = array('productID' => 41, 'branch' => 2, 'exclude' => '');
$param[1] = array('productID' => 41, 'branch' => 1, 'exclude' => '');
$param[2] = array('productID' => 41, 'branch' => 2, 'exclude' => '');
r($plan->getTopPlanPairsTest($param[0])) && p('1,2') && e('1.0,1.1'); //测试获取正常产品的顶级计划
r($plan->getTopPlanPairsTest($param[1])) && p('1,2') && e(',1.1'); //测试获取排除1.0计划的正常产品的顶级计划
r($plan->getTopPlanPairsTest($param[2])) && p('31') && e('1.0'); //测试获取分支1计划的正常产品的顶级计划
r($plan->getTopPlanPairsTest($param[3])) && p('32') && e('1.1'); //测试获取分支2计划的正常产品的顶级计划
r($plan->getTopPlanPairsTest($param[1])) && p('31') && e('1.0'); //测试获取分支1计划的正常产品的顶级计划
r($plan->getTopPlanPairsTest($param[2])) && p('32') && e('1.1'); //测试获取分支2计划的正常产品的顶级计划
?>