From 0cae24f3ef4de4d4659938396a7a7b31b7ed1dae Mon Sep 17 00:00:00 2001 From: qiyu-xie Date: Thu, 25 Feb 2021 09:50:04 +0800 Subject: [PATCH 1/8] * When merged product lines, default selected first products. --- module/upgrade/js/mergeprogram.js | 5 ++++- module/upgrade/view/mergebyline.html.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/module/upgrade/js/mergeprogram.js b/module/upgrade/js/mergeprogram.js index b1194e1ba5..621a31c5c7 100644 --- a/module/upgrade/js/mergeprogram.js +++ b/module/upgrade/js/mergeprogram.js @@ -60,7 +60,10 @@ $(function() $('.lineBox').addClass('hidden'); $(target).removeClass('hidden'); $('#source').find('.lineBox :checkBox').prop('checked', false); - $(target).find(":checkbox").prop('checked', true); + + /* The first group of products is selected by default. */ + var firstProduct = $(target).find(":checkbox:first").prop('checked', true); + $('[data-product=' + firstProduct.val() + ']').prop('checked', true); /* Replace program name. */ $('#PGMName').val($(this).text()); diff --git a/module/upgrade/view/mergebyline.html.php b/module/upgrade/view/mergebyline.html.php index 85235cd073..d61b16ea7f 100644 --- a/module/upgrade/view/mergebyline.html.php +++ b/module/upgrade/view/mergebyline.html.php @@ -51,9 +51,9 @@ + - From 567b25678b6282e78fba8c8d147a55a68efdc412 Mon Sep 17 00:00:00 2001 From: hufangzhou <746775970@qq.com> Date: Thu, 25 Feb 2021 10:04:25 +0800 Subject: [PATCH 2/8] * Fix an error. --- module/common/lang/de.php | 1 + module/common/lang/en.php | 1 + module/common/lang/fr.php | 1 + module/common/lang/vi.php | 1 + module/common/lang/zh-cn.php | 1 + 5 files changed, 5 insertions(+) diff --git a/module/common/lang/de.php b/module/common/lang/de.php index b4eb551631..3749f809e7 100644 --- a/module/common/lang/de.php +++ b/module/common/lang/de.php @@ -936,6 +936,7 @@ $lang->menu->scrum->projectbuild = array('link' => 'Build|projectbuild|browse| $lang->menu->scrum->projectrelease = array('link' => 'Release|projectrelease|browse'); $lang->menu->scrum->projectsetting = array('link' => 'Setting|program|prjview|project={PROJECT}', 'alias' => 'prjedit,prjmanageproducts,prjgroup,prjmanagemembers,prjmanageview,prjmanagepriv,prjwhitelist,prjaddwhitelist'); +$lang->scrum = new stdclass(); $lang->scrum->setMenu = new stdclass(); $lang->scrum->setMenu->view = array('link' => 'View|program|prjview|project={PROJECT}'); $lang->scrum->setMenu->products = array('link' => 'Product|program|PRJManageProducts|project={PROJECT}', 'alias' => 'prjmanageproducts'); diff --git a/module/common/lang/en.php b/module/common/lang/en.php index b75d99008e..07dfc4558c 100644 --- a/module/common/lang/en.php +++ b/module/common/lang/en.php @@ -936,6 +936,7 @@ $lang->menu->scrum->projectbuild = array('link' => 'Build|projectbuild|browse| $lang->menu->scrum->projectrelease = array('link' => 'Release|projectrelease|browse'); $lang->menu->scrum->projectsetting = array('link' => 'Setting|program|prjview|project={PROJECT}', 'alias' => 'prjedit,prjmanageproducts,prjgroup,prjmanagemembers,prjmanageview,prjmanagepriv,prjwhitelist,prjaddwhitelist'); +$lang->scrum = new stdclass(); $lang->scrum->setMenu = new stdclass(); $lang->scrum->setMenu->view = array('link' => 'View|program|prjview|project={PROJECT}'); $lang->scrum->setMenu->products = array('link' => 'Product|program|PRJManageProducts|project={PROJECT}', 'alias' => 'prjmanageproducts'); diff --git a/module/common/lang/fr.php b/module/common/lang/fr.php index 70d5edfbbf..63f6137ecb 100644 --- a/module/common/lang/fr.php +++ b/module/common/lang/fr.php @@ -936,6 +936,7 @@ $lang->menu->scrum->projectbuild = array('link' => 'Build|projectbuild|browse| $lang->menu->scrum->projectrelease = array('link' => 'Release|projectrelease|browse'); $lang->menu->scrum->projectsetting = array('link' => 'Setting|program|prjview|project={PROJECT}', 'alias' => 'prjedit,prjmanageproducts,prjgroup,prjmanagemembers,prjmanageview,prjmanagepriv,prjwhitelist,prjaddwhitelist'); +$lang->scrum = new stdclass(); $lang->scrum->setMenu = new stdclass(); $lang->scrum->setMenu->view = array('link' => 'View|program|prjview|project={PROJECT}'); $lang->scrum->setMenu->products = array('link' => 'Product|program|PRJManageProducts|project={PROJECT}', 'alias' => 'prjmanageproducts'); diff --git a/module/common/lang/vi.php b/module/common/lang/vi.php index 7115a32b9a..68204ef4e1 100644 --- a/module/common/lang/vi.php +++ b/module/common/lang/vi.php @@ -936,6 +936,7 @@ $lang->menu->scrum->projectbuild = array('link' => 'Build|projectbuild|browse| $lang->menu->scrum->projectrelease = array('link' => 'Release|projectrelease|browse'); $lang->menu->scrum->projectsetting = array('link' => 'Setting|program|prjview|project={PROJECT}', 'alias' => 'prjedit,prjmanageproducts,prjgroup,prjmanagemembers,prjmanageview,prjmanagepriv,prjwhitelist,prjaddwhitelist'); +$lang->scrum = new stdclass(); $lang->scrum->setMenu = new stdclass(); $lang->scrum->setMenu->view = array('link' => 'View|program|prjview|project={PROJECT}'); $lang->scrum->setMenu->products = array('link' => 'Product|program|PRJManageProducts|project={PROJECT}', 'alias' => 'prjmanageproducts'); diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index 568b33220a..36c67de2a0 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -934,6 +934,7 @@ $lang->menu->scrum->projectbuild = array('link' => '版本|projectbuild|browse $lang->menu->scrum->projectrelease = array('link' => '发布|projectrelease|browse'); $lang->menu->scrum->projectsetting = array('link' => '设置|program|prjview|project={PROJECT}', 'alias' => 'prjedit,prjmanageproducts,prjgroup,prjmanagemembers,prjmanageview,prjmanagepriv,prjwhitelist,prjaddwhitelist'); +$lang->scrum = new stdclass(); $lang->scrum->setMenu = new stdclass(); $lang->scrum->setMenu->view = array('link' => '概况|program|prjview|project={PROJECT}', 'alias' => 'prjedit'); $lang->scrum->setMenu->products = array('link' => '产品|program|PRJManageProducts|project={PROJECT}', 'alias' => 'prjmanageproducts'); From 894a3c6a334d44a1051bb1ff860a461604c7693c Mon Sep 17 00:00:00 2001 From: hufangzhou <746775970@qq.com> Date: Thu, 25 Feb 2021 10:18:07 +0800 Subject: [PATCH 3/8] * Adjust the code. --- module/testsuite/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/testsuite/model.php b/module/testsuite/model.php index b98f13c1b5..dad4a1bb49 100644 --- a/module/testsuite/model.php +++ b/module/testsuite/model.php @@ -133,7 +133,7 @@ class testsuiteModel extends model { return $this->dao->select("*")->from(TABLE_TESTSUITE) ->where('product')->eq((int)$productID) - ->andWhere('PRJ')->eq($this->session->PRJ) + ->beginIF($this->lang->navGroup->testsuite != 'qa')->andWhere('PRJ')->eq($this->session->PRJ)->fi() ->andWhere('deleted')->eq(0) ->andWhere("(`type` = 'public' OR (`type` = 'private' and addedBy = '{$this->app->user->account}'))") ->orderBy($orderBy) From 28573a0b2aae7a15849d758ca88e0b7978f75f58 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Thu, 25 Feb 2021 10:19:11 +0800 Subject: [PATCH 4/8] * Update sprints history. --- module/upgrade/control.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/module/upgrade/control.php b/module/upgrade/control.php index 935612ee20..e9e8096203 100644 --- a/module/upgrade/control.php +++ b/module/upgrade/control.php @@ -305,7 +305,9 @@ class upgrade extends control $hourPoint = $this->loadModel('setting')->getItem('owner=system&module=custom&key=hourPoint'); if(empty($hourPoint)) $this->setting->setItem('system.custom.hourPoint', 0); - $this->dao->update(TABLE_ACTION)->set('objectType')->eq('execution')->where('objectType')->eq('project')->exec(); + /* Update sprints history. */ + $sprints = $this->dao->select('id')->from(TABLE_PROJECT)->where('type')->eq('sprint')->fetchAll(); + $this->dao->update(TABLE_ACTION)->set('objectType')->eq('execution')->where('objectID')->in(array_keys($sprints))->exec(); die(js::locate($this->createLink('upgrade', 'mergeRepo'))); } From e6cbb7ca6d33ec06582b19bf187d24485d4e9b11 Mon Sep 17 00:00:00 2001 From: hufangzhou <746775970@qq.com> Date: Thu, 25 Feb 2021 10:30:37 +0800 Subject: [PATCH 5/8] * Adjust the code. --- module/testreport/model.php | 4 ++-- module/testsuite/model.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module/testreport/model.php b/module/testreport/model.php index ab67c5ef5a..15bc4f4b8d 100644 --- a/module/testreport/model.php +++ b/module/testreport/model.php @@ -57,7 +57,7 @@ class testreportModel extends model { $data = fixer::input('post') ->stripTags($this->config->testreport->editor->create['id'], $this->config->allowedTags) - ->add('PRJ', $this->session->PRJ) + ->setIF($this->lang->navGroup->testreport != 'qa', 'PRJ', $this->session->PRJ) ->add('createdBy', $this->app->user->account) ->add('createdDate', helper::now()) ->join('stories', ',') @@ -149,7 +149,7 @@ class testreportModel extends model { $objectID = (int)$objectID; return $this->dao->select('*')->from(TABLE_TESTREPORT)->where('deleted')->eq(0) - ->andWhere('PRJ')->eq($this->session->PRJ) + ->beginIF($this->lang->navGroup->testreport != 'qa')->andWhere('PRJ')->eq($this->session->PRJ)->fi() ->beginIF($objectType == 'project')->andWhere('objectID')->eq($objectID)->andWhere('objectType')->eq('project')->fi() ->beginIF($objectType == 'product' and $extra)->andWhere('objectID')->eq((int)$extra)->andWhere('objectType')->eq('testtask')->fi() ->beginIF($objectType == 'product' and empty($extra))->andWhere('product')->eq($objectID)->fi() diff --git a/module/testsuite/model.php b/module/testsuite/model.php index dad4a1bb49..a09c797328 100644 --- a/module/testsuite/model.php +++ b/module/testsuite/model.php @@ -101,7 +101,7 @@ class testsuiteModel extends model { $suite = fixer::input('post') ->stripTags($this->config->testsuite->editor->create['id'], $this->config->allowedTags) - ->add('PRJ', $this->session->PRJ) + ->setIF($this->lang->navGroup->testsuite != 'qa', 'PRJ', $this->session->PRJ) ->add('product', (int)$productID) ->add('addedBy', $this->app->user->account) ->add('addedDate', helper::now()) From 73f991ba4842362bad289ce24a5ec4b4ce4a232c Mon Sep 17 00:00:00 2001 From: leiyong <1549684884@qq.com> Date: Thu, 25 Feb 2021 10:36:37 +0800 Subject: [PATCH 6/8] * Adjust code. --- module/product/model.php | 61 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 6 deletions(-) diff --git a/module/product/model.php b/module/product/model.php index 24002521e5..4f05e02c3f 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -957,29 +957,30 @@ class productModel extends model * @param int $productID * @param int $branch * @param string $orderBy + * @param int $projectID * @access public * @return array */ - public function getExecutionPairsByProduct($productID, $branch = 0, $orderBy = 'id_asc') + public function getExecutionPairsByProduct($productID, $branch = 0, $orderBy = 'id_asc', $projectID = 0) { - if(!$this->session->PRJ || !$productID) return array(); + if($productID) return array(); + if(empty($projectID)) return $this->getAllExecutionPairsByProduct($productID, $branch); - $project = $this->loadModel('program')->getPRJByID($this->session->PRJ); + $project = $this->loadModel('program')->getPRJByID($projectID); $orderBy = $project->model == 'waterfall' ? 'begin_asc,id_asc' : 'begin_desc,id_desc'; $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) + ->andWhere('t2.project')->eq($projectID) ->beginIF($branch)->andWhere('t1.branch')->in($branch)->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'); - $executionList = array('0' => ''); - /* The waterfall project needs to show the hierarchy and remove the parent stage. */ + $executionList = array('0' => ''); if($project->model == 'waterfall') { foreach($executions as $id => $execution) @@ -1010,6 +1011,54 @@ class productModel extends model return $executionList; } + /** + * Get execution pairs by product. + * + * @param int $productID + * @param int $branch + * @access public + * @return array + */ + public function getAllExecutionPairsByProduct($productID, $branch = 0) + { + if(empty($productID)) return array(); + $executions = $this->dao->select('t2.id,t2.project,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.type')->in('stage,sprint') + ->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi() + ->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->sprints)->fi() + ->andWhere('t2.deleted')->eq('0') + ->fetchAll('id'); + + $projectIdList = array(); + foreach($executions as $id => $execution) $projectIdList[$execution->project] = $execution->project; + + $executionPairs = array(); + $projectPairs = $this->loadModel('program')->getPRJPairsByIdList($projectIdList); + foreach($executions as $id => $execution) + { + if($execution->grade == 2 && isset($executions[$execution->parent])) + { + $execution->name = $projectPairs[$execution->project] . '/' . $executions[$execution->parent]->name . '/' . $execution->name; + $executions[$execution->parent]->children[$id] = $execution->name; + unset($executions[$id]); + } + } + + foreach($executions as $execution) + { + if(isset($execution->children)) + { + $executionPairs = $executionPairs + $execution->children; + continue; + } + $executionPairs[$execution->id] = $projectPairs[$execution->project] . '/' . $execution->name; + } + + return $executionPairs; + } + /** * Get roadmap of a proejct. * From be7b0343cffdbf5c8c21de6e45cf884aae6029db Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Thu, 25 Feb 2021 10:49:58 +0800 Subject: [PATCH 7/8] * Fix bug. --- module/upgrade/control.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/upgrade/control.php b/module/upgrade/control.php index cce5dc74f8..b98140138c 100644 --- a/module/upgrade/control.php +++ b/module/upgrade/control.php @@ -306,8 +306,8 @@ class upgrade extends control if(empty($hourPoint)) $this->setting->setItem('system.custom.hourPoint', 0); /* Update sprints history. */ - $sprints = $this->dao->select('id')->from(TABLE_PROJECT)->where('type')->eq('sprint')->fetchAll(); - $this->dao->update(TABLE_ACTION)->set('objectType')->eq('execution')->where('objectID')->in(array_keys($sprints))->exec(); + $sprints = $this->dao->select('id')->from(TABLE_PROJECT)->where('type')->eq('sprint')->fetchAll('id'); + $this->dao->update(TABLE_ACTION)->set('objectType')->eq('execution')->where('objectID')->in(array_keys($sprints))->andWhere('objectType')->eq('project')->exec(); die(js::locate($this->createLink('upgrade', 'mergeRepo'))); } From 9d1157c813455e97e8445aa5be5faa374eab3832 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Thu, 25 Feb 2021 10:54:02 +0800 Subject: [PATCH 8/8] * Fix bug. --- module/program/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/program/model.php b/module/program/model.php index 9f6f7a52bf..53036f9182 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -1745,7 +1745,7 @@ class programModel extends model { foreach($_POST['products'] as $productID => $product) { - $this->dao->update(TABLE_PRODUCT)->set('program')->eq($newTopPGM)->where('id')->eq((int)$productID)->exec(); + $this->dao->update(TABLE_PRODUCT)->set('program')->eq((int)$newTopPGM)->where('id')->eq((int)$productID)->exec(); } }