From 227d6c8211cb8a4870d6e8ba31d0c0b19fc4c937 Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Mon, 2 Nov 2020 14:31:21 +0800 Subject: [PATCH] * Adjust code detail. --- module/bug/control.php | 4 ++-- module/common/lang/zh-cn.php | 6 +++--- module/group/lang/resource.php | 8 ++++---- module/product/control.php | 5 +++-- module/product/model.php | 16 +++++++++++++--- module/program/view/pgmbrowsebylist.html.php | 2 +- module/project/model.php | 1 - module/testcase/control.php | 2 +- module/testreport/control.php | 2 +- module/testsuite/control.php | 8 ++++---- module/testtask/control.php | 8 ++++---- 11 files changed, 36 insertions(+), 26 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index cf3abb961a..baaa43cc58 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -31,7 +31,7 @@ class bug extends control $this->loadModel('action'); $this->loadModel('story'); $this->loadModel('task'); - $this->view->products = $this->products = $this->product->getPairs('nocode'); + $this->view->products = $this->products = $this->product->getProductsByProject($this->session->PRJ); if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "fromModule=bug"))); } @@ -439,7 +439,7 @@ class bug extends control $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch); if(empty($moduleOptionMenu)) die(js::locate(helper::createLink('tree', 'browse', "productID=$productID&view=story"))); - $productList = $this->product->getOrderedProducts('all'); + $productList = $this->product->getOrderedProducts('all', 40, $this->session->PRJ); foreach($productList as $product) $products[$product->id] = $product->name; /* Set custom. */ diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index ec2bc8f9c5..0a9fdc2929 100755 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -130,7 +130,7 @@ if($config->URAndSR) /* 主导航菜单。*/ $lang->mainNav = new stdclass(); $lang->mainNav->my = ' 地盘|my|index|'; -$lang->mainNav->program = ' 项目集|program|pgmindex|'; +$lang->mainNav->program = ' 项目集|program|pgmbrowse|'; $lang->mainNav->product = ' 产品|product|index|'; $lang->mainNav->project = ' 项目|program|prjbrowse|'; $lang->mainNav->system = ' 组织|custom|estimate|'; @@ -142,11 +142,11 @@ $lang->dividerMenu = ',admin,'; /* Program set menu. */ $lang->program = new stdclass(); $lang->program->menu = new stdclass(); -$lang->program->menu->index = '主页|program|pgmindex|'; +//$lang->program->menu->index = '主页|program|pgmindex|'; $lang->program->menu->browse = array('link' => '项目集|program|pgmbrowse|', 'alias' => 'pgmcreate,pgmedit,pgmgroup,pgmmanagepriv,pgmmanageview,pgmmanagemembers'); $lang->program->viewMenu = new stdclass(); -$lang->program->viewMenu->view = array('link' => '概况|program|pgmview|program=%s'); +//$lang->program->viewMenu->view = array('link' => '概况|program|pgmview|program=%s'); $lang->program->viewMenu->product = array('link' => '产品|program|pgmproduct|program=%s'); $lang->program->viewMenu->project = array('link' => "项目|program|pgmproject|program=%s"); $lang->program->viewMenu->personnel = array('link' => "人员|personnel|accessible|program=%s"); diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index fe8e3eb9e3..0dd6e63922 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -161,12 +161,12 @@ $lang->todo->methodOrder[80] = 'batchClose'; /* Program. */ $lang->resource->program = new stdclass(); $lang->resource->program->createGuide = 'createGuide'; -$lang->resource->program->PGMIndex = 'PGMIndex'; +//$lang->resource->program->PGMIndex = 'PGMIndex'; $lang->resource->program->PGMBrowse = 'PGMBrowse'; $lang->resource->program->PGMProduct = 'PGMProduct'; $lang->resource->program->PGMCreate = 'PGMCreate'; $lang->resource->program->PGMEdit = 'PGMEdit'; -$lang->resource->program->PGMView = 'PGMView'; +//$lang->resource->program->PGMView = 'PGMView'; $lang->resource->program->PGMClose = 'PGMClose'; $lang->resource->program->PGMActivate = 'PGMActivate'; $lang->resource->program->PGMDelete = 'PGMDelete'; @@ -200,12 +200,12 @@ $lang->resource->program->unbindWhielist = 'unbindWhielist'; $lang->resource->program->PRJManageProducts = 'PRJManageProducts'; $lang->program->methodOrder[0] = 'createGuide'; -$lang->program->methodOrder[5] = 'PGMIndex'; +//$lang->program->methodOrder[5] = 'PGMIndex'; $lang->program->methodOrder[10] = 'PGMBrowse'; $lang->program->methodOrder[15] = 'PGMProduct'; $lang->program->methodOrder[20] = 'PGMCreate'; $lang->program->methodOrder[25] = 'PGMEdit'; -$lang->program->methodOrder[30] = 'PGMView'; +//$lang->program->methodOrder[30] = 'PGMView'; $lang->program->methodOrder[35] = 'PGMClose'; $lang->program->methodOrder[40] = 'PGMActivate'; $lang->program->methodOrder[45] = 'PGMDelete'; diff --git a/module/product/control.php b/module/product/control.php index 669c1b090c..d6adb1d68b 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -700,11 +700,12 @@ class product extends control $this->view->module = $module; $this->view->method = $method; $this->view->extra = $extra; - $products = $this->product->getProductsByProject($this->session->PRJ); + $products = $this->product->getProductsByProject($this->session->PRJ); $product = $this->product->getByID($productID); + $this->view->products = $this->dao->select('*')->from(TABLE_PRODUCT)->where('id')->in(array_keys($products))->orderBy('`order` desc')->fetchAll('id'); - $this->view->programID = $product->program; + $this->view->programID = $this->session->PRJ; $this->display(); } diff --git a/module/product/model.php b/module/product/model.php index c5588ab604..c797e6cf39 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -138,7 +138,7 @@ class productModel extends model if($isMobile) $output = "{$currentProduct->name} "; if($currentProduct->type == 'normal') unset($this->lang->product->menu->branch); - if($currentProduct->type != 'normal') + if($currentProduct->type != 'normal' && $currentModule != 'programplan') { $this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$currentProduct->type]); $this->lang->product->menu->branch = str_replace('@branch@', $this->lang->product->branchName[$currentProduct->type], $this->lang->product->branch); @@ -358,9 +358,19 @@ class productModel extends model * @access public * @return array */ - public function getOrderedProducts($status, $num = 0) + public function getOrderedProducts($status, $num = 0, $projectID = 0) { - $products = $this->getList($this->session->program, $status); + $products = array(); + if($projectID) + { + $pairs = $this->getProductsByProject($this->session->PRJ); + $products = $this->getByIdList(array_keys($pairs)); + } + else + { + $products = $this->getList('', $status, $num); + } + if(empty($products)) return $products; $lines = $this->loadModel('tree')->getLinePairs($useShort = true); diff --git a/module/program/view/pgmbrowsebylist.html.php b/module/program/view/pgmbrowsebylist.html.php index a2d5b6dd61..203081020a 100644 --- a/module/program/view/pgmbrowsebylist.html.php +++ b/module/program/view/pgmbrowsebylist.html.php @@ -50,7 +50,7 @@ type == 'program'):?> - createLink('program', 'pgmview', "programID=$program->id"), " " . $program->name);?> + createLink('program', 'pgmproduct', "programID=$program->id"), " " . $program->name);?> createLink('program', 'index', "programID=$program->id", '', '', $program->id), " " . $program->name);?> diff --git a/module/project/model.php b/module/project/model.php index 3e6de92af8..989db162c3 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -736,7 +736,6 @@ class projectModel extends model /* Order by status's content whether or not done */ $projects = $this->dao->select('*, IF(INSTR(" done,closed", status) < 2, 0, 1) AS isDone')->from(TABLE_PROJECT) ->where('deleted')->eq(0) - ->andWhere('grade')->eq(1) ->beginIF($programID)->andWhere('project')->eq($programID)->fi() ->beginIF(strpos($mode, 'withdelete') === false)->andWhere('deleted')->eq(0)->fi() ->beginIF(!$this->app->user->admin and strpos($mode, 'all') === false)->andWhere('id')->in($this->app->user->view->sprints)->fi() diff --git a/module/testcase/control.php b/module/testcase/control.php index 6e91e59824..930c585c17 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -25,7 +25,7 @@ class testcase extends control $this->loadModel('product'); $this->loadModel('tree'); $this->loadModel('user'); - $this->view->products = $this->products = $this->product->getPairs('nocode'); + $this->view->products = $this->products = $this->product->getProductsByProject($this->session->PRJ); if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "fromModule=testcase"))); } diff --git a/module/testreport/control.php b/module/testreport/control.php index 2f05576c59..ff35b9d5e8 100644 --- a/module/testreport/control.php +++ b/module/testreport/control.php @@ -520,7 +520,7 @@ class testreport extends control { if($objectType == 'product') { - $this->products = $this->product->getPairs('nocode'); + $this->products = $this->product->getProductsByProject($this->session->PRJ); $productID = $this->product->saveState($objectID, $this->products); $this->testreport->setMenu($this->products, $productID); return $productID; diff --git a/module/testsuite/control.php b/module/testsuite/control.php index 328fea31b3..88303150ea 100644 --- a/module/testsuite/control.php +++ b/module/testsuite/control.php @@ -41,7 +41,7 @@ class testsuite extends control $this->session->set('testsuiteList', $this->app->getURI(true)); /* Set menu. */ - $this->view->products = $this->products = $this->loadModel('product')->getPairs('nocode'); + $this->view->products = $this->products = $this->loadModel('product')->getProductsByProject($this->session->PRJ); $productID = $this->product->saveState($productID, $this->products); $this->testsuite->setMenu($this->products, $productID); @@ -49,6 +49,9 @@ class testsuite extends control $this->app->loadClass('pager', $static = true); $pager = pager::init($recTotal, $recPerPage, $pageID); + /* Append id for secend sort. */ + $sort = $this->loadModel('common')->appendOrder($orderBy); + $suites = $this->testsuite->getSuites($productID, $sort, $pager); if(empty($suites) and $pageID > 1) { @@ -56,10 +59,7 @@ class testsuite extends control $suites = $this->testsuite->getSuites($productID, $sort, $pager); } - /* Append id for secend sort. */ - $sort = $this->loadModel('common')->appendOrder($orderBy); $productName = isset($this->products[$productID]) ? $this->products[$productID] : ''; - $suites = $this->testsuite->getSuites($productID, $sort, $pager); $this->view->title = $productName . $this->lang->testsuite->common; diff --git a/module/testtask/control.php b/module/testtask/control.php index ab4385fec0..765cc1b4b5 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -23,7 +23,7 @@ class testtask extends control { parent::__construct($moduleName, $methodName); $this->loadModel('product'); - $this->view->products = $this->products = $this->product->getPairs('nocode'); + $this->view->products = $this->products = $this->product->getProductsByProject($this->session->PRJ); if(empty($this->products)) die($this->locate($this->createLink('product', 'showErrorNone', "fromModule=testtask"))); } @@ -72,6 +72,9 @@ class testtask extends control $this->app->loadClass('pager', $static = true); $pager = pager::init($recTotal, $recPerPage, $pageID); + /* Append id for secend sort. */ + $sort = $this->loadModel('common')->appendOrder($orderBy); + /* Get tasks. */ $tasks = $this->testtask->getProductTasks($productID, $branch, $sort, $pager, $scopeAndStatus, $beginTime, $endTime); if(empty($tasks) and $pageID > 1) @@ -80,9 +83,6 @@ class testtask extends control $tasks = $this->testtask->getProductTasks($productID, $branch, $sort, $pager, $scopeAndStatus, $beginTime, $endTime); } - /* Append id for secend sort. */ - $sort = $this->loadModel('common')->appendOrder($orderBy); - /* Get tasks. */ $tasks = $this->testtask->getProductTasks($productID, $branch, $sort, $pager, $scopeAndStatus, $beginTime, $endTime);