From f94a272a2c8c35f2e59c4d6ee472f458ecbd417c Mon Sep 17 00:00:00 2001 From: zhujinyong Date: Mon, 22 Mar 2021 10:43:17 +0800 Subject: [PATCH] + Add branch menu of product. --- module/branch/control.php | 8 +------- module/common/lang/menu.php | 2 +- module/product/model.php | 10 ++++++++++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/module/branch/control.php b/module/branch/control.php index 2606058728..f44b5ef748 100644 --- a/module/branch/control.php +++ b/module/branch/control.php @@ -20,11 +20,7 @@ class branch extends control */ public function manage($productID) { - $this->lang->product->switcherMenu = $this->loadModel('product')->getSwitcher($productID); - - $moduleIndex = array_search('branch', $this->lang->noMenuModule); - if($moduleIndex !== false) unset($this->lang->noMenuModule[$moduleIndex]); - $this->lang->branch->menu = $this->lang->product->setMenu; + $this->loadModel('product')->setMenu($productID); if($_POST) { @@ -33,8 +29,6 @@ class branch extends control } $products = $this->loadModel('product')->getPairs('nocode'); - $this->product->setMenu($products, $productID); - $position[] = html::a($this->createLink('product', 'browse', "productID=$productID"), zget($products, $productID)); $position[] = $this->lang->branch->manage; diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php index 16bef330f0..e869c28d09 100644 --- a/module/common/lang/menu.php +++ b/module/common/lang/menu.php @@ -138,7 +138,7 @@ $lang->product->menuOrder[65] = 'all'; $lang->product->menu->settings['subMenu'] = new stdclass(); $lang->product->menu->settings['subMenu']->view = array('link' => "{$lang->overview}|product|view|productID=%s", 'alias' => 'edit'); $lang->product->menu->settings['subMenu']->module = array('link' => "{$lang->module}|tree|browse|product=%s&view=story", 'subModule' => 'tree'); -// $lang->product->menu->settings['subMenu']->branch = array('link' => "@branch@|branch|manage|product=%s", 'subModule' => 'branch'); +$lang->product->menu->settings['subMenu']->branch = array('link' => "@branch@|branch|manage|product=%s", 'subModule' => 'branch'); $lang->product->menu->settings['subMenu']->whitelist = array('link' => "{$lang->whitelist}|product|whitelist|product=%s", 'subModule' => 'personnel'); $lang->product->dividerMenu = $config->URAndSR ? ',requirement,set,' : ',track,set,'; diff --git a/module/product/model.php b/module/product/model.php index ac36c79dad..1bcd27a152 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -1685,5 +1685,15 @@ class productModel extends model $this->lang->switcherMenu = $this->getSwitcher($productID, $extra, $branch); $params = array('branch' => $branch); common::setMenuVars('product', $productID, $params); + + if($product->type == 'normal') + { + unset($this->lang->product->menu->settings['subMenu']->branch); + } + else + { + $branchLink = $this->lang->product->menu->settings['subMenu']->branch['link']; + $this->lang->product->menu->settings['subMenu']->branch['link'] = str_replace('@branch@', $this->lang->product->branchName[$product->type], $branchLink); + } } }