* Adjust getExecutionPairsByProduct method.

This commit is contained in:
leiyong
2020-11-24 15:58:26 +08:00
parent 97ac6f0b9c
commit ac5d658933
18 changed files with 104 additions and 47 deletions
+4 -4
View File
@@ -451,7 +451,7 @@ class bug extends control
$this->view->productName = $this->products[$productID];
$this->view->moduleOptionMenu = $moduleOptionMenu;
$this->view->stories = $stories;
$this->view->projects = $this->product->getExecutionPairsByProduct($productID, $branch ? "0,$branch" : 0, $params = 'nodeleted');
$this->view->projects = $this->product->getExecutionPairsByProduct($productID, $branch ? "0,$branch" : 0);
$this->view->builds = $builds;
$this->view->moduleID = (int)$moduleID;
$this->view->projectID = $projectID;
@@ -554,7 +554,7 @@ class bug extends control
$this->view->stories = $stories;
$this->view->builds = $builds;
$this->view->users = $this->user->getPairs('devfirst|nodeleted');
$this->view->projects = $this->product->getExecutionPairsByProduct($productID, $branch ? "0,$branch" : 0, 'nodeleted');
$this->view->projects = $this->product->getExecutionPairsByProduct($productID, $branch ? "0,$branch" : 0);
$this->view->projectID = $projectID;
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch);
$this->view->moduleID = $moduleID;
@@ -727,7 +727,7 @@ class bug extends control
$this->view->plans = $this->loadModel('productplan')->getPairs($productID, $bug->branch);
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $bug->branch);
$this->view->currentModuleID = $currentModuleID;
$this->view->projects = $this->product->getExecutionPairsByProduct($bug->product, $bug->branch ? "0,{$bug->branch}" : 0, 'nodeleted');
$this->view->projects = $this->product->getExecutionPairsByProduct($bug->product, $bug->branch ? "0,{$bug->branch}" : 0);
$this->view->stories = $bug->project ? $this->story->getProjectStoryPairs($bug->project) : $this->story->getProductStoryPairs($bug->product, $bug->branch);
$this->view->branches = $this->session->currentProductType == 'normal' ? array() : $this->loadModel('branch')->getPairs($bug->product);
$this->view->tasks = $this->task->getProjectTaskPairs($bug->project);
@@ -1100,7 +1100,7 @@ class bug extends control
$this->view->bug = $bug;
$this->view->users = $users;
$this->view->assignedTo = $assignedTo;
$this->view->projects = $this->loadModel('product')->getExecutionPairsByProduct($productID, $bug->branch ? "0,{$bug->branch}" : 0, 'nodeleted');
$this->view->projects = $this->loadModel('product')->getExecutionPairsByProduct($productID, $bug->branch ? "0,{$bug->branch}" : 0);
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch = $bug->branch, 'all');
$this->view->actions = $this->action->getList('bug', $bugID);
$this->display();
+1 -1
View File
@@ -115,7 +115,7 @@ class build extends control
$execution->name = '';
}
$executions = $this->loadModel('product')->getExecutionPairsByProduct($build->product, $build->branch, 'nodeleted');
$executions = $this->loadModel('product')->getExecutionPairsByProduct($build->product, $build->branch);
if(!isset($executions[$build->project])) $executions[$build->project] = $execution->name;
$productGroups = $this->project->getProducts($build->project);
+12 -11
View File
@@ -6,17 +6,18 @@ $lang->waterfall->menuOrder[15] = 'project';
$lang->waterfall->menuOrder[20] = 'weekly';
$lang->waterfall->menuOrder[25] = 'review';
$lang->waterfall->menuOrder[30] = 'doc';
$lang->waterfall->menuOrder[35] = 'product';
$lang->waterfall->menuOrder[40] = 'design';
$lang->waterfall->menuOrder[45] = 'ci';
$lang->waterfall->menuOrder[50] = 'qa';
$lang->waterfall->menuOrder[55] = 'release';
$lang->waterfall->menuOrder[60] = 'issue';
$lang->waterfall->menuOrder[65] = 'risk';
$lang->waterfall->menuOrder[70] = 'report';
$lang->waterfall->menuOrder[75] = 'auditplan';
$lang->waterfall->menuOrder[80] = 'cm';
$lang->waterfall->menuOrder[85] = 'list';
$lang->waterfall->menuOrder[35] = 'projectstory';
$lang->waterfall->menuOrder[40] = 'product';
$lang->waterfall->menuOrder[45] = 'design';
$lang->waterfall->menuOrder[50] = 'ci';
$lang->waterfall->menuOrder[55] = 'qa';
$lang->waterfall->menuOrder[60] = 'release';
$lang->waterfall->menuOrder[65] = 'issue';
$lang->waterfall->menuOrder[70] = 'risk';
$lang->waterfall->menuOrder[75] = 'report';
$lang->waterfall->menuOrder[80] = 'auditplan';
$lang->waterfall->menuOrder[85] = 'cm';
$lang->waterfall->menuOrder[90] = 'list';
$lang->scrum->menuOrder[5] = 'program';
$lang->scrum->menuOrder[10] = 'product';
+1
View File
@@ -868,6 +868,7 @@ $lang->menu->waterfall->programplan = array('link' => '计划|programplan|brows
$lang->menu->waterfall->project = array('link' => $lang->projectCommon . '|project|task|projectID={PROJECT}', 'subModule' => ',project,task,');
$lang->menu->waterfall->weekly = array('link' => '报告|weekly|index|program={PROGRAM}', 'subModule' => ',milestone,');
$lang->menu->waterfall->doc = array('link' => '文档|doc|index|program={PROGRAM}');
$lang->menu->waterfall->projectstory = array('link' => '需求|projectstory|requirement|product={PRODUCT}', 'subModule' => 'requirement,story,');
//$lang->menu->waterfall->product = array('link' => '需求|product|browse|product={PRODUCT}', 'subModule' => ',story,');
$lang->menu->waterfall->design = '设计|design|browse|product={PRODUCT}';
$lang->menu->waterfall->ci = '代码|repo|browse|';
+1 -1
View File
@@ -640,7 +640,7 @@ class product extends control
}
else
{
$projects = $this->product->getExecutionPairsByProduct($productID, $branch ? "0,$branch" : $branch, 'nodeleted');
$projects = $this->product->getExecutionPairsByProduct($productID, $branch ? "0,$branch" : $branch);
}
if($this->app->getViewType() == 'json') die(json_encode($projects));
+21 -9
View File
@@ -758,26 +758,38 @@ class productModel extends model
*
* @param int $productID
* @param int $branch
* @param string $status all|nodeleted
* @access public
* @return array
*/
public function getExecutionPairsByProduct($productID, $branch = 0, $status = 'all')
public function getExecutionPairsByProduct($productID, $branch = 0)
{
if(!$this->session->PRJ || !$productID) return array();
$executions = $this->dao->select('t2.id, t2.name')->from(TABLE_PROJECTPRODUCT)
->alias('t1')->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
$executions = $this->dao->select('t2.id,t2.name,t2.grade,t2.parent')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->where('t1.product')->eq($productID)
->andWhere('t2.project')->eq($this->session->PRJ)
->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi()
->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->sprints)->fi()
->beginIF($status == 'nodeleted')->andWhere('t2.deleted')->eq('0')->fi()
->orderBy('t2.begin asc')
->fetchPairs();
->andWhere('t2.deleted')->eq('0')
->orderBy('t2.id desc')
->fetchAll('id');
$executions = array('0' => '') + $executions;
return $executions;
/* The waterfall project needs to show the hierarchy and remove the parent stage. */
$project = $this->loadModel('program')->getPRJByID($this->session->PRJ);
if($project->model == 'waterfall')
{
foreach($executions as $execution)
{
if($execution->parent and isset($executions[$execution->parent])) $executions[$execution->id]->name = $executions[$execution->parent]->name . '/' . $execution->name;
}
foreach($executions as $execution) if($execution->grade == 2) unset($executions[$execution->parent]);
}
$executionList = array('0' => '');
foreach($executions as $execution) $executionList[$execution->id] = $execution->name;
return $executionList;
}
/**
+1 -1
View File
@@ -36,7 +36,7 @@ $lang->program->errorSameProducts = 'Project cannot be associated with multip
$lang->program->errorNoProducts = 'At least one product is linked with the project.';
$lang->program->copyNoProject = 'There are no items available to copy.';
$lang->program->PRJSource = 'Project source:';
$lang->program->PRJStandalone = 'Standalone Projects';
$lang->program->PRJStandalone = 'Projects that do not belong to a program.';
$lang->program->tips = 'Note';
$lang->program->setTeam = 'Set Team';
$lang->program->goback = 'Go Back';
+1 -1
View File
@@ -36,7 +36,7 @@ $lang->program->errorSameProducts = 'Project cannot be associated with multip
$lang->program->errorNoProducts = 'At least one product is linked with the project.';
$lang->program->copyNoProject = 'There are no items available to copy.';
$lang->program->PRJSource = 'Project source:';
$lang->program->PRJStandalone = 'Standalone Projects';
$lang->program->PRJStandalone = 'Projects that do not belong to a program.';
$lang->program->tips = 'Note';
$lang->program->setTeam = 'Set Team';
$lang->program->goback = 'Go Back';
+1 -1
View File
@@ -36,7 +36,7 @@ $lang->program->errorSameProducts = 'Project cannot be associated with multip
$lang->program->errorNoProducts = 'At least one product is linked with the project.';
$lang->program->copyNoProject = 'There are no items available to copy.';
$lang->program->PRJSource = 'Project source:';
$lang->program->PRJStandalone = 'Standalone Projects';
$lang->program->PRJStandalone = 'Projects that do not belong to a program.';
$lang->program->tips = 'Note';
$lang->program->setTeam = 'Set Team';
$lang->program->goback = 'Go Back';
+1 -1
View File
@@ -36,7 +36,7 @@ $lang->program->errorSameProducts = 'Project cannot be associated with multip
$lang->program->errorNoProducts = 'At least one product is linked with the project.';
$lang->program->copyNoProject = 'There are no items available to copy.';
$lang->program->PRJSource = 'Project source:';
$lang->program->PRJStandalone = 'Standalone Projects';
$lang->program->PRJStandalone = 'Projects that do not belong to a program.';
$lang->program->tips = 'Note';
$lang->program->setTeam = 'Set Team';
$lang->program->goback = 'Go Back';
+1 -1
View File
@@ -36,7 +36,7 @@ $lang->program->errorSameProducts = '项目不能关联多个相同的产品
$lang->program->errorNoProducts = '项目最少关联一个产品。';
$lang->program->copyNoProject = '没有可用的项目来复制';
$lang->program->PRJSource = '项目来源:';
$lang->program->PRJStandalone = '独立项目';
$lang->program->PRJStandalone = '没有所属项目集的项目';
$lang->program->tips = '提示';
$lang->program->setTeam = '设置团队';
$lang->program->goback = '返回项目列表';
+11 -5
View File
@@ -23,22 +23,27 @@ $lang->program->PRJManagePriv = '項目維護權限';
$lang->program->PRJManageMembers = '項目團隊';
$lang->program->export = '導出';
$lang->program->PRJManageGroupMember = '維護分組用戶';
$lang->program->PRJModuleSetting = '項目集設置';
$lang->program->PRJModuleSetting = '列表設置';
$lang->program->PRJModuleOpen = '顯示項目集名';
$lang->program->PRJUpdateOrder = '排序';
$lang->program->PRJSort = '項目排序';
$lang->program->PRJWhitelist = '項目白名單';
$lang->program->PRJAddWhitelist = '項目添加白名單';
$lang->program->unbindWhielist = '項目刪除白名單';
$lang->program->PRJManageProducts = '項目關聯產品';
$lang->program->PRJManageProducts = '關聯產品';
$lang->program->copyTitle = '請選擇一個項目來複制';
$lang->program->errorSameProducts = '項目不能關聯多個相同的產品。';
$lang->program->errorNoProducts = '項目最少關聯一個產品。';
$lang->program->copyNoProject = '沒有可用的項目來複制';
$lang->program->PRJSource = '項目來源:';
$lang->program->PRJStandalone = '獨立項目';
$lang->program->PRJStandalone = '沒有所屬項目集的項目';
$lang->program->tips = '提示';
$lang->program->setTeam = '設置團隊';
$lang->program->goback = '返回項目列表';
/* Fields. */
$lang->program->common = '項目集';
$lang->program->project = '項目';
$lang->program->stage = '階段';
$lang->program->PRJName = '項目名稱';
$lang->program->PRJModel = '管理類型';
@@ -148,6 +153,7 @@ $lang->program->cannotCancelCat = "該項目下已經有子項目,無法取
$lang->program->parentBeginEnd = "父項目起止時間:%s ~ %s";
$lang->program->childLongTime = "子項目中有長期項目,父項目也應該是長期項目";
$lang->program->readjustTime = '重新調整項目起止時間';
$lang->program->afterInfo = "項目添加成功,您現在可以進行以下操作:";
$lang->program->PRJProgramTitle['0'] = '不顯示';
$lang->program->PRJProgramTitle['base'] = '只顯示一級項目集';
@@ -220,12 +226,12 @@ $lang->program->PGMShowClosed = '顯示已關閉';
$lang->program->PGMTips = '修改父項目集,可關聯產品也會發生變化,並且變為必填,如果未選擇任何項目集,則系統會預設創建一個和該項目同名的產品並關聯到該項目。';
$lang->program->PGMChangeTips = '修改父項目集後,項目已關聯的產品會被清空,並且項目下的需求、bug等數據也會受影響,是否修改?';
$lang->program->PGMAclList['open'] = "公開(有項目集視圖權限,即可訪問)";
$lang->program->PGMAclList['private'] = "私有(項目集負責人和干係人可訪問)";
$lang->program->PGMAclList['open'] = "公開(有項目集視圖權限,即可訪問)";
$lang->program->subPGMAclList['private'] = "私有(本項目集負責人和干係人可訪問)";
$lang->program->subPGMAclList['open'] = "全部公開(有項目集視圖權限,即可訪問)";
$lang->program->subPGMAclList['program'] = "項目集內公開 (所有上級項目集負責人和干係人、本項目集負責人和干係人可訪問)";
$lang->program->subPGMAclList['private'] = "私有(本項目集負責人和干係人可訪問)";
$lang->program->PGMAuthList['extend'] = '繼承(取項目權限與組織權限的並集)';
$lang->program->PGMAuthList['reset'] = '重新定義(只取項目權限)';
+11 -8
View File
@@ -52,15 +52,16 @@ class programplanModel extends model
*/
public function getStage($projectID = 0, $productID = 0, $browseType = 'all', $orderBy = 'id_asc')
{
$executions = empty($projectID) ? array() : $this->loadModel('product')->getExecutionPairsByProduct($productID);
if(empty($projectID) || empty($productID)) return array();
$plans = $this->dao->select('*')->from(TABLE_PROJECT)
->where('type')->eq('stage')
->beginIF($browseType == 'all')->andWhere('project')->eq($projectID)->fi()
->beginIF($browseType == 'parent')->andWhere('parent')->eq($projectID)->fi()
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->sprints)->fi()
->beginIF($productID)->andWhere('id')->in(array_keys($executions))->fi()
->andWhere('deleted')->eq(0)
$plans = $this->dao->select('t2.*')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->where('t1.product')->eq($productID)
->andWhere('t2.type')->eq('stage')
->beginIF($browseType == 'all')->andWhere('t2.project')->eq($projectID)->fi()
->beginIF($browseType == 'parent')->andWhere('t2.parent')->eq($projectID)->fi()
->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->sprints)->fi()
->andWhere('t2.deleted')->eq('0')
->orderBy($orderBy)
->fetchAll('id');
@@ -663,6 +664,8 @@ class programplanModel extends model
$childrenTotalPercent = $this->getTotalPercent($parentPlan, true);
$childrenTotalPercent = $plan->parent == $oldPlan->parent ? ($childrenTotalPercent - $oldPlan->percent + $plan->percent) : ($childrenTotalPercent + $plan->percent);
/* The sum of the workload of the child phases cannot be greater than that of the parent phase. */
if($childrenTotalPercent > $parentPercent)
{
dao::$errors['message'][] = sprintf($this->lang->programplan->error->parentWorkload, $parentPercent . '%');
+2
View File
@@ -0,0 +1,2 @@
<?php
+15
View File
@@ -0,0 +1,15 @@
<?php
/**
* The control file of projectStory module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package projectStory
* @version $Id: control.php 5094 2013-07-10 08:46:15Z chencongzhi520@gmail.com $
* @link http://www.zentao.net
*/
class projectStory extends control
{
}
+2
View File
@@ -0,0 +1,2 @@
<?php
+15
View File
@@ -0,0 +1,15 @@
<?php
/**
* The model file of projectStory module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package projectStory
* @version $Id: model.php 5118 2013-07-12 07:41:41Z chencongzhi520@gmail.com $
* @link http://www.zentao.net
*/
class projectStory extends model()
{
}
+3 -3
View File
@@ -164,7 +164,7 @@ class testtask extends control
/* Create testtask from testtask of test.*/
$productID = $productID ? $productID : key($this->products);
$projects = empty($productID) ? array() : $this->product->getExecutionPairsByProduct($productID, 0, $params = 'nodeleted');
$projects = empty($productID) ? array() : $this->product->getExecutionPairsByProduct($productID);
$builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk', true);
/* Set menu. */
@@ -592,7 +592,7 @@ class testtask extends control
/* Create testtask from testtask of test.*/
$productID = $productID ? $productID : key($this->products);
$projects = empty($productID) ? array() : $this->product->getExecutionPairsByProduct($productID, 0, $params = 'nodeleted');
$projects = empty($productID) ? array() : $this->product->getExecutionPairsByProduct($productID);
$builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk', true);
$this->view->task = $task;
@@ -1162,7 +1162,7 @@ class testtask extends control
$this->app->loadLang('job');
$productID = $productID ? $productID : key($this->products);
$projects = empty($productID) ? array() : $this->product->getExecutionPairsByProduct($productID, 0, $params = 'nodeleted');
$projects = empty($productID) ? array() : $this->product->getExecutionPairsByProduct($productID);
$builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk');
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->importUnitResult;