* Modify code logic.

This commit is contained in:
tianshujie
2021-11-08 09:29:45 +08:00
parent 0328182a47
commit c5779575c1
5 changed files with 15 additions and 19 deletions
+6 -6
View File
@@ -64,13 +64,13 @@ class branch extends control
public function ajaxGetDropMenu($productID, $branch = 0, $module, $method, $extra = '')
{
$branches = $this->branch->getPairs($productID, 'all');
$this->view->link = $this->loadModel('product')->getProductLink($module, $method, $extra, true);
$this->view->productID = $productID;
$this->view->projectID = $this->session->project;
$this->view->module = $module;
$this->view->method = $method;
$this->view->extra = $extra;
$this->view->link = $this->loadModel('product')->getProductLink($module, $method, $extra, true);
$this->view->productID = $productID;
$this->view->projectID = $this->session->project;
$this->view->module = $module;
$this->view->method = $method;
$this->view->extra = $extra;
$this->view->branches = $branches;
$this->view->currentBranchID = $branch;
$this->view->branchesPinyin = common::convert2Pinyin($branches);
+2 -3
View File
@@ -40,9 +40,6 @@ class branchModel extends model
*/
public function getPairs($productID, $params = '')
{
$product = $this->loadModel('product')->getById($productID);
if(!$product or $product->type == 'normal') return array();
$branches = $this->dao->select('*')->from(TABLE_BRANCH)
->where('deleted')->eq(0)
->beginIF($productID)->andWhere('product')->eq($productID)->fi()
@@ -52,6 +49,8 @@ class branchModel extends model
if(strpos($params, 'noempty') === false)
{
$product = $this->loadModel('product')->getById($productID);
if(!$product or $product->type == 'normal') return array();
$branches = array('0' => $this->lang->branch->main) + $branches;
}
+4 -4
View File
@@ -413,8 +413,8 @@ class productplan extends control
else
{
$this->config->product->search['fields']['branch'] = $this->lang->product->branch;
$branches = array('' => '', '0' => $this->lang->branch->main) + $this->loadModel('branch')->getPairs($plan->product, 'noempty');
if($plan->branch) $branches = array('' => '', '0' => $this->lang->branch->main, $plan->branch => $branches[$plan->branch]);
$branches = array('' => '', $this->loadModel('branch')->getPairs($plan->product);
if($plan->branch) $branches = array('' => '', $plan->branch => $branches[$plan->branch]);
$this->config->product->search['params']['branch']['values'] = $branches;
}
$this->loadModel('search')->setSearchParams($this->config->product->search);
@@ -554,8 +554,8 @@ class productplan extends control
else
{
$this->config->bug->search['fields']['branch'] = $this->lang->product->branch;
$branches = array('' => '', '0' => $this->lang->branch->main) + $this->loadModel('branch')->getPairs($productID, 'noempty');
if($plan->branch) $branches = array('' => '', '0' => $this->lang->branch->main, $plan->branch => $branches[$plan->branch]);
$branches = array('' => '') + $this->loadModel('branch')->getPairs($productID);
if($plan->branch) $branches = array('' => '', $plan->branch => $branches[$plan->branch]);
$this->config->bug->search['params']['branch']['values'] = $branches;
}
$this->loadModel('search')->setSearchParams($this->config->bug->search);
+2 -2
View File
@@ -306,7 +306,7 @@ class story extends control
$this->view->users = $users;
$this->view->moduleID = $moduleID ? $moduleID : (int)$this->cookie->lastStoryModule;
$this->view->moduleOptionMenu = $moduleOptionMenu;
$this->view->plans = $this->loadModel('productplan')->getPairsForStory($productID, $branch);
$this->view->plans = $this->loadModel('productplan')->getPairsForStory($productID, $branch, true);
$this->view->planID = $planID;
$this->view->source = $source;
$this->view->sourceNote = $sourceNote;
@@ -626,7 +626,7 @@ class story extends control
$this->view->stories = $stories;
$this->view->users = $users;
$this->view->product = $product;
$this->view->plans = $this->loadModel('productplan')->getPairsForStory($story->product, $story->branch);
$this->view->plans = $this->loadModel('productplan')->getPairsForStory($story->product, $story->branch, true);
$this->view->products = $myProducts + $othersProducts;
$this->view->branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($story->product);
$this->view->reviewers = implode(',', $reviewerList);
+1 -4
View File
@@ -108,10 +108,7 @@ foreach(explode(',', $showFields) as $field)
}
else
{
foreach($plans as $branchPlan)
{
$productPlans += $branchPlan;
}
foreach($plans as $branchPlan) $productPlans += $branchPlan;
}
?>
<?php if($this->session->currentProductType == 'normal') $productPlans = array('' => '', 'ditto' => $this->lang->story->ditto) + $productPlans;?>