From 515dd085c4d406621c7dc115d718596f7f1f9307 Mon Sep 17 00:00:00 2001 From: zenggang Date: Tue, 8 Mar 2022 09:40:28 +0000 Subject: [PATCH 01/53] * Adjust code --- lib/scm/gitlab.class.php | 2 +- module/repo/model.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/scm/gitlab.class.php b/lib/scm/gitlab.class.php index e5645e816c..861bffbd95 100644 --- a/lib/scm/gitlab.class.php +++ b/lib/scm/gitlab.class.php @@ -646,7 +646,7 @@ class gitlab $param = new stdclass(); $param->path = urldecode($path); - $param->ref_name = $fromRevision ? $fromRevision : $this->branch; + $param->ref_name = $toRevision ? $toRevision : $this->branch; $fromDate = $this->getCommittedDate($fromRevision); $toDate = $this->getCommittedDate($toRevision); diff --git a/module/repo/model.php b/module/repo/model.php index ab12ca3c29..2f13bb5f2e 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -882,7 +882,7 @@ class repoModel extends model $scm = $this->app->loadClass('scm'); $scm->setEngine($repo); - $logs = $scm->log('', $lastInDB ? $lastInDB->revision : 0); + $logs = $scm->log('', $lastInDB ? $lastInDB->revision : 0, ''); if(empty($logs)) return false; /* Process logs. */ From 5ea6b2650087e5eefb65466689f3c5b63c64db2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Wed, 9 Mar 2022 08:47:24 +0800 Subject: [PATCH 02/53] * Code for upgrade check table. --- module/upgrade/control.php | 2 +- module/upgrade/model.php | 20 +++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/module/upgrade/control.php b/module/upgrade/control.php index bcada683c5..bc1eb04805 100644 --- a/module/upgrade/control.php +++ b/module/upgrade/control.php @@ -703,7 +703,7 @@ class upgrade extends control */ public function afterExec($fromVersion, $processed = 'no', $skipMoveFile = 'no') { - $alterSQL = $this->upgrade->checkConsistency($this->config->version); + $alterSQL = $this->upgrade->checkConsistency($fromVersion); if(!empty($alterSQL)) { $this->view->title = $this->lang->upgrade->consistency; diff --git a/module/upgrade/model.php b/module/upgrade/model.php index f17ea6990f..497d18a345 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -1101,25 +1101,27 @@ class upgradeModel extends model /** * Check consistency. * - * @param string $version + * @param string $fromVersion * @access public * @return string */ - public function checkConsistency($version = '') + public function checkConsistency($fromVersion = '') { - if(empty($version)) $version = $this->config->installedVersion; + if(empty($fromVersion)) $fromVersion = $this->config->installedVersion; + + $editions = array('p' => 'proVersion', 'b' => 'bizVersion', 'm' => 'maxVersion'); + $fromEdition = is_numeric($fromVersion[0]) ? 'open' : $editions[$fromVersion[0]]; + $openVersion = is_numeric($fromVersion[0]) ? $fromVersion : $this->config->upgrade->{$fromEdition}[$fromVersion]; + $openVersion = str_replace('_', '.', $openVersion); + $alterSQL = ''; - $standardSQL = $this->app->getAppRoot() . 'db' . DS . 'standard' . DS . 'zentao' . $version . '.sql'; + $standardSQL = $this->app->getAppRoot() . 'db' . DS . 'standard' . DS . 'zentao' . $openVersion . '.sql'; if(!file_exists($standardSQL)) return $alterSQL; $lines = file($standardSQL); if(empty($this->config->isINT)) { - $xVersion = $version; - $version = str_replace('.', '_', $version); - if(strpos($version, 'pro') !== false and isset($this->config->upgrade->proVersion[$version])) $xVersion = str_replace('_', '.', $this->config->upgrade->proVersion[$version]); - if(strpos($version, 'biz') !== false and isset($this->config->upgrade->bizVersion[$version])) $xVersion = str_replace('_', '.', $this->config->upgrade->bizVersion[$version]); - + $xVersion = $openVersion; $xStandardSQL = $this->app->getAppRoot() . 'db' . DS . 'standard' . DS . 'xuanxuan' . $xVersion . '.sql'; if(file_exists($xStandardSQL)) { From e1dd273c3c3776080f41137f90a885cfc2645a33 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 9 Mar 2022 08:49:13 +0800 Subject: [PATCH 03/53] * Modify the add contact popup style. --- module/my/view/buildcontactlists.html.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/my/view/buildcontactlists.html.php b/module/my/view/buildcontactlists.html.php index 4500d2b2bd..1a210b3245 100644 --- a/module/my/view/buildcontactlists.html.php +++ b/module/my/view/buildcontactlists.html.php @@ -17,8 +17,9 @@ if($contactLists) } else { + $width = isonlybody() ? 'data-width=100%' : ''; echo ''; - echo '"; + echo '"; echo ''; echo ''; echo ''; From 200ba77298a3782b95138bc74e49cea64a06230a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Wed, 9 Mar 2022 09:04:16 +0800 Subject: [PATCH 04/53] * Code for version. --- module/upgrade/control.php | 2 +- module/upgrade/model.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/module/upgrade/control.php b/module/upgrade/control.php index bc1eb04805..bcada683c5 100644 --- a/module/upgrade/control.php +++ b/module/upgrade/control.php @@ -703,7 +703,7 @@ class upgrade extends control */ public function afterExec($fromVersion, $processed = 'no', $skipMoveFile = 'no') { - $alterSQL = $this->upgrade->checkConsistency($fromVersion); + $alterSQL = $this->upgrade->checkConsistency($this->config->version); if(!empty($alterSQL)) { $this->view->title = $this->lang->upgrade->consistency; diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 497d18a345..8ce2a4e81f 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -1101,17 +1101,17 @@ class upgradeModel extends model /** * Check consistency. * - * @param string $fromVersion + * @param string $version * @access public * @return string */ - public function checkConsistency($fromVersion = '') + public function checkConsistency($version = '') { - if(empty($fromVersion)) $fromVersion = $this->config->installedVersion; + if(empty($version)) $version = $this->config->installedVersion; $editions = array('p' => 'proVersion', 'b' => 'bizVersion', 'm' => 'maxVersion'); - $fromEdition = is_numeric($fromVersion[0]) ? 'open' : $editions[$fromVersion[0]]; - $openVersion = is_numeric($fromVersion[0]) ? $fromVersion : $this->config->upgrade->{$fromEdition}[$fromVersion]; + $fromEdition = is_numeric($version[0]) ? 'open' : $editions[$version[0]]; + $openVersion = is_numeric($version[0]) ? $version : $this->config->upgrade->{$fromEdition}[$version]; $openVersion = str_replace('_', '.', $openVersion); $alterSQL = ''; From 8eaba29e5fc232e78eccb46824491720357cb387 Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 9 Mar 2022 01:11:39 +0000 Subject: [PATCH 05/53] * Adjust code --- lib/scm/gitlab.class.php | 2 +- module/repo/model.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/scm/gitlab.class.php b/lib/scm/gitlab.class.php index 861bffbd95..1d702b267b 100644 --- a/lib/scm/gitlab.class.php +++ b/lib/scm/gitlab.class.php @@ -646,7 +646,7 @@ class gitlab $param = new stdclass(); $param->path = urldecode($path); - $param->ref_name = $toRevision ? $toRevision : $this->branch; + $param->ref_name = ($toRevision != 'HEAD' and $toRevision) ? $toRevision : $this->branch; $fromDate = $this->getCommittedDate($fromRevision); $toDate = $this->getCommittedDate($toRevision); diff --git a/module/repo/model.php b/module/repo/model.php index 2f13bb5f2e..ab12ca3c29 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -882,7 +882,7 @@ class repoModel extends model $scm = $this->app->loadClass('scm'); $scm->setEngine($repo); - $logs = $scm->log('', $lastInDB ? $lastInDB->revision : 0, ''); + $logs = $scm->log('', $lastInDB ? $lastInDB->revision : 0); if(empty($logs)) return false; /* Process logs. */ From 06701aa5a0856b1fcebed5d51d322a0e45f43913 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 9 Mar 2022 09:34:52 +0800 Subject: [PATCH 06/53] * Fix style issues when raising bugs. --- module/bug/view/create.html.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/bug/view/create.html.php b/module/bug/view/create.html.php index c33c1a9f2a..ca57e65f41 100644 --- a/module/bug/view/create.html.php +++ b/module/bug/view/create.html.php @@ -124,7 +124,9 @@ if($this->app->tab == 'project') js::set('objectID', $projectID);
bug->openedBuild?> + +
bug->allBuilds, "class='btn' id='all' data-toggle='tooltip' onclick='loadAllBuilds()'")?>
From 9257884f9a8948032ef4f7ffb677c7052b6f97a5 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 9 Mar 2022 10:22:01 +0800 Subject: [PATCH 07/53] * Add auto test. --- test/class/task.class.php | 31 ++++++++++++ test/model/task/createTaskFromGitlabIssue.php | 49 +++++++++++++++++++ test/model/task/getProjectID.php | 21 ++++++++ test/ztest | 1 + 4 files changed, 102 insertions(+) create mode 100755 test/model/task/createTaskFromGitlabIssue.php create mode 100644 test/model/task/getProjectID.php diff --git a/test/class/task.class.php b/test/class/task.class.php index 4fe7fc6b82..d85a181b55 100644 --- a/test/class/task.class.php +++ b/test/class/task.class.php @@ -532,4 +532,35 @@ class taskTest return $object; } } + + public function createTaskFromGitlabIssueTest($task, $executionID) + { + $objectID = $this->objectModel->createTaskFromGitlabIssue($task, $executionID); + + unset($_POST); + if(dao::isError()) + { + return dao::getError(); + } + else + { + $object = $this->objectModel->getById($objectID); + return $object; + } + } + + public function getProjectIDTest($executionID) + { + $object = $this->objectModel->getProjectID($executionID); + + unset($_POST); + if(dao::isError()) + { + return dao::getError(); + } + else + { + return $object; + } + } } diff --git a/test/model/task/createTaskFromGitlabIssue.php b/test/model/task/createTaskFromGitlabIssue.php new file mode 100755 index 0000000000..574d65ed28 --- /dev/null +++ b/test/model/task/createTaskFromGitlabIssue.php @@ -0,0 +1,49 @@ +#!/usr/bin/env php +createTaskFromGitlabIssue(); +cid=1 +pid=1 + +测试正常的创建开发任务 >> gitlab中新建的问题01 +测试正常的创建开发任务 >> 101 +测试正常的创建开发任务 >> 11 +测试不输入执行创建开务 >> 『所属执行』不能为空。 +测试不输入名称创建任务 >> 『任务名称』不能为空。 + + */ + +$executionID = 101; + +$task1 = new stdclass(); +$task1->name = 'gitlab中新建的问题01'; +$task1->execution = $executionID; + +$task2 = new stdclass(); +$task2->name = 'gitlab中新建的问题02'; +$task2->execution = $executionID; + +$task3 = new stdclass(); +$task3->name = 'gitlab中新建的问题03'; +$task3->execution = $executionID; + +$task4 = new stdclass(); +$task4->name = 'gitlab中新建的问题06'; +$task4->execution = ''; + +$task5 = new stdclass(); +$task5->name = ''; +$task5->execution = $executionID; + +$task = new taskTest(); +r($task->createTaskFromGitlabIssueTest($task1, $executionID)) && p('name') && e('gitlab中新建的问题01'); // 测试正常的创建开发任务 +r($task->createTaskFromGitlabIssueTest($task2, $executionID)) && p('execution') && e('101'); // 测试正常的创建开发任务 +r($task->createTaskFromGitlabIssueTest($task3, $executionID)) && p('project') && e('11'); // 测试正常的创建开发任务 +r($task->createTaskFromGitlabIssueTest($task4, $executionID)) && p('execution:0') && e('『所属执行』不能为空。'); // 测试不输入执行创建任务 +r($task->createTaskFromGitlabIssueTest($task5, $executionID)) && p('name:0') && e('『任务名称』不能为空。'); // 测试不输入名称创建任务 +system("./ztest init"); diff --git a/test/model/task/getProjectID.php b/test/model/task/getProjectID.php new file mode 100644 index 0000000000..76b806d0c1 --- /dev/null +++ b/test/model/task/getProjectID.php @@ -0,0 +1,21 @@ +#!/usr/bin/env php +getByList(); +cid=1 +pid=1 + +根据executionID查找projectID >> 11 + +*/ + +$executionID = '101'; + +$task = new taskTest(); +r($task->getProjectIDTest($executionID)) && p('project') && e('11'); //根据executionID查找projectID +system("./ztest init"); diff --git a/test/ztest b/test/ztest index 8a30767bef..09ae67a348 100755 --- a/test/ztest +++ b/test/ztest @@ -24,6 +24,7 @@ switch($argv[1]) break; case 'task': ztfRun('model/task'); + break; case 'execution': ztfRun('model/execution'); break; From 29c651b4e8030d7763d0a1ab6bc290be48b0d987 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 9 Mar 2022 10:23:32 +0800 Subject: [PATCH 08/53] * Modify data. --- test/model/task/createTaskFromGitlabIssue.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/model/task/createTaskFromGitlabIssue.php b/test/model/task/createTaskFromGitlabIssue.php index 574d65ed28..fa73b7a9d1 100755 --- a/test/model/task/createTaskFromGitlabIssue.php +++ b/test/model/task/createTaskFromGitlabIssue.php @@ -33,7 +33,7 @@ $task3->name = 'gitlab中新建的问题03'; $task3->execution = $executionID; $task4 = new stdclass(); -$task4->name = 'gitlab中新建的问题06'; +$task4->name = 'gitlab中新建的问题04'; $task4->execution = ''; $task5 = new stdclass(); From 234a2352ec36d26912689b1517e54ded209a47d0 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 9 Mar 2022 10:37:10 +0800 Subject: [PATCH 09/53] * Fix bug #20487. --- module/bug/control.php | 8 +++++--- module/bug/js/common.js | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 76f9ee2e47..77185c8bad 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -2236,15 +2236,17 @@ class bug extends control * Ajax get project team members. * * @param int $projectID + * @param string $$selectedUser * @access public - * @return void + * @return string */ - public function ajaxGetProjectTeamMembers($projectID) + public function ajaxGetProjectTeamMembers($projectID, $selectedUser = '') { $users = $this->loadModel('user')->getPairs('noclosed'); $teamMembers = empty($projectID) ? array() : $this->loadModel('project')->getTeamMemberPairs($projectID); foreach($teamMembers as $account => $member) $teamMembers[$account] = $users[$account]; - return print(html::select('assignedTo', $teamMembers, '', 'class="form-control"')); + + return print(html::select('assignedTo', $teamMembers, $selectedUser, 'class="form-control"')); } diff --git a/module/bug/js/common.js b/module/bug/js/common.js index 9b4b38b923..069794e9d5 100644 --- a/module/bug/js/common.js +++ b/module/bug/js/common.js @@ -32,7 +32,7 @@ function loadAll(productID) if(page == 'create') { loadExecutionTeamMembers(productID); - setAssignedTo(); + setTimeout("setAssignedTo()", 50); } if(typeof(changeProductConfirmed) != 'undefined' && !changeProductConfirmed) @@ -485,7 +485,7 @@ function loadExecutionBuilds(executionID) */ function loadProjectTeamMembers(projectID) { - link = createLink('bug', 'ajaxGetProjectTeamMembers', 'projectID=' + projectID); + link = createLink('bug', 'ajaxGetProjectTeamMembers', 'projectID=' + projectID + '&selectedUser=' + $('#assignedTo').val()); $.get(link, function(data) { if(!data) data = ''; From d6692b22c10189d447df0197bfb6e54944647f20 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 9 Mar 2022 10:39:45 +0800 Subject: [PATCH 10/53] * Fix bug #20522. --- module/my/control.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/my/control.php b/module/my/control.php index 95d130dc23..92be67f2b1 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -499,7 +499,7 @@ EOF; $this->view->position[] = $this->lang->my->bug; $this->view->bugs = $bugs; $this->view->users = $this->user->getPairs('noletter'); - $this->view->memberPairs = $this->user->getPairs('noletter|nodeleted'); + $this->view->memberPairs = $this->user->getPairs('noletter|nodeleted|noclosed'); $this->view->tabID = 'bug'; $this->view->type = $type; $this->view->recTotal = $recTotal; From 57da5c00a93a6f8ac19bf96a9898b36e9a31aed8 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 9 Mar 2022 10:47:16 +0800 Subject: [PATCH 11/53] * Fix bug #20503. --- module/story/view/batchedit.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/story/view/batchedit.html.php b/module/story/view/batchedit.html.php index 10f90a4e11..069f8d94bb 100644 --- a/module/story/view/batchedit.html.php +++ b/module/story/view/batchedit.html.php @@ -148,7 +148,7 @@ foreach(explode(',', $showFields) as $field) - app->tab == 'product' ? html::a($this->session->storyList, $lang->goback, '', "class='btn btn-back btn-wide'") : html::backButton();?> + app->tab == 'product' or $this->app->tab == 'execution') ? html::a($this->session->storyList, $lang->goback, '', "class='btn btn-back btn-wide'") : html::backButton();?> From f5d4dfc9adfd8d276a57cded96582c8db3397791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=80=A1=E6=A0=8B?= Date: Wed, 9 Mar 2022 10:53:08 +0800 Subject: [PATCH 12/53] * code for task #49356. --- config/filter.php | 1 + .../lite/execution/ext/control/kanban.php | 3 +++ extension/lite/execution/ext/model/lite.php | 22 ++++++++++++++----- .../lite/project/ext/view/execution.html.php | 2 +- module/user/view/batchcreate.html.php | 6 +++-- module/user/view/create.html.php | 2 +- 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/config/filter.php b/config/filter.php index 7cf1e28852..d8732044d1 100644 --- a/config/filter.php +++ b/config/filter.php @@ -246,6 +246,7 @@ $filter->program->ajaxgetdropmenu->cookie['showClosed'] = 'code'; $filter->project->default->cookie['lastProject'] = 'int'; $filter->project->default->cookie['lastPRJ'] = 'int'; $filter->project->default->cookie['projectMode'] = 'code'; +$filter->project->default->cookie['kanbanview'] = 'code'; $filter->project->browse->cookie['involved'] = 'code'; $filter->project->browse->cookie['projectType'] = 'code'; $filter->project->story->cookie['storyModuleParam'] = 'int'; diff --git a/extension/lite/execution/ext/control/kanban.php b/extension/lite/execution/ext/control/kanban.php index 69571b03f5..a368309fdf 100644 --- a/extension/lite/execution/ext/control/kanban.php +++ b/extension/lite/execution/ext/control/kanban.php @@ -12,6 +12,9 @@ class myExecution extends execution $this->loadModel('project')->setMenu($execution->project); $this->lang->kanban->menu->execution['subMenu'] = new stdClass(); + $this->session->set('kanbanview', $currentMethod); + setcookie('kanbanview', $currentMethod, $this->config->cookieLife, $this->config->webRoot, '', false, true); + /* change subMenu to sub select menu */ $TRActions = $this->execution->getTRActions($currentMethod); diff --git a/extension/lite/execution/ext/model/lite.php b/extension/lite/execution/ext/model/lite.php index 533fd32350..2930759820 100644 --- a/extension/lite/execution/ext/model/lite.php +++ b/extension/lite/execution/ext/model/lite.php @@ -29,8 +29,18 @@ public function setMenu($executionID, $buildID = 0, $extra = '') } $modulePageNav .= ""; - if(in_array($this->app->rawMethod, array('task', 'calendar', 'gantt', 'tree', 'grouptask'))) $this->lang->TRActions = $this->getTRActions($this->app->rawMethod); - if(in_array($this->app->rawMethod, array('relation', 'maintainrelation'))) $this->lang->TRActions = $this->getTRActions('gantt'); + $lowerModule = strtolower($this->app->rawModule); + $lowerMethod = strtolower($this->app->rawMethod); + + if($lowerModule == 'execution' and strpos('|kanban|task|calendar|gantt|tree|grouptask|', "|{$lowerMethod}|") !== false) + { + $this->session->set('kanbanview', $lowerMethod); + setcookie('kanbanview', $lowerMethod, $this->config->cookieLife, $this->config->webRoot, '', false, true); + } + + if(strpos('|task|calendar|gantt|tree|grouptask|', "|{$lowerMethod}|") !== false) $this->lang->TRActions = $this->getTRActions($lowerMethod); + if(strpos('|relation|maintainrelation|', "|{$lowerMethod}|") !== false) $this->lang->TRActions = $this->getTRActions('gantt'); + if($lowerModule == 'task' || ($lowerModule == 'execution' and strpos('|kanban|task|calendar|gantt|tree|grouptask|', "|{$lowerMethod}|") === false)) $this->lang->TRActions = $this->getTRActions($this->session->kanbanview); $this->lang->modulePageNav = $modulePageNav; } @@ -94,12 +104,14 @@ public function getTRActions($currentMethod) } $TRActions = ''; - $TRActions .= "