From 12c3fd80ddc6a7c950579936d8cee50850279e66 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Mon, 28 Mar 2022 17:01:56 +0800 Subject: [PATCH 01/11] * Code for bug #21058. --- extension/lite/custom/ext/lang/en/lite.php | 4 ++-- extension/lite/custom/ext/lang/zh-cn/lite.php | 1 - module/custom/control.php | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/extension/lite/custom/ext/lang/en/lite.php b/extension/lite/custom/ext/lang/en/lite.php index bfe39b23ad..adc8835faf 100644 --- a/extension/lite/custom/ext/lang/en/lite.php +++ b/extension/lite/custom/ext/lang/en/lite.php @@ -6,7 +6,6 @@ $lang->custom->notice->readOnlyOfExecution = "If Change Forbidden, any change on $lang->custom->moduleName['execution'] = $lang->custom->execution; $lang->custom->object = array(); -$lang->custom->object['project'] = 'Project'; $lang->custom->object['execution'] = $lang->custom->execution; $lang->custom->object['story'] = $lang->SRCommon; $lang->custom->object['task'] = 'Task'; @@ -15,7 +14,8 @@ $lang->custom->object['user'] = 'User'; $lang->custom->object['block'] = 'Block'; $lang->custom->task = new stdClass(); -$lang->custom->task->fields['priList'] = 'Priority'; +$lang->custom->task->fields['priList'] = 'Priority'; +$lang->custom->task->fields['typeList'] = 'Type'; $lang->custom->story = new stdClass(); $lang->custom->story->fields['priList'] = 'Priority'; diff --git a/extension/lite/custom/ext/lang/zh-cn/lite.php b/extension/lite/custom/ext/lang/zh-cn/lite.php index b7fec903d2..c4a3d1948e 100644 --- a/extension/lite/custom/ext/lang/zh-cn/lite.php +++ b/extension/lite/custom/ext/lang/zh-cn/lite.php @@ -6,7 +6,6 @@ $lang->custom->notice->readOnlyOfExecution = "禁止修改后,已关闭{$lang- $lang->custom->moduleName['execution'] = $lang->custom->execution; $lang->custom->object = array(); -$lang->custom->object['project'] = '项目'; $lang->custom->object['execution'] = $lang->custom->execution; $lang->custom->object['story'] = $lang->SRCommon; $lang->custom->object['task'] = '任务'; diff --git a/module/custom/control.php b/module/custom/control.php index dc159ba0c6..60ab69b4a0 100644 --- a/module/custom/control.php +++ b/module/custom/control.php @@ -19,6 +19,8 @@ class custom extends control */ public function index() { + if($this->config->vision == 'lite') return print(js::locate(inlink('execution'))); + if(($this->config->systemMode == 'new') and common::hasPriv('custom', 'set')) { return print(js::locate(inlink('set', "module=project&field=" . key($this->lang->custom->project->fields)))); From 9f74fe748f8bb79213597f027437bfa317276633 Mon Sep 17 00:00:00 2001 From: liyuchun Date: Tue, 29 Mar 2022 09:34:09 +0800 Subject: [PATCH 02/11] * Fix bug #20804,20946. --- lib/pager/pager.class.php | 24 +++++++++++++++++++++-- module/gitlab/lang/en.php | 1 + module/gitlab/lang/zh-cn.php | 1 + module/gitlab/view/browseproject.html.php | 2 +- module/gitlab/view/view.html.php | 3 +++ 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/lib/pager/pager.class.php b/lib/pager/pager.class.php index 1dd0dac22a..0d0b016fa9 100644 --- a/lib/pager/pager.class.php +++ b/lib/pager/pager.class.php @@ -90,10 +90,11 @@ class pager extends basePager * * @param string $align * @param string $type + * @param int $maxRecPerPage * @access public * @return void */ - public function show($align = 'right', $type = 'full') + public function show($align = 'right', $type = 'full', $maxRecPerPage = 0) { if($type == 'pagerjs') { @@ -110,7 +111,26 @@ class pager extends basePager } else { - echo ""; + $pageSizeOptions = ''; + if($maxRecPerPage) + { + /* Set record per page. */ + for($i = 5; $i <= 50; $i += 5) $options[] = $i; + $options = array_merge($options, array(100, 200, 500, 1000, 2000)); + + $pageSizeOptions = 'data-page-size-options="'; + foreach($options as $option) + { + $pageSizeOptions .= "$option,"; + if($option >= $maxRecPerPage) + { + $pageSizeOptions = trim($pageSizeOptions, ',') . '"'; + break; + } + } + } + + echo ""; } } else diff --git a/module/gitlab/lang/en.php b/module/gitlab/lang/en.php index feaa6bb53b..9df7073538 100644 --- a/module/gitlab/lang/en.php +++ b/module/gitlab/lang/en.php @@ -77,6 +77,7 @@ $lang->gitlab->createSuccess = "Create success"; $lang->gitlab->mustBindUser = 'You have not registered the GitLab account, please contact the administrator to register.'; $lang->gitlab->noAccess = 'Permission denied'; $lang->gitlab->notCompatible = 'The current GitLab version is not compatible with ZenTao, please upgrade the GitLab version and try again'; +$lang->gitlab->deleted = 'Deleted'; $lang->gitlab->placeholder = new stdclass; $lang->gitlab->placeholder->name = ''; diff --git a/module/gitlab/lang/zh-cn.php b/module/gitlab/lang/zh-cn.php index 5f6d6120ce..d3235a8c3a 100644 --- a/module/gitlab/lang/zh-cn.php +++ b/module/gitlab/lang/zh-cn.php @@ -77,6 +77,7 @@ $lang->gitlab->createSuccess = "创建成功"; $lang->gitlab->mustBindUser = '您还未绑定GitLab用户,请联系管理员进行绑定'; $lang->gitlab->noAccess = '权限不足'; $lang->gitlab->notCompatible = '当前GitLab版本与禅道不兼容,请升级GitLab版本后重试'; +$lang->gitlab->deleted = '已删除'; $lang->gitlab->placeholder = new stdclass; $lang->gitlab->placeholder->name = ''; diff --git a/module/gitlab/view/browseproject.html.php b/module/gitlab/view/browseproject.html.php index 1209405395..686511c634 100644 --- a/module/gitlab/view/browseproject.html.php +++ b/module/gitlab/view/browseproject.html.php @@ -83,7 +83,7 @@ - + diff --git a/module/gitlab/view/view.html.php b/module/gitlab/view/view.html.php index 2866e100e1..49cff2e5c6 100644 --- a/module/gitlab/view/view.html.php +++ b/module/gitlab/view/view.html.php @@ -18,6 +18,9 @@
id?> name;?> + deleted):?> + gitlab->deleted;?> +
From f6e4a00c2509ac048d318a2ec7da72c25f04e7d9 Mon Sep 17 00:00:00 2001 From: zenggang Date: Tue, 29 Mar 2022 02:11:46 +0000 Subject: [PATCH 03/11] * Fix bug#21092 --- module/tutorial/js/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/tutorial/js/index.js b/module/tutorial/js/index.js index 43e450fe1b..2064a6b582 100644 --- a/module/tutorial/js/index.js +++ b/module/tutorial/js/index.js @@ -168,6 +168,8 @@ $(function() container = null; } + if($(ele).hasClass('create-bug-btn')) container = '.btn-toolbar.pull-right'; // Fix bug #21092. + $e.closest('body').find('.tooltip-tutorial').tooltip('destroy'); var offset = $e.offset(); var winWidth = $(window).width(); From 731f96d1a54a375b3d683432b9b5620b5cae73d9 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 29 Mar 2022 10:57:12 +0800 Subject: [PATCH 04/11] * Fix bug#16137,#16136. --- module/bug/js/common.js | 4 +++- module/story/control.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/module/bug/js/common.js b/module/bug/js/common.js index 83d599fc68..96afeeee40 100644 --- a/module/bug/js/common.js +++ b/module/bug/js/common.js @@ -504,7 +504,9 @@ function setStories(moduleID, productID, storyID) { var branch = $('#branch').val(); if(typeof(branch) == 'undefined') branch = 0; - link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&storyID=' + storyID); + var executionID = $('#execution').val(); + if(typeof(executionID) == 'undefined') executionID = 0; + link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&storyID=' + storyID + '&onlyOption=false&status=&limit=0&type=full&hasParent=1&executionID=' + executionID); $.get(link, function(stories) { if(!stories) stories = ''; diff --git a/module/story/control.php b/module/story/control.php index 09099b18be..02977d6d88 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -2099,7 +2099,7 @@ class story extends control $stories = $this->story->getProductStoryPairs($productID, $branch, $moduleID, $storyStatus, 'id_desc', $limit, $type, 'story', $hasParent); } - if(empty($stories)) $stories = $this->story->getProductStoryPairs($productID, $branch, 0, $storyStatus, 'id_desc', $limit, $type, 'story', $hasParent); + if(!in_array($this->app->tab, array('execution', 'project')) and empty($stories)) $stories = $this->story->getProductStoryPairs($productID, $branch, 0, $storyStatus, 'id_desc', $limit, $type, 'story', $hasParent); $storyID = isset($stories[$storyID]) ? $storyID : 0; $select = html::select('story' . $number, empty($stories) ? array('' => '') : $stories, $storyID, "class='form-control'"); From a2e9c28f6ea5b9dbce78e6be50d837b39c4221d7 Mon Sep 17 00:00:00 2001 From: sunjun Date: Tue, 29 Mar 2022 11:12:02 +0800 Subject: [PATCH 05/11] *Fixbug #21258 --- module/execution/model.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index 703830a1e2..cd6c878de0 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -305,14 +305,6 @@ class executionModel extends model $type = 'sprint'; if($project) $type = zget($this->config->execution->modelList, $project->model, 'sprint'); - /* Judge workdays is legitimate. */ - $workdays = helper::diffDate($_POST['end'], $_POST['begin']) + 1; - if(isset($_POST['days']) and $_POST['days'] > $workdays) - { - dao::$errors['days'] = sprintf($this->lang->project->workdaysExceed, $workdays); - return false; - } - /* If the execution model is a stage, determine whether the product is linked. */ $products = array_filter($this->post->products); if(empty($products)) @@ -324,6 +316,14 @@ class executionModel extends model $this->config->execution->create->requiredFields .= ',project'; } + /* Judge workdays is legitimate. */ + $workdays = helper::diffDate($_POST['end'], $_POST['begin']) + 1; + if(isset($_POST['days']) and $_POST['days'] > $workdays) + { + dao::$errors['days'] = sprintf($this->lang->project->workdaysExceed, $workdays); + return false; + } + /* Get the data from the post. */ $sprint = fixer::input('post') ->setDefault('status', 'wait') From 603ae3bfdccc5760119572920b660ff244105f2a Mon Sep 17 00:00:00 2001 From: zhouxin Date: Tue, 29 Mar 2022 03:14:50 +0000 Subject: [PATCH 06/11] * Fix bug #16707. --- module/program/control.php | 2 +- module/user/model.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/module/program/control.php b/module/program/control.php index 72f7c663dc..f19a9b96f9 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -60,7 +60,7 @@ class program extends control $this->view->orderBy = $orderBy; $this->view->users = $this->user->getPairs('noletter'); $this->view->userIdPairs = $this->user->getPairs('noletter|showid'); - $this->view->usersAvatar = $this->user->getAvatarPairs(); + $this->view->usersAvatar = $this->user->getAvatarPairs(false); $this->view->programType = $programType; $this->view->PMList = $PMList; $this->view->progressList = $this->program->getProgressList(); diff --git a/module/user/model.php b/module/user/model.php index 69c1da87ee..7a0cb82ad0 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -37,11 +37,11 @@ class userModel extends model * @access public * @return void */ - public function getList() + public function getList($undeleted = true) { return $this->dao->select('*')->from(TABLE_USER) - ->where('deleted')->eq(0) - ->andWhere('type')->eq('inside') + ->where('type')->eq('inside') + ->beginIF($undeleted == true)->andWhere('deleted')->eq(0)->fi() ->orderBy('account') ->fetchAll(); } @@ -146,10 +146,10 @@ class userModel extends model * @access public * @return array */ - public function getAvatarPairs() + public function getAvatarPairs($undeleted = true) { $avatarPairs = array(); - $userList = $this->getList(); + $userList = $this->getList($undeleted); foreach($userList as $user) $avatarPairs[$user->account] = $user->avatar; return $avatarPairs; From 376de6d82487307980e6f3e495fac409d511cb8c Mon Sep 17 00:00:00 2001 From: zhouxin Date: Tue, 29 Mar 2022 04:28:39 +0000 Subject: [PATCH 07/11] * Fix bug #16707. --- module/program/control.php | 2 +- module/user/model.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/module/program/control.php b/module/program/control.php index f19a9b96f9..cd7e6c2adf 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -60,7 +60,7 @@ class program extends control $this->view->orderBy = $orderBy; $this->view->users = $this->user->getPairs('noletter'); $this->view->userIdPairs = $this->user->getPairs('noletter|showid'); - $this->view->usersAvatar = $this->user->getAvatarPairs(false); + $this->view->usersAvatar = $this->user->getAvatarPairs(''); $this->view->programType = $programType; $this->view->PMList = $PMList; $this->view->progressList = $this->program->getProgressList(); diff --git a/module/user/model.php b/module/user/model.php index 7a0cb82ad0..4f2b5a3dd6 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -37,11 +37,11 @@ class userModel extends model * @access public * @return void */ - public function getList($undeleted = true) + public function getList($params = 'nodeleted') { return $this->dao->select('*')->from(TABLE_USER) ->where('type')->eq('inside') - ->beginIF($undeleted == true)->andWhere('deleted')->eq(0)->fi() + ->beginIF(strpos($params, 'nodeleted') !== false)->andWhere('deleted')->eq(0)->fi() ->orderBy('account') ->fetchAll(); } @@ -146,10 +146,10 @@ class userModel extends model * @access public * @return array */ - public function getAvatarPairs($undeleted = true) + public function getAvatarPairs($params = 'nodeleted') { $avatarPairs = array(); - $userList = $this->getList($undeleted); + $userList = $this->getList($params); foreach($userList as $user) $avatarPairs[$user->account] = $user->avatar; return $avatarPairs; From 5460fc9b9b33c7881c89027c76e81324351d2689 Mon Sep 17 00:00:00 2001 From: liyang <“liyang@easycorp.ltd”> Date: Tue, 29 Mar 2022 13:23:28 +0800 Subject: [PATCH 08/11] update story data --- test/data/story.yaml | 4 ++-- test/data/zentao/processor.php | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/test/data/story.yaml b/test/data/story.yaml index fd1b48756c..ab254831ae 100644 --- a/test/data/story.yaml +++ b/test/data/story.yaml @@ -236,8 +236,8 @@ fields: format: "" - field: closedReason note: "关闭原因" - range: 1-1000 - prefix: "关闭原因" + range: done,subdivided,duplicate,postponed,willnotdo,cancel,bydesign + prefix: "" postfix: "" loop: 0 format: "" diff --git a/test/data/zentao/processor.php b/test/data/zentao/processor.php index b7688c067a..1ff2bbf54e 100644 --- a/test/data/zentao/processor.php +++ b/test/data/zentao/processor.php @@ -44,6 +44,7 @@ class Processor $this->initRelease(); $this->initStakeholder(); $this->initUserquery(); + $this->initMessage(); $this->initUpdateKanban(); $this->initStory(); $this->initBug(); @@ -159,6 +160,7 @@ class Processor $this->dao->update(TABLE_STORY)->set('`status`')->eq('active')->where('id')->le('20')->exec(); $this->dao->update(TABLE_STORY)->set('`status`')->eq('draft')->where('id')->ge('300')->andwhere('id')->le('400')->exec(); $this->dao->update(TABLE_STORY)->set('`closedBy`')->eq('')->set('`closedReason`')->eq('')->where('status')->ne('closed')->exec(); + $this->dao->update(TABLE_STORY)->set('`plan`')->eq('0')->where('id')->gt('300')->andwhere('id')->lt('321')->exec(); } /** @@ -318,6 +320,12 @@ class Processor $this->dao->query("INSERT INTO `zt_userquery` (`id`, `account`, `module`, `title`, `form`, `sql`, `shortcut`) VALUES (5, 'admin', 'executionBuild', '执行版本搜索', 'a:37:{s:9:\"fieldname\";s:0:\"\";s:12:\"fieldproduct\";s:0:\"\";s:12:\"fieldscmPath\";s:0:\"\";s:13:\"fieldfilePath\";s:0:\"\";s:9:\"fielddate\";s:0:\"\";s:12:\"fieldbuilder\";s:0:\"\";s:9:\"fielddesc\";s:0:\"\";s:7:\"fieldid\";s:0:\"\";s:6:\"andOr1\";s:3:\"AND\";s:6:\"field1\";s:4:\"name\";s:9:\"operator1\";s:7:\"include\";s:6:\"value1\";s:8:\"版本17\";s:6:\"andOr2\";s:3:\"and\";s:6:\"field2\";s:2:\"id\";s:9:\"operator2\";s:1:\"=\";s:6:\"value2\";s:0:\"\";s:6:\"andOr3\";s:3:\"and\";s:6:\"field3\";s:7:\"product\";s:9:\"operator3\";s:1:\"=\";s:6:\"value3\";s:0:\"\";s:10:\"groupAndOr\";s:3:\"and\";s:6:\"andOr4\";s:3:\"AND\";s:6:\"field4\";s:7:\"scmPath\";s:9:\"operator4\";s:7:\"include\";s:6:\"value4\";s:0:\"\";s:6:\"andOr5\";s:3:\"and\";s:6:\"field5\";s:8:\"filePath\";s:9:\"operator5\";s:7:\"include\";s:6:\"value5\";s:0:\"\";s:6:\"andOr6\";s:3:\"and\";s:6:\"field6\";s:4:\"date\";s:9:\"operator6\";s:1:\"=\";s:6:\"value6\";s:0:\"\";s:6:\"module\";s:14:\"executionBuild\";s:9:\"actionURL\";s:78:\"/index.php?m=execution&f=build&executionID=101&type=bysearch&queryID=myQueryID\";s:10:\"groupItems\";s:1:\"3\";s:8:\"formType\";s:4:\"more\";}', '(( 1 AND `name` LIKE \'%版本17%\' ) AND ( 1 ))', '0');"); } + private function initMessage() + { + $this->dao->query("DELETE FROM `zt_config` where `key` = 'setting';"); + $this->dao->query("INSERT INTO `zt_config` (`vision`, `owner`, `module`, `section`, `key`, `value`) VALUES + ('rnd', 'system', 'message', '', 'setting', '{\"mail\":{\"setting\":{\"story\":[\"opened\",\"edited\",\"commented\",\"frombug\",\"changed\",\"reviewed\",\"closed\",\"activated\",\"assigned\"],\"task\":[\"opened\",\"edited\",\"commented\",\"assigned\",\"confirmed\",\"started\",\"finished\",\"paused\",\"canceled\",\"restarted\",\"closed\",\"activated\"],\"testtask\":[\"opened\",\"edited\",\"closed\"],\"doc\":[\"created\",\"edited\"]}},\"message\":{\"setting\":{\"story\":[\"opened\",\"edited\",\"commented\",\"frombug\",\"changed\",\"reviewed\",\"closed\",\"activated\",\"assigned\"],\"task\":[\"opened\",\"edited\",\"commented\",\"assigned\",\"confirmed\",\"started\",\"finished\",\"paused\",\"canceled\",\"restarted\",\"closed\",\"activated\"],\"testtask\":[\"opened\",\"edited\",\"started\",\"blocked\",\"closed\",\"activated\"],\"todo\":[\"opened\",\"edited\"],\"doc\":[\"created\",\"edited\"]}}}');"); + } private function initTodo() { $toDay = date('y-m-d'); From 1fcbef1a7923442e9e5c80a403dad303fe605cf3 Mon Sep 17 00:00:00 2001 From: liyuchun Date: Tue, 29 Mar 2022 13:45:36 +0800 Subject: [PATCH 09/11] * Fix bug #13194. --- module/common/model.php | 10 ++++++++++ module/tutorial/view/index.html.php | 1 - 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/module/common/model.php b/module/common/model.php index 8991412729..a7c28e4ec8 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -2279,6 +2279,16 @@ EOD; $module = strtolower($module); $method = strtolower($method); + /* If the user is doing a tutorial, have all tutorial privs. */ + if(defined('TUTORIAL')) + { + $app->loadLang('tutorial'); + foreach($lang->tutorial->tasks as $task) + { + if($task['nav']['module'] == $module and $task['nav']['method'] = $method) return true; + } + } + /* Check the parent object is closed. */ if(!empty($method) and strpos('close|batchclose', $method) === false and !commonModel::canBeChanged($module, $object)) return false; diff --git a/module/tutorial/view/index.html.php b/module/tutorial/view/index.html.php index 454c6edcf4..f0136f8685 100644 --- a/module/tutorial/view/index.html.php +++ b/module/tutorial/view/index.html.php @@ -76,7 +76,6 @@ Date: Tue, 29 Mar 2022 06:16:14 +0000 Subject: [PATCH 10/11] * Fix bug#21092,11398 --- module/execution/view/story.html.php | 2 +- module/tutorial/js/index.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/module/execution/view/story.html.php b/module/execution/view/story.html.php index c67e6f6d21..4da719b838 100644 --- a/module/execution/view/story.html.php +++ b/module/execution/view/story.html.php @@ -335,7 +335,7 @@ $actionLink = $this->createLink('story', 'batchEdit', "productID=0&executionID=$execution->id"); echo html::commonButton($lang->edit, "data-form-action='$actionLink' $disabled"); ?> - +