From fba6ac6a0e6ce01d13d2b08a078c85a15e400574 Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Tue, 12 Apr 2022 08:56:26 +0800 Subject: [PATCH 01/29] * Conversion budget unit. --- api/v1/entries/programs.php | 3 +- module/program/view/browsebylist.html.php | 2 +- module/project/model.php | 46 +++++++++++++++-------- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/api/v1/entries/programs.php b/api/v1/entries/programs.php index 7e3f9833ad..afb520ff73 100644 --- a/api/v1/entries/programs.php +++ b/api/v1/entries/programs.php @@ -48,7 +48,8 @@ class programsEntry extends Entry unset($program->desc); $program->end = $program->end == LONG_TIME ? $this->lang->program->longTime : $program->end; - $programBudget = in_array($this->app->getClientLang(), array('zh-cn','zh-tw')) ? round((float)$program->budget / 10000, 2) . $this->lang->project->tenThousand : round((float)$program->budget, 2); + $programBudget = $this->loadModel('project')->budgetUnit($program->budget); + $program->labelBudget = $program->budget != 0 ? zget($this->lang->project->currencySymbol, $program->budgetUnit) . ' ' . $programBudget : $this->lang->project->future; if(empty($program->parent)) $result[$program->id] = $program; diff --git a/module/program/view/browsebylist.html.php b/module/program/view/browsebylist.html.php index efc038415a..ee208754c0 100644 --- a/module/program/view/browsebylist.html.php +++ b/module/program/view/browsebylist.html.php @@ -72,7 +72,7 @@ createLink('user', 'profile', "userID=$userID", '', true), $userName, '', "title='{$userName}' data-toggle='modal' data-type='iframe' data-width='600'");?> - app->getClientLang(), array('zh-cn','zh-tw')) ? round((float)$program->budget / 10000, 2) . $lang->project->tenThousand : round((float)$program->budget, 2);?> + loadModel('project')->budgetUnit($program->budget);?> budget != 0 ? zget($lang->project->currencySymbol, $program->budgetUnit) . ' ' . $programBudget : $lang->project->future;?> begin;?> end == LONG_TIME ? $lang->program->longTime : $program->end;?> diff --git a/module/project/model.php b/module/project/model.php index 55689e9115..902c306f7a 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1659,22 +1659,7 @@ class projectModel extends model if($id == 'budget') { - if($project->budget < 10000) - { - $budget = round((float)$project->budget, 2); - $unit = ''; - } - elseif($project->budget < 100000000 and $project->budget >= 10000) - { - $budget = round((float)$project->budget/10000, 2); - $unit = $this->lang->project->tenThousand; - } - else - { - $budget = round((float)$project->budget/100000000, 2); - $unit = $this->lang->project->hundredMillion; - } - $projectBudget = in_array($this->app->getClientLang(), array('zh-cn','zh-tw')) ? $budget . $unit : round((float)$project->budget, 2); + $projectBudget = $this->budgetUnit($project->budget); $budgetTitle = $project->budget != 0 ? zget($this->lang->project->currencySymbol, $project->budgetUnit) . ' ' . $projectBudget : $this->lang->project->future; $title = "title='$budgetTitle'"; @@ -1803,6 +1788,35 @@ class projectModel extends model } } + /** + * Conversion budget unit + * + * @param int $budget + * @access public + * @return void + */ + public function budgetUnit($budget) + { + if($budget < 10000) + { + $budget = round((float)$budget, 2); + $unit = ''; + } + elseif($budget < 100000000 and $budget >= 10000) + { + $budget = round((float)$budget/10000, 2); + $unit = $this->lang->project->tenThousand; + } + else + { + $budget = round((float)$budget/100000000, 2); + $unit = $this->lang->project->hundredMillion; + } + + $projectBudget = in_array($this->app->getClientLang(), array('zh-cn','zh-tw')) ? $budget . $unit : round((float)$budget, 2); + return $projectBudget; + } + /** * Update products of a project. * From 94fa7866c9dbd47857421703641473c5bba7069b Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Tue, 12 Apr 2022 08:58:08 +0800 Subject: [PATCH 02/29] * Delete blank. --- api/v1/entries/programs.php | 1 - 1 file changed, 1 deletion(-) diff --git a/api/v1/entries/programs.php b/api/v1/entries/programs.php index afb520ff73..fd6b589524 100644 --- a/api/v1/entries/programs.php +++ b/api/v1/entries/programs.php @@ -49,7 +49,6 @@ class programsEntry extends Entry $program->end = $program->end == LONG_TIME ? $this->lang->program->longTime : $program->end; $programBudget = $this->loadModel('project')->budgetUnit($program->budget); - $program->labelBudget = $program->budget != 0 ? zget($this->lang->project->currencySymbol, $program->budgetUnit) . ' ' . $programBudget : $this->lang->project->future; if(empty($program->parent)) $result[$program->id] = $program; From f46d469050361f6826411b5c3a83a7e2d18606ad Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Tue, 12 Apr 2022 09:01:17 +0800 Subject: [PATCH 03/29] * Finish task 52558. --- api/v1/entries/bugassign.php | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 api/v1/entries/bugassign.php diff --git a/api/v1/entries/bugassign.php b/api/v1/entries/bugassign.php new file mode 100644 index 0000000000..5aed6f06b6 --- /dev/null +++ b/api/v1/entries/bugassign.php @@ -0,0 +1,40 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + **/ +class bugAssignEntry extends Entry +{ + /** + * POST method. + * + * @param int $bugID + * @access public + * @return void + */ + public function post($bugID) + { + $bug = $this->loadModel('bug')->getByID($bugID); + + $fields = 'assignedTo,mailto,comment'; + $this->batchSetPost($fields); + + $control = $this->loadController('bug', 'assignTo'); + $control->assignTo($bugID); + + $data = $this->getData(); + if(!$data) return $this->send400('error'); + if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); + + $bug = $this->bug->getByID($bugID); + + $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + } +} + From 73642794a19e50268e916ab0a9b8e57174867343 Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Tue, 12 Apr 2022 09:39:01 +0800 Subject: [PATCH 04/29] * Fix api. --- api/v1/entries/bugclose.php | 2 +- api/v1/entries/bugconfirm.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/v1/entries/bugclose.php b/api/v1/entries/bugclose.php index b2de387493..5e58721262 100644 --- a/api/v1/entries/bugclose.php +++ b/api/v1/entries/bugclose.php @@ -34,7 +34,7 @@ class bugCloseEntry extends Entry $bug = $this->bug->getByID($bugID); - $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + $this->send(200, $this->format($bug, 'assignedTo:user,assignedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time')); } } diff --git a/api/v1/entries/bugconfirm.php b/api/v1/entries/bugconfirm.php index 0324eed50f..fea2d6849b 100644 --- a/api/v1/entries/bugconfirm.php +++ b/api/v1/entries/bugconfirm.php @@ -34,7 +34,7 @@ class bugConfirmEntry extends Entry $bug = $this->bug->getById($bugID); - $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + $this->send(200, $this->format($bug, 'assignedTo:user,assignedDate:time,lastEditedBy:user,lastEditedDate:time,mailto:userList')); } } From 7d3a91ab39d9692cd8bf6db6e4ee2204e96d0a8e Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Tue, 12 Apr 2022 09:53:30 +0800 Subject: [PATCH 05/29] * Change function name for getBudgetWithUnit. --- api/v1/entries/bugclose.php | 2 +- api/v1/entries/bugconfirm.php | 2 +- api/v1/entries/programs.php | 2 +- module/program/view/browsebylist.html.php | 2 +- module/project/model.php | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/v1/entries/bugclose.php b/api/v1/entries/bugclose.php index 5e58721262..b2de387493 100644 --- a/api/v1/entries/bugclose.php +++ b/api/v1/entries/bugclose.php @@ -34,7 +34,7 @@ class bugCloseEntry extends Entry $bug = $this->bug->getByID($bugID); - $this->send(200, $this->format($bug, 'assignedTo:user,assignedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time')); + $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } } diff --git a/api/v1/entries/bugconfirm.php b/api/v1/entries/bugconfirm.php index fea2d6849b..91dc905ee1 100644 --- a/api/v1/entries/bugconfirm.php +++ b/api/v1/entries/bugconfirm.php @@ -34,7 +34,7 @@ class bugConfirmEntry extends Entry $bug = $this->bug->getById($bugID); - $this->send(200, $this->format($bug, 'assignedTo:user,assignedDate:time,lastEditedBy:user,lastEditedDate:time,mailto:userList')); + $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } } diff --git a/api/v1/entries/programs.php b/api/v1/entries/programs.php index fd6b589524..10629532c2 100644 --- a/api/v1/entries/programs.php +++ b/api/v1/entries/programs.php @@ -48,7 +48,7 @@ class programsEntry extends Entry unset($program->desc); $program->end = $program->end == LONG_TIME ? $this->lang->program->longTime : $program->end; - $programBudget = $this->loadModel('project')->budgetUnit($program->budget); + $programBudget = $this->loadModel('project')->getBudgetWithUnit($program->budget); $program->labelBudget = $program->budget != 0 ? zget($this->lang->project->currencySymbol, $program->budgetUnit) . ' ' . $programBudget : $this->lang->project->future; if(empty($program->parent)) $result[$program->id] = $program; diff --git a/module/program/view/browsebylist.html.php b/module/program/view/browsebylist.html.php index ee208754c0..923f31a813 100644 --- a/module/program/view/browsebylist.html.php +++ b/module/program/view/browsebylist.html.php @@ -72,7 +72,7 @@ createLink('user', 'profile', "userID=$userID", '', true), $userName, '', "title='{$userName}' data-toggle='modal' data-type='iframe' data-width='600'");?> - loadModel('project')->budgetUnit($program->budget);?> + loadModel('project')->getBudgetWithUnit($program->budget);?> budget != 0 ? zget($lang->project->currencySymbol, $program->budgetUnit) . ' ' . $programBudget : $lang->project->future;?> begin;?> end == LONG_TIME ? $lang->program->longTime : $program->end;?> diff --git a/module/project/model.php b/module/project/model.php index 902c306f7a..3f3aacfd32 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -1659,7 +1659,7 @@ class projectModel extends model if($id == 'budget') { - $projectBudget = $this->budgetUnit($project->budget); + $projectBudget = $this->getBudgetWithUnit($project->budget); $budgetTitle = $project->budget != 0 ? zget($this->lang->project->currencySymbol, $project->budgetUnit) . ' ' . $projectBudget : $this->lang->project->future; $title = "title='$budgetTitle'"; @@ -1789,13 +1789,13 @@ class projectModel extends model } /** - * Conversion budget unit + * Convert budget unit. * * @param int $budget * @access public * @return void */ - public function budgetUnit($budget) + public function getBudgetWithUnit($budget) { if($budget < 10000) { From 654da8565f417addb35dbd6aa935cd964421b512 Mon Sep 17 00:00:00 2001 From: zenggang Date: Tue, 12 Apr 2022 03:15:39 +0000 Subject: [PATCH 06/29] * Fix bug#21649,21512 --- module/common/model.php | 2 +- module/todo/lang/en.php | 2 +- module/todo/lang/zh-cn.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module/common/model.php b/module/common/model.php index 801cee3069..3ceaffc0e6 100644 --- a/module/common/model.php +++ b/module/common/model.php @@ -419,7 +419,7 @@ class commonModel extends model echo '
  • ' . html::a(helper::createLink('my', 'preference', '', '', true), " " . $lang->preference, '', "class='iframe' data-width='700'") . '
  • '; } - echo '
  • ' . html::a(helper::createLink('my', 'changepassword', '', '', true), " " . $lang->changePassword, '', "class='iframe' data-width='600'") . '
  • '; + if(common::hasPriv('my', 'changePassword')) echo '
  • ' . html::a(helper::createLink('my', 'changepassword', '', '', true), " " . $lang->changePassword, '', "class='iframe' data-width='600'") . '
  • '; echo "
  • "; } diff --git a/module/todo/lang/en.php b/module/todo/lang/en.php index 3763a184f2..54481dad81 100644 --- a/module/todo/lang/en.php +++ b/module/todo/lang/en.php @@ -114,7 +114,7 @@ $lang->todo->noAssignedTo = "The AssignedTo should not be empty."; $lang->todo->unfinishedTodo = 'The todos of ID %s are not finished, and can not close.'; $lang->todo->today = 'Todo Today'; -$lang->todo->periods['all'] = 'All Todos'; +$lang->todo->periods['all'] = 'Assigned To Yourself'; $lang->todo->periods['before'] = 'Unfinished'; $lang->todo->periods['future'] = 'TBD'; $lang->todo->periods['thisWeek'] = 'This Week'; diff --git a/module/todo/lang/zh-cn.php b/module/todo/lang/zh-cn.php index 87df53adad..1b5124f5fa 100644 --- a/module/todo/lang/zh-cn.php +++ b/module/todo/lang/zh-cn.php @@ -114,7 +114,7 @@ $lang->todo->noAssignedTo = '被指派人不能为空'; $lang->todo->unfinishedTodo = '待办ID %s 不是完成状态,不能关闭。'; $lang->todo->today = '今日待办'; -$lang->todo->periods['all'] = '所有'; +$lang->todo->periods['all'] = '指派自己'; $lang->todo->periods['before'] = '未完'; $lang->todo->periods['future'] = '待定'; $lang->todo->periods['thisWeek'] = '本周'; From f1aad53d14290f2008da6c43d4cd3a6299d0f342 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 12 Apr 2022 13:20:26 +0800 Subject: [PATCH 07/29] * Fix bug#13127. --- module/block/view/todoblock.html.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/block/view/todoblock.html.php b/module/block/view/todoblock.html.php index 2c55aa2355..cb4e0d6246 100644 --- a/module/block/view/todoblock.html.php +++ b/module/block/view/todoblock.html.php @@ -161,10 +161,12 @@ if(!$selfCall) die(include('./todolist.html.php')); var isFinished = $liTag.hasClass('active'); var todoID = $liTag.data('id'); var methodName = isFinished ? 'activate' : 'finish'; + var $todoes = $(this).closest('.block-todoes'); $.get(createLink('todo', methodName, "todoID=" + todoID), function() { if(!isFinished) $liTag.addClass('active'); if(isFinished) $liTag.removeClass('active'); + refreshBlock($todoes.parents('div.panel[id^=block]')); }); }); }); From 45b48305b74f5524852333636266b8e313684afe Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 12 Apr 2022 13:28:32 +0800 Subject: [PATCH 08/29] * Fix bug#21385. --- module/tree/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/tree/model.php b/module/tree/model.php index ae318d04cb..a24c60649a 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -320,7 +320,7 @@ class treeModel extends model ksort($treeMenu); $topMenu = @array_shift($treeMenu); - $topMenu = explode("\n", trim($topMenu)); + $topMenu = explode("\n", trim((string)$topMenu)); foreach($topMenu as $menu) { if(!strpos($menu, '|')) continue; From 3f9feedfe7d98c51d2cc011eaf09f8339b6186d9 Mon Sep 17 00:00:00 2001 From: mayue Date: Tue, 12 Apr 2022 14:12:03 +0800 Subject: [PATCH 09/29] * Fix bug #18065. --- module/bug/control.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/module/bug/control.php b/module/bug/control.php index 7d55a0a81e..5f9cf69ae4 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -2045,6 +2045,8 @@ class bug extends control */ public function export($productID, $orderBy, $browseType = '', $executionID = 0) { + if($this->config->systemMode == 'classic') $this->config->bug->list->exportFields = str_replace(' project,', '', $this->config->bug->list->exportFields); + if($_POST) { $this->loadModel('file'); @@ -2054,6 +2056,7 @@ class bug extends control /* Create field lists. */ $fields = $this->post->exportFields ? $this->post->exportFields : explode(',', $bugConfig->list->exportFields); + foreach($fields as $key => $fieldName) { $fieldName = trim($fieldName); From 7f117b9a44cbfb61e1b6cb52d2a6e21ab086966a Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 12 Apr 2022 14:12:32 +0800 Subject: [PATCH 10/29] * Fix bug #18781. --- module/story/control.php | 31 ++----------------------------- 1 file changed, 2 insertions(+), 29 deletions(-) diff --git a/module/story/control.php b/module/story/control.php index abfe4b164f..5411b81ef8 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -183,21 +183,7 @@ class story extends control if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $storyID)); /* If link from no head then reload. */ - if(isonlybody()) - { - $execution = $this->execution->getByID($this->session->execution); - if($this->app->tab == 'execution' and $execution->type == 'kanban' and $this->app->tab == 'execution') - { - $kanbanData = $this->loadModel('kanban')->getRDKanban($this->session->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all'); - $kanbanData = json_encode($kanbanData); - - return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "parent.updateKanban($kanbanData, 0)")); - } - else - { - return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); - } - } + if(isonlybody()) return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent')); if($this->post->newStory) { @@ -485,21 +471,8 @@ class story extends control } if($this->viewType == 'json') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $stories)); - if(isonlybody()) - { - $execution = $this->execution->getByID($this->session->execution); - if($this->app->tab == 'execution' and $execution->type == 'kanban' and $this->app->tab == 'execution') - { - $kanbanData = $this->loadModel('kanban')->getRDKanban($this->session->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all'); - $kanbanData = json_encode($kanbanData); - return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); - } - else - { - return print(js::closeModal('parent.parent', 'this')); - } - } + if(isonlybody()) return print(js::closeModal('parent.parent', 'this')); if($storyID) { From cedd0270e2f8b328f645d9d653fa99c4967d5d7c Mon Sep 17 00:00:00 2001 From: mayue Date: Tue, 12 Apr 2022 14:14:32 +0800 Subject: [PATCH 11/29] * Optimize code. --- module/bug/control.php | 1 - 1 file changed, 1 deletion(-) diff --git a/module/bug/control.php b/module/bug/control.php index 5f9cf69ae4..c799e7d6e6 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -2056,7 +2056,6 @@ class bug extends control /* Create field lists. */ $fields = $this->post->exportFields ? $this->post->exportFields : explode(',', $bugConfig->list->exportFields); - foreach($fields as $key => $fieldName) { $fieldName = trim($fieldName); From 56d8a1ad051e6bcba02412e9492155464151faf9 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 12 Apr 2022 14:17:20 +0800 Subject: [PATCH 12/29] * Fix bug #21641. --- module/personnel/model.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/personnel/model.php b/module/personnel/model.php index 14456461f9..a083478c44 100644 --- a/module/personnel/model.php +++ b/module/personnel/model.php @@ -797,7 +797,7 @@ class personnelModel extends model */ public function deleteExecutionWhitelist($executionID, $account = '') { - $execution = $this->dao->select('id,whitelist')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch(); + $execution = $this->dao->select('id,whitelist,project')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch(); if(empty($execution)) return false; $result = $this->dao->delete()->from(TABLE_ACL) @@ -816,6 +816,7 @@ class personnelModel extends model $viewExecutions = $this->dao->select('sprints')->from(TABLE_USERVIEW)->where('account')->eq($account)->fetch('sprints'); $newViewExecutions = trim(str_replace(",$executionID,", '', ",$viewExecutions,"), ','); $this->dao->update(TABLE_USERVIEW)->set('sprints')->eq($newViewExecutions)->where('account')->eq($account)->exec(); + $this->deleteProjectWhitelist($execution->project, $account); } } From 9cb5cb11341ea7a27bc21b2e448a93b7f526a4db Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Tue, 12 Apr 2022 14:40:48 +0800 Subject: [PATCH 13/29] * Add api for resolve bug. --- api/v1/entries/bugresolve.php | 40 +++++++++++++++++++++++++++++++++++ config/routes.php | 1 + module/bug/control.php | 2 +- 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 api/v1/entries/bugresolve.php diff --git a/api/v1/entries/bugresolve.php b/api/v1/entries/bugresolve.php new file mode 100644 index 0000000000..6b5cf64ef8 --- /dev/null +++ b/api/v1/entries/bugresolve.php @@ -0,0 +1,40 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + **/ +class bugResolveEntry extends Entry +{ + /** + * POST method. + * + * @param int $bugID + * @access public + * @return void + */ + public function post($bugID) + { + $bug = $this->loadModel('bug')->getByID($bugID); + + $fields = 'resolution,resolvedBuild,resolvedDate,assignedTo,uid,comment'; + $this->batchSetPost($fields); + + $control = $this->loadController('bug', 'resolve'); + $control->resolve($bugID); + + $data = $this->getData(); + if(!$data) return $this->send400('error'); + if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); + + $bug = $this->bug->getByID($bugID); + + $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,resolvedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + } +} + diff --git a/config/routes.php b/config/routes.php index c7af65ffab..283d1b11c1 100644 --- a/config/routes.php +++ b/config/routes.php @@ -63,6 +63,7 @@ $routes['/bugs/:id'] = 'bug'; $routes['/bugs/:id/close'] = 'bugClose'; $routes['/bugs/:id/assign'] = 'bugAssign'; $routes['/bugs/:id/confirm'] = 'bugConfirm'; +$routes['/bugs/:id/resolve'] = 'bugResolve'; $routes['/programs/:id/projects'] = 'projects'; $routes['/products/:id/projects'] = 'productProjects'; diff --git a/module/bug/control.php b/module/bug/control.php index f692cd8dc7..2edc808c1e 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1561,7 +1561,7 @@ class bug extends control } if(defined('RUN_MODE') && RUN_MODE == 'api') { - return print(array('status' => 'success', 'data' => $bugID)); + return $this->send(array('status' => 'success', 'data' => $bugID)); } else { From 581479860a3a9c8549d4097c6ba26517bfb7e88b Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Tue, 12 Apr 2022 15:08:45 +0800 Subject: [PATCH 14/29] * Fix api . --- api/v1/entries/bugassign.php | 2 -- api/v1/entries/bugclose.php | 2 -- api/v1/entries/bugconfirm.php | 2 -- api/v1/entries/bugresolve.php | 2 -- api/v1/entries/storyactive.php | 2 -- api/v1/entries/storyassignto.php | 2 -- api/v1/entries/storyclose.php | 2 -- api/v1/entries/storyreview.php | 2 -- 8 files changed, 16 deletions(-) diff --git a/api/v1/entries/bugassign.php b/api/v1/entries/bugassign.php index 5aed6f06b6..7aa2d2557e 100644 --- a/api/v1/entries/bugassign.php +++ b/api/v1/entries/bugassign.php @@ -20,8 +20,6 @@ class bugAssignEntry extends Entry */ public function post($bugID) { - $bug = $this->loadModel('bug')->getByID($bugID); - $fields = 'assignedTo,mailto,comment'; $this->batchSetPost($fields); diff --git a/api/v1/entries/bugclose.php b/api/v1/entries/bugclose.php index b2de387493..0354297f74 100644 --- a/api/v1/entries/bugclose.php +++ b/api/v1/entries/bugclose.php @@ -20,8 +20,6 @@ class bugCloseEntry extends Entry */ public function post($bugID) { - $bug = $this->loadModel('bug')->getByID($bugID); - $fields = 'comment'; $this->batchSetPost($fields); diff --git a/api/v1/entries/bugconfirm.php b/api/v1/entries/bugconfirm.php index 91dc905ee1..6251bfb8eb 100644 --- a/api/v1/entries/bugconfirm.php +++ b/api/v1/entries/bugconfirm.php @@ -20,8 +20,6 @@ class bugConfirmEntry extends Entry **/ public function post($bugID) { - $bug = $this->loadModel('bug')->getById($bugID); - $fields = 'assignedTo,mailto,comment,pri,type'; $this->batchSetPost($fields); diff --git a/api/v1/entries/bugresolve.php b/api/v1/entries/bugresolve.php index 6b5cf64ef8..560c15541a 100644 --- a/api/v1/entries/bugresolve.php +++ b/api/v1/entries/bugresolve.php @@ -20,8 +20,6 @@ class bugResolveEntry extends Entry */ public function post($bugID) { - $bug = $this->loadModel('bug')->getByID($bugID); - $fields = 'resolution,resolvedBuild,resolvedDate,assignedTo,uid,comment'; $this->batchSetPost($fields); diff --git a/api/v1/entries/storyactive.php b/api/v1/entries/storyactive.php index d5d6189f55..59c86d27a4 100644 --- a/api/v1/entries/storyactive.php +++ b/api/v1/entries/storyactive.php @@ -21,8 +21,6 @@ class storyActiveEntry extends Entry */ public function post($storyID) { - $oldStory = $this->loadModel('story')->getByID($storyID); - $fields = 'assignedTo,status,comment'; $this->batchSetPost($fields); diff --git a/api/v1/entries/storyassignto.php b/api/v1/entries/storyassignto.php index a868427b84..62f9d81b76 100644 --- a/api/v1/entries/storyassignto.php +++ b/api/v1/entries/storyassignto.php @@ -20,8 +20,6 @@ class storyAssignToEntry extends Entry */ public function post($storyID) { - $story = $this->loadModel('story')->getByID($storyID); - $fields = 'assignedTo,comment'; $this->batchSetPost($fields); diff --git a/api/v1/entries/storyclose.php b/api/v1/entries/storyclose.php index a83948232e..28f5b5ebe1 100644 --- a/api/v1/entries/storyclose.php +++ b/api/v1/entries/storyclose.php @@ -20,8 +20,6 @@ class storyCloseEntry extends Entry */ public function post($storyID) { - $story = $this->loadModel('story')->getByID($storyID); - $fields = 'closedReason,duplicateStory,childStories,comment'; $this->batchSetPost($fields); diff --git a/api/v1/entries/storyreview.php b/api/v1/entries/storyreview.php index 887f23cf8a..d2bbef826d 100644 --- a/api/v1/entries/storyreview.php +++ b/api/v1/entries/storyreview.php @@ -21,8 +21,6 @@ class storyReviewEntry extends Entry */ public function post($storyID) { - $oldStory = $this->loadModel('story')->getByID($storyID); - $fields = 'reviewedDate,result,closedReason,pri,estimate,comment'; $this->batchSetPost($fields); From 07a887f62c6f3b07e135b2e392ebabbea211bb4f Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Tue, 12 Apr 2022 15:10:20 +0800 Subject: [PATCH 15/29] * Fix bug #17974 for objectlibs method. --- module/doc/js/objectlibs.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/module/doc/js/objectlibs.js b/module/doc/js/objectlibs.js index 8830c91235..080e036379 100644 --- a/module/doc/js/objectlibs.js +++ b/module/doc/js/objectlibs.js @@ -1,6 +1,13 @@ $(function() { if($.cookie('isFullScreen') == 1) fullScreen(); + + $('.menu-actions > a').click(function() + { + $(this).parent().hasClass('open') ? $(this).css('background', 'none') : $(this).css('background', '#f1f1f1'); + }) + + $('.menu-actions > a').blur(function() {$(this).css('background', 'none');}) }) /** From 0ccd5bf9b7aca9f0898c9aa35913c82f56b50716 Mon Sep 17 00:00:00 2001 From: zenggang Date: Tue, 12 Apr 2022 07:19:36 +0000 Subject: [PATCH 16/29] * Fix bug#21002 --- lib/phpthumb/GdThumb.inc.php | 447 ++++++++++++++++++----------------- 1 file changed, 224 insertions(+), 223 deletions(-) diff --git a/lib/phpthumb/GdThumb.inc.php b/lib/phpthumb/GdThumb.inc.php index c185f6e1a3..76d5875eb8 100644 --- a/lib/phpthumb/GdThumb.inc.php +++ b/lib/phpthumb/GdThumb.inc.php @@ -1,18 +1,18 @@ * Copyright (c) 2009, Ian Selby/Gen X Design - * + * * Author(s): Ian Selby - * + * * Licensed under the MIT License * Redistributions of files must retain the above copyright notice. - * + * * @author Ian Selby * @copyright Copyright (c) 2009 Gen X Design * @link http://phpthumb.gxdlabs.com @@ -24,9 +24,9 @@ /** * GdThumb Class Definition - * + * * This is the GD Implementation of the PHP Thumb library. - * + * * @package PhpThumb * @subpackage Core */ @@ -34,74 +34,74 @@ class GdThumb extends ThumbBase { /** * The prior image (before manipulation) - * + * * @var resource */ protected $oldImage; /** * The working image (used during manipulation) - * + * * @var resource */ protected $workingImage; /** * The current dimensions of the image - * + * * @var array */ protected $currentDimensions; /** * The new, calculated dimensions of the image - * + * * @var array */ protected $newDimensions; /** * The options for this class - * + * * This array contains various options that determine the behavior in - * various functions throughout the class. Functions note which specific + * various functions throughout the class. Functions note which specific * option key / values are used in their documentation - * + * * @var array */ protected $options; /** * The maximum width an image can be after resizing (in pixels) - * + * * @var int */ protected $maxWidth; /** * The maximum height an image can be after resizing (in pixels) - * + * * @var int */ protected $maxHeight; /** * The percentage to resize the image by - * + * * @var int */ protected $percent; - + /** * Class Constructor - * - * @return GdThumb + * + * @return GdThumb * @param string $fileName */ public function __construct ($fileName, $options = array(), $isDataStream = false) { parent::__construct($fileName, $isDataStream); - + $this->determineFormat(); - + if ($this->isDataStream === false) { $this->verifyFormatCompatiblity(); } - + switch ($this->format) { case 'GIF': @@ -117,21 +117,21 @@ class GdThumb extends ThumbBase $this->oldImage = imagecreatefromstring($this->fileName); break; } - + $this->currentDimensions = array ( 'width' => imagesx($this->oldImage), 'height' => imagesy($this->oldImage) ); - + $this->setOptions($options); - + // TODO: Port gatherImageMeta to a separate function that can be called to extract exif data } - + /** * Class Destructor - * + * */ public function __destruct () { @@ -139,24 +139,24 @@ class GdThumb extends ThumbBase { imagedestroy($this->oldImage); } - + if (is_resource($this->workingImage)) { imagedestroy($this->workingImage); } } - + ############################## # ----- API FUNCTIONS ------ # ############################## - + /** * Resizes an image to be no larger than $maxWidth or $maxHeight - * + * * If either param is set to zero, then that dimension will not be considered as a part of the resize. * Additionally, if $this->options['resizeUp'] is set to true (false by default), then this function will * also scale the image up to the maximum dimensions provided. - * + * * @param int $maxWidth The maximum width of the image in pixels * @param int $maxHeight The maximum height of the image in pixels * @return GdThumb @@ -168,12 +168,12 @@ class GdThumb extends ThumbBase { throw new InvalidArgumentException('$maxWidth must be numeric'); } - + if (!is_numeric($maxHeight)) { throw new InvalidArgumentException('$maxHeight must be numeric'); } - + // make sure we're not exceeding our image size if we're not supposed to if ($this->options['resizeUp'] === false) { @@ -185,10 +185,10 @@ class GdThumb extends ThumbBase $this->maxHeight = intval($maxHeight); $this->maxWidth = intval($maxWidth); } - + // get the new dimensions... $this->calcImageSize($this->currentDimensions['width'], $this->currentDimensions['height']); - + // create the working image if (function_exists('imagecreatetruecolor')) { @@ -198,9 +198,9 @@ class GdThumb extends ThumbBase { $this->workingImage = imagecreate($this->newDimensions['newWidth'], $this->newDimensions['newHeight']); } - - $this->preserveAlpha(); - + + $this->preserveAlpha(); + // and create the newly sized image imagecopyresampled ( @@ -220,16 +220,16 @@ class GdThumb extends ThumbBase $this->oldImage = $this->workingImage; $this->currentDimensions['width'] = $this->newDimensions['newWidth']; $this->currentDimensions['height'] = $this->newDimensions['newHeight']; - + return $this; } - + /** * Adaptively Resizes the Image - * - * This function attempts to get the image to as close to the provided dimensions as possible, and then crops the + * + * This function attempts to get the image to as close to the provided dimensions as possible, and then crops the * remaining overflow (from the center) to get the image to be the size specified - * + * * @param int $maxWidth * @param int $maxHeight * @return GdThumb @@ -241,12 +241,12 @@ class GdThumb extends ThumbBase { throw new InvalidArgumentException('$width must be numeric and greater than zero'); } - + if (!is_numeric($height) || $height == 0) { throw new InvalidArgumentException('$height must be numeric and greater than zero'); } - + // make sure we're not exceeding our image size if we're not supposed to if ($this->options['resizeUp'] === false) { @@ -258,12 +258,12 @@ class GdThumb extends ThumbBase $this->maxHeight = intval($height); $this->maxWidth = intval($width); } - + $this->calcImageSizeStrict($this->currentDimensions['width'], $this->currentDimensions['height']); - + // resize the image to be close to our desired dimensions $this->resize($this->newDimensions['newWidth'], $this->newDimensions['newHeight']); - + // reset the max dimensions... if ($this->options['resizeUp'] === false) { @@ -275,7 +275,7 @@ class GdThumb extends ThumbBase $this->maxHeight = intval($height); $this->maxWidth = intval($width); } - + // create the working image if (function_exists('imagecreatetruecolor')) { @@ -285,14 +285,14 @@ class GdThumb extends ThumbBase { $this->workingImage = imagecreate($this->maxWidth, $this->maxHeight); } - + $this->preserveAlpha(); - + $cropWidth = $this->maxWidth; $cropHeight = $this->maxHeight; $cropX = 0; $cropY = 0; - + // now, figure out how to crop the rest of the image... if ($this->currentDimensions['width'] > $this->maxWidth) { @@ -302,7 +302,7 @@ class GdThumb extends ThumbBase { $cropY = intval(($this->currentDimensions['height'] - $this->maxHeight) / 2); } - + imagecopyresampled ( $this->workingImage, @@ -316,20 +316,20 @@ class GdThumb extends ThumbBase $cropWidth, $cropHeight ); - + // update all the variables and resources to be correct $this->oldImage = $this->workingImage; $this->currentDimensions['width'] = $this->maxWidth; $this->currentDimensions['height'] = $this->maxHeight; - + return $this; } - + /** * Resizes an image by a given percent uniformly - * + * * Percentage should be whole number representation (i.e. 1-100) - * + * * @param int $percent * @return GdThumb */ @@ -339,11 +339,11 @@ class GdThumb extends ThumbBase { throw new InvalidArgumentException ('$percent must be numeric'); } - + $this->percent = intval($percent); - + $this->calcImageSizePercent($this->currentDimensions['width'], $this->currentDimensions['height']); - + if (function_exists('imagecreatetruecolor')) { $this->workingImage = imagecreatetruecolor($this->newDimensions['newWidth'], $this->newDimensions['newHeight']); @@ -352,9 +352,9 @@ class GdThumb extends ThumbBase { $this->workingImage = imagecreate($this->newDimensions['newWidth'], $this->newDimensions['newHeight']); } - + $this->preserveAlpha(); - + ImageCopyResampled( $this->workingImage, $this->oldImage, @@ -371,15 +371,15 @@ class GdThumb extends ThumbBase $this->oldImage = $this->workingImage; $this->currentDimensions['width'] = $this->newDimensions['newWidth']; $this->currentDimensions['height'] = $this->newDimensions['newHeight']; - + return $this; } - + /** * Crops an image from the center with provided dimensions - * + * * If no height is given, the width will be used as a height, thus creating a square crop - * + * * @param int $cropWidth * @param int $cropHeight * @return GdThumb @@ -390,31 +390,31 @@ class GdThumb extends ThumbBase { throw new InvalidArgumentException('$cropWidth must be numeric'); } - + if ($cropHeight !== null && !is_numeric($cropHeight)) { throw new InvalidArgumentException('$cropHeight must be numeric'); } - + if ($cropHeight === null) { $cropHeight = $cropWidth; } - + $cropWidth = ($this->currentDimensions['width'] < $cropWidth) ? $this->currentDimensions['width'] : $cropWidth; $cropHeight = ($this->currentDimensions['height'] < $cropHeight) ? $this->currentDimensions['height'] : $cropHeight; - + $cropX = intval(($this->currentDimensions['width'] - $cropWidth) / 2); $cropY = intval(($this->currentDimensions['height'] - $cropHeight) / 2); - + $this->crop($cropX, $cropY, $cropWidth, $cropHeight); - + return $this; } - + /** * Vanilla Cropping - Crops from x,y with specified width and height - * + * * @param int $startX * @param int $startY * @param int $cropWidth @@ -428,48 +428,48 @@ class GdThumb extends ThumbBase { throw new InvalidArgumentException('$startX must be numeric'); } - + if (!is_numeric($startY)) { throw new InvalidArgumentException('$startY must be numeric'); } - + if (!is_numeric($cropWidth)) { throw new InvalidArgumentException('$cropWidth must be numeric'); } - + if (!is_numeric($cropHeight)) { throw new InvalidArgumentException('$cropHeight must be numeric'); } - + // do some calculations $cropWidth = ($this->currentDimensions['width'] < $cropWidth) ? $this->currentDimensions['width'] : $cropWidth; $cropHeight = ($this->currentDimensions['height'] < $cropHeight) ? $this->currentDimensions['height'] : $cropHeight; - + // ensure everything's in bounds if (($startX + $cropWidth) > $this->currentDimensions['width']) { $startX = ($this->currentDimensions['width'] - $cropWidth); - + } - + if (($startY + $cropHeight) > $this->currentDimensions['height']) { $startY = ($this->currentDimensions['height'] - $cropHeight); } - - if ($startX < 0) + + if ($startX < 0) { $startX = 0; } - - if ($startY < 0) + + if ($startY < 0) { $startY = 0; } - + // create the working image if (function_exists('imagecreatetruecolor')) { @@ -479,9 +479,9 @@ class GdThumb extends ThumbBase { $this->workingImage = imagecreate($cropWidth, $cropHeight); } - + $this->preserveAlpha(); - + imagecopyresampled ( $this->workingImage, @@ -495,37 +495,37 @@ class GdThumb extends ThumbBase $cropWidth, $cropHeight ); - + $this->oldImage = $this->workingImage; $this->currentDimensions['width'] = $cropWidth; $this->currentDimensions['height'] = $cropHeight; - + return $this; } - + /** * Rotates image either 90 degrees clockwise or counter-clockwise - * + * * @param string $direction * @retunrn GdThumb */ - public function rotateImage ($direction = 'CW') + public function rotateImage ($direction = 'CW') { - if ($direction == 'CW') + if ($direction == 'CW') { $this->rotateImageNDegrees(90); } - else + else { $this->rotateImageNDegrees(-90); } - + return $this; } - + /** * Rotates image specified number of degrees - * + * * @param int $degrees * @return GdThumb */ @@ -535,69 +535,69 @@ class GdThumb extends ThumbBase { throw new InvalidArgumentException('$degrees must be numeric'); } - + if (!function_exists('imagerotate')) { throw new RuntimeException('Your version of GD does not support image rotation.'); } - + $this->workingImage = imagerotate($this->oldImage, $degrees, 0); - + $newWidth = $this->currentDimensions['height']; $newHeight = $this->currentDimensions['width']; $this->oldImage = $this->workingImage; $this->currentDimensions['width'] = $newWidth; $this->currentDimensions['height'] = $newHeight; - + return $this; } - + /** * Shows an image - * + * * This function will show the current image by first sending the appropriate header - * for the format, and then outputting the image data. If headers have already been sent, - * a runtime exception will be thrown - * + * for the format, and then outputting the image data. If headers have already been sent, + * a runtime exception will be thrown + * * @param bool $rawData Whether or not the raw image stream should be output * @return GdThumb */ - public function show ($rawData = false) + public function show ($rawData = false) { if (headers_sent()) { throw new RuntimeException('Cannot show image, headers have already been sent'); } - - switch ($this->format) + + switch ($this->format) { case 'GIF': - if ($rawData === false) - { - header('Content-type: image/gif'); + if ($rawData === false) + { + header('Content-type: image/gif'); } imagegif($this->oldImage); break; case 'JPG': - if ($rawData === false) - { - header('Content-type: image/jpeg'); + if ($rawData === false) + { + header('Content-type: image/jpeg'); } imagejpeg($this->oldImage, null, $this->options['jpegQuality']); break; case 'PNG': case 'STRING': - if ($rawData === false) - { - header('Content-type: image/png'); + if ($rawData === false) + { + header('Content-type: image/png'); } imagepng($this->oldImage); break; } - + return $this; } - + /** * Returns the Working Image as a String * @@ -613,21 +613,21 @@ class GdThumb extends ThumbBase $this->show(true); $data = ob_get_contents(); ob_end_clean(); - + return $data; } - + /** * Saves an image - * + * * This function will make sure the target directory is writeable, and then save the image. - * + * * If the target directory is not writeable, the function will try to correct the permissions (if allowed, this * is set as an option ($this->options['correctPermissions']). If the target cannot be made writeable, then a * RuntimeException is thrown. - * + * * TODO: Create additional paramter for color matte when saving images with alpha to non-alpha formats (i.e. PNG => JPG) - * + * * @param string $fileName The full path and filename of the image to save * @param string $format The format to save the image in (optional, must be one of [GIF,JPG,PNG] * @return GdThumb @@ -636,12 +636,12 @@ class GdThumb extends ThumbBase { $validFormats = array('GIF', 'JPG', 'PNG'); $format = ($format !== null) ? strtoupper($format) : $this->format; - + if (!in_array($format, $validFormats)) { throw new InvalidArgumentException ('Invalid format type specified in save function: ' . $format); } - + // make sure the directory is writeable if (!is_writeable(dirname($fileName))) { @@ -649,7 +649,7 @@ class GdThumb extends ThumbBase if ($this->options['correctPermissions'] === true) { @chmod(dirname($fileName), 0777); - + // throw an exception if not writeable if (!is_writeable(dirname($fileName))) { @@ -662,8 +662,8 @@ class GdThumb extends ThumbBase throw new RuntimeException ('File not writeable: ' . $fileName); } } - - switch ($format) + + switch ($format) { case 'GIF': imagegif($this->oldImage, $fileName); @@ -675,17 +675,17 @@ class GdThumb extends ThumbBase imagepng($this->oldImage, $fileName); break; } - + return $this; } - + ################################# # ----- GETTERS / SETTERS ----- # ################################# - + /** * Sets $this->options to $options - * + * * @param array $options */ public function setOptions ($options = array()) @@ -695,17 +695,17 @@ class GdThumb extends ThumbBase { $this->options = array(); } - + // make sure we've gotten a proper argument if (!is_array($options)) { throw new InvalidArgumentException ('setOptions requires an array'); } - + // we've yet to init the default options, so create them here if (sizeof($this->options) == 0) { - $defaultOptions = array + $defaultOptions = array ( 'resizeUp' => false, 'jpegQuality' => 100, @@ -721,10 +721,10 @@ class GdThumb extends ThumbBase { $defaultOptions = $this->options; } - + $this->options = array_merge($defaultOptions, $options); } - + /** * Returns $currentDimensions. * @@ -734,7 +734,7 @@ class GdThumb extends ThumbBase { return $this->currentDimensions; } - + /** * Sets $currentDimensions. * @@ -745,7 +745,7 @@ class GdThumb extends ThumbBase { $this->currentDimensions = $currentDimensions; } - + /** * Returns $maxHeight. * @@ -755,7 +755,7 @@ class GdThumb extends ThumbBase { return $this->maxHeight; } - + /** * Sets $maxHeight. * @@ -766,7 +766,7 @@ class GdThumb extends ThumbBase { $this->maxHeight = $maxHeight; } - + /** * Returns $maxWidth. * @@ -776,7 +776,7 @@ class GdThumb extends ThumbBase { return $this->maxWidth; } - + /** * Sets $maxWidth. * @@ -787,7 +787,7 @@ class GdThumb extends ThumbBase { $this->maxWidth = $maxWidth; } - + /** * Returns $newDimensions. * @@ -797,7 +797,7 @@ class GdThumb extends ThumbBase { return $this->newDimensions; } - + /** * Sets $newDimensions. * @@ -808,7 +808,7 @@ class GdThumb extends ThumbBase { $this->newDimensions = $newDimensions; } - + /** * Returns $options. * @@ -818,7 +818,7 @@ class GdThumb extends ThumbBase { return $this->options; } - + /** * Returns $percent. * @@ -828,7 +828,7 @@ class GdThumb extends ThumbBase { return $this->percent; } - + /** * Sets $percent. * @@ -838,8 +838,8 @@ class GdThumb extends ThumbBase public function setPercent ($percent) { $this->percent = $percent; - } - + } + /** * Returns $oldImage. * @@ -849,7 +849,7 @@ class GdThumb extends ThumbBase { return $this->oldImage; } - + /** * Sets $oldImage. * @@ -860,7 +860,7 @@ class GdThumb extends ThumbBase { $this->oldImage = $oldImage; } - + /** * Returns $workingImage. * @@ -870,7 +870,7 @@ class GdThumb extends ThumbBase { return $this->workingImage; } - + /** * Sets $workingImage. * @@ -880,17 +880,17 @@ class GdThumb extends ThumbBase public function setWorkingImage ($workingImage) { $this->workingImage = $workingImage; - } - - + } + + ################################# # ----- UTILITY FUNCTIONS ----- # ################################# - + /** * Calculates a new width and height for the image based on $this->maxWidth and the provided dimensions - * - * @return array + * + * @return array * @param int $width * @param int $height */ @@ -898,18 +898,18 @@ class GdThumb extends ThumbBase { $newWidthPercentage = (100 * $this->maxWidth) / $width; $newHeight = ($height * $newWidthPercentage) / 100; - + return array ( 'newWidth' => intval($this->maxWidth), 'newHeight' => intval($newHeight) ); } - + /** * Calculates a new width and height for the image based on $this->maxWidth and the provided dimensions - * - * @return array + * + * @return array * @param int $width * @param int $height */ @@ -917,18 +917,18 @@ class GdThumb extends ThumbBase { $newHeightPercentage = (100 * $this->maxHeight) / $height; $newWidth = ($width * $newHeightPercentage) / 100; - + return array ( 'newWidth' => ceil($newWidth), 'newHeight' => ceil($this->maxHeight) ); } - + /** * Calculates a new width and height for the image based on $this->percent and the provided dimensions - * - * @return array + * + * @return array * @param int $width * @param int $height */ @@ -936,19 +936,19 @@ class GdThumb extends ThumbBase { $newWidth = ($width * $this->percent) / 100; $newHeight = ($height * $this->percent) / 100; - - return array + + return array ( 'newWidth' => ceil($newWidth), 'newHeight' => ceil($newHeight) ); } - + /** * Calculates the new image dimensions - * + * * These calculations are based on both the provided dimensions and $this->maxWidth and $this->maxHeight - * + * * @param int $width * @param int $height */ @@ -959,33 +959,33 @@ class GdThumb extends ThumbBase 'newWidth' => $width, 'newHeight' => $height ); - + if ($this->maxWidth > 0) { $newSize = $this->calcWidth($width, $height); - + if ($this->maxHeight > 0 && $newSize['newHeight'] > $this->maxHeight) { $newSize = $this->calcHeight($newSize['newWidth'], $newSize['newHeight']); } } - + if ($this->maxHeight > 0) { $newSize = $this->calcHeight($width, $height); - + if ($this->maxWidth > 0 && $newSize['newWidth'] > $this->maxWidth) { $newSize = $this->calcWidth($newSize['newWidth'], $newSize['newHeight']); } } - + $this->newDimensions = $newSize; } - + /** - * Calculates new image dimensions, not allowing the width and height to be less than either the max width or height - * + * Calculates new image dimensions, not allowing the width and height to be less than either the max width or height + * * @param int $width * @param int $height */ @@ -998,7 +998,7 @@ class GdThumb extends ThumbBase if ($width > $height) { $newDimensions = $this->calcHeight($width, $height); - + if ($newDimensions['newWidth'] < $this->maxWidth) { $newDimensions = $this->calcWidth($width, $height); @@ -1007,7 +1007,7 @@ class GdThumb extends ThumbBase elseif ($height >= $width) { $newDimensions = $this->calcWidth($width, $height); - + if ($newDimensions['newHeight'] < $this->maxHeight) { $newDimensions = $this->calcHeight($width, $height); @@ -1019,7 +1019,7 @@ class GdThumb extends ThumbBase if ($width >= $height) { $newDimensions = $this->calcWidth($width, $height); - + if ($newDimensions['newHeight'] < $this->maxHeight) { $newDimensions = $this->calcHeight($width, $height); @@ -1028,20 +1028,20 @@ class GdThumb extends ThumbBase elseif ($height > $width) { $newDimensions = $this->calcHeight($width, $height); - + if ($newDimensions['newWidth'] < $this->maxWidth) { $newDimensions = $this->calcWidth($width, $height); } } } - + $this->newDimensions = $newDimensions; } - + /** * Calculates new dimensions based on $this->percent and the provided dimensions - * + * * @param int $width * @param int $height */ @@ -1052,12 +1052,12 @@ class GdThumb extends ThumbBase $this->newDimensions = $this->calcPercent($width, $height); } } - + /** * Determines the file format by mime-type - * + * * This function will throw exceptions for invalid images / mime-types - * + * */ protected function determineFormat () { @@ -1066,9 +1066,9 @@ class GdThumb extends ThumbBase $this->format = 'STRING'; return; } - + $formatInfo = getimagesize($this->fileName); - + // non-image files will return false if ($formatInfo === false) { @@ -1080,19 +1080,20 @@ class GdThumb extends ThumbBase { $this->triggerError('File is not a valid image: ' . $this->fileName); } - + // make sure we really stop execution return; } - + $mimeType = isset($formatInfo['mime']) ? $formatInfo['mime'] : null; - + switch ($mimeType) { case 'image/gif': $this->format = 'GIF'; break; case 'image/jpeg': + case 'image/x-ms-bmp': $this->format = 'JPG'; break; case 'image/png': @@ -1102,16 +1103,16 @@ class GdThumb extends ThumbBase $this->triggerError('Image format not supported: ' . $mimeType); } } - + /** * Makes sure the correct GD implementation exists for the file type - * + * */ protected function verifyFormatCompatiblity () { $isCompatible = true; $gdInfo = gd_info(); - + switch ($this->format) { case 'GIF': @@ -1126,44 +1127,44 @@ class GdThumb extends ThumbBase default: $isCompatible = false; } - + if (!$isCompatible) { // one last check for "JPEG" instead $isCompatible = $gdInfo['JPEG Support']; - + if (!$isCompatible) { $this->triggerError('Your GD installation does not support ' . $this->format . ' image types'); } } } - + /** * Preserves the alpha or transparency for PNG and GIF files - * + * * Alpha / transparency will not be preserved if the appropriate options are set to false. - * Also, the GIF transparency is pretty skunky (the results aren't awesome), but it works like a + * Also, the GIF transparency is pretty skunky (the results aren't awesome), but it works like a * champ... that's the nature of GIFs tho, so no huge surprise. - * + * * This functionality was originally suggested by commenter Aimi (no links / site provided) - Thanks! :) - * + * */ protected function preserveAlpha () { if ($this->format == 'PNG' && $this->options['preserveAlpha'] === true) { imagealphablending($this->workingImage, false); - + $colorTransparent = imagecolorallocatealpha ( - $this->workingImage, - $this->options['alphaMaskColor'][0], - $this->options['alphaMaskColor'][1], - $this->options['alphaMaskColor'][2], + $this->workingImage, + $this->options['alphaMaskColor'][0], + $this->options['alphaMaskColor'][1], + $this->options['alphaMaskColor'][2], 0 ); - + imagefill($this->workingImage, 0, 0, $colorTransparent); imagesavealpha($this->workingImage, true); } @@ -1172,14 +1173,14 @@ class GdThumb extends ThumbBase { $colorTransparent = imagecolorallocate ( - $this->workingImage, - $this->options['transparencyMaskColor'][0], - $this->options['transparencyMaskColor'][1], - $this->options['transparencyMaskColor'][2] + $this->workingImage, + $this->options['transparencyMaskColor'][0], + $this->options['transparencyMaskColor'][1], + $this->options['transparencyMaskColor'][2] ); - + imagecolortransparent($this->workingImage, $colorTransparent); imagetruecolortopalette($this->workingImage, true, 256); } } -} \ No newline at end of file +} From 69be820156e56b7d175f7b0b10ef65728308c153 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 12 Apr 2022 15:19:39 +0800 Subject: [PATCH 17/29] * Restore code. --- module/personnel/model.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module/personnel/model.php b/module/personnel/model.php index a083478c44..14456461f9 100644 --- a/module/personnel/model.php +++ b/module/personnel/model.php @@ -797,7 +797,7 @@ class personnelModel extends model */ public function deleteExecutionWhitelist($executionID, $account = '') { - $execution = $this->dao->select('id,whitelist,project')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch(); + $execution = $this->dao->select('id,whitelist')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch(); if(empty($execution)) return false; $result = $this->dao->delete()->from(TABLE_ACL) @@ -816,7 +816,6 @@ class personnelModel extends model $viewExecutions = $this->dao->select('sprints')->from(TABLE_USERVIEW)->where('account')->eq($account)->fetch('sprints'); $newViewExecutions = trim(str_replace(",$executionID,", '', ",$viewExecutions,"), ','); $this->dao->update(TABLE_USERVIEW)->set('sprints')->eq($newViewExecutions)->where('account')->eq($account)->exec(); - $this->deleteProjectWhitelist($execution->project, $account); } } From a13a8ce57028377fe43352230280b50ab1af027d Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Tue, 12 Apr 2022 15:23:31 +0800 Subject: [PATCH 18/29] * Fix api. --- api/v1/entries/bugassign.php | 2 +- api/v1/entries/bugclose.php | 3 +-- api/v1/entries/bugconfirm.php | 2 +- api/v1/entries/bugresolve.php | 2 +- api/v1/entries/storyassignto.php | 2 +- api/v1/entries/storyclose.php | 2 +- config/routes.php | 1 + 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/api/v1/entries/bugassign.php b/api/v1/entries/bugassign.php index 7aa2d2557e..3b505d0a12 100644 --- a/api/v1/entries/bugassign.php +++ b/api/v1/entries/bugassign.php @@ -30,7 +30,7 @@ class bugAssignEntry extends Entry if(!$data) return $this->send400('error'); if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); - $bug = $this->bug->getByID($bugID); + $bug = $this->loadModel('bug')->getByID($bugID); $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } diff --git a/api/v1/entries/bugclose.php b/api/v1/entries/bugclose.php index 0354297f74..4a95bbda36 100644 --- a/api/v1/entries/bugclose.php +++ b/api/v1/entries/bugclose.php @@ -29,8 +29,7 @@ class bugCloseEntry extends Entry $data = $this->getData(); if(!$data) return $this->send400('error'); if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); - - $bug = $this->bug->getByID($bugID); + $bug = $this->loadModel('bug')->getByID($bugID); $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } diff --git a/api/v1/entries/bugconfirm.php b/api/v1/entries/bugconfirm.php index 6251bfb8eb..c9875aaeda 100644 --- a/api/v1/entries/bugconfirm.php +++ b/api/v1/entries/bugconfirm.php @@ -30,7 +30,7 @@ class bugConfirmEntry extends Entry if(!$data) return $this->send400('error'); if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); - $bug = $this->bug->getById($bugID); + $bug = this->loadModel('bug')->getByID($bugID); $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } diff --git a/api/v1/entries/bugresolve.php b/api/v1/entries/bugresolve.php index 560c15541a..e8c699c784 100644 --- a/api/v1/entries/bugresolve.php +++ b/api/v1/entries/bugresolve.php @@ -30,7 +30,7 @@ class bugResolveEntry extends Entry if(!$data) return $this->send400('error'); if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); - $bug = $this->bug->getByID($bugID); + $bug = $this->loadModel('bug')->getByID($bugID); $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,resolvedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } diff --git a/api/v1/entries/storyassignto.php b/api/v1/entries/storyassignto.php index 62f9d81b76..e101cb17e1 100644 --- a/api/v1/entries/storyassignto.php +++ b/api/v1/entries/storyassignto.php @@ -30,7 +30,7 @@ class storyAssignToEntry extends Entry if(!$data) return $this->send400('error'); if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); - $story = $this->story->getByID($storyID); + $story = $this->loadModel('story')->getByID($storyID); $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } diff --git a/api/v1/entries/storyclose.php b/api/v1/entries/storyclose.php index 28f5b5ebe1..4d4141b88a 100644 --- a/api/v1/entries/storyclose.php +++ b/api/v1/entries/storyclose.php @@ -30,7 +30,7 @@ class storyCloseEntry extends Entry if(!$data) return $this->send400('error'); if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); - $story = $this->story->getByID($storyID); + $story = $this->loadModel('story')->getByID($storyID); $this->send(200, $this->format($story, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); } diff --git a/config/routes.php b/config/routes.php index 283d1b11c1..fbd3fdb26a 100644 --- a/config/routes.php +++ b/config/routes.php @@ -64,6 +64,7 @@ $routes['/bugs/:id/close'] = 'bugClose'; $routes['/bugs/:id/assign'] = 'bugAssign'; $routes['/bugs/:id/confirm'] = 'bugConfirm'; $routes['/bugs/:id/resolve'] = 'bugResolve'; +$routes['/bugs/:id/active'] = 'bugActive'; $routes['/programs/:id/projects'] = 'projects'; $routes['/products/:id/projects'] = 'productProjects'; From 4aaefa9fb7914c7660930b7c055bf467c9c957fa Mon Sep 17 00:00:00 2001 From: mayue Date: Tue, 12 Apr 2022 15:24:47 +0800 Subject: [PATCH 19/29] * Fix bug #18065. --- module/bug/config.php | 1 + module/bug/control.php | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/module/bug/config.php b/module/bug/config.php index e906790f76..b73dec9c3e 100644 --- a/module/bug/config.php +++ b/module/bug/config.php @@ -37,6 +37,7 @@ $config->bug->list->exportFields = 'id, product, branch, module, project, execut case, lastEditedBy, lastEditedDate, files'; +if($config->systemMode == 'classic') $config->bug->list->exportFields = str_replace(' project,', '', $config->bug->list->exportFields); $config->bug->list->customCreateFields = 'execution,story,task,pri,severity,os,browser,deadline,mailto,keywords'; $config->bug->list->customBatchCreateFields = 'execution,steps,type,pri,deadline,severity,os,browser,keywords'; diff --git a/module/bug/control.php b/module/bug/control.php index c799e7d6e6..7d55a0a81e 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -2045,8 +2045,6 @@ class bug extends control */ public function export($productID, $orderBy, $browseType = '', $executionID = 0) { - if($this->config->systemMode == 'classic') $this->config->bug->list->exportFields = str_replace(' project,', '', $this->config->bug->list->exportFields); - if($_POST) { $this->loadModel('file'); From 0909c6602be31b2660a8325502f3ed65c5d3dff8 Mon Sep 17 00:00:00 2001 From: zhengrunyu Date: Tue, 12 Apr 2022 15:25:04 +0800 Subject: [PATCH 20/29] * Add api for active bug. --- api/v1/entries/bugactive.php | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 api/v1/entries/bugactive.php diff --git a/api/v1/entries/bugactive.php b/api/v1/entries/bugactive.php new file mode 100644 index 0000000000..d9029fa978 --- /dev/null +++ b/api/v1/entries/bugactive.php @@ -0,0 +1,38 @@ + + * @package entries + * @version 1 + * @link http://www.zentao.net + **/ +class bugActiveEntry extends Entry +{ + /** + * POST method. + * + * @param int $bugID + * @access public + * @return void + */ + public function post($bugID) + { + $fields = 'assignedTo,uid,resolvedBuild,comment'; + $this->batchSetPost($fields); + + $control = $this->loadController('bug', 'activate'); + $control->activate($bugID); + + $data = $this->getData(); + if(!$data) return $this->send400('error'); + if(isset($data->status) and $data->status == 'fail') return $this->sendError(zget($data, 'code', 400), $data->message); + + $bug = $this->loadModel('bug')->getByID($bugID); + + $this->send(200, $this->format($bug, 'openedBy:user,openedDate:time,assignedTo:user,assignedDate:time,reviewedBy:user,reviewedDate:time,lastEditedBy:user,lastEditedDate:time,closedBy:user,closedDate:time,deleted:bool,mailto:userList')); + } +} + From e7314a8343e09690ca588f8bc756ae95eff4279e Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 12 Apr 2022 15:27:51 +0800 Subject: [PATCH 21/29] * Fix bug#19625. --- module/execution/model.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index b78e43efea..bfe6908a0b 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -3315,8 +3315,6 @@ class executionModel extends model ->page($pager) ->fetchAll('id'); - $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'task'); - if($tasks) return $this->loadModel('task')->processTasks($tasks); return array(); } From 95e6a143a86d7bf2807a944697602ade9840a673 Mon Sep 17 00:00:00 2001 From: songchenxuan Date: Tue, 12 Apr 2022 15:37:55 +0800 Subject: [PATCH 22/29] * Move doc lang. --- module/doc/lang/en.php | 66 +++++++++++++++++++-------------------- module/doc/lang/zh-cn.php | 66 +++++++++++++++++++-------------------- module/doc/lang/zh-tw.php | 64 ++++++++++++++++++------------------- 3 files changed, 98 insertions(+), 98 deletions(-) diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index 5830a1b3bb..7fa62b2cd8 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -9,6 +9,39 @@ * @version $Id: en.php 824 2010-05-02 15:32:06Z wwccss $ * @link http://www.zentao.net */ +$lang->doclib = new stdclass(); +$lang->doclib->name = 'Name'; +$lang->doclib->control = 'Access Control'; +$lang->doclib->group = 'Group'; +$lang->doclib->user = 'User'; +$lang->doclib->files = 'Attachments'; +$lang->doclib->all = 'All Libraries'; +$lang->doclib->select = 'Select'; +$lang->doclib->execution = $lang->executionCommon . ' Library'; +$lang->doclib->product = $lang->productCommon . ' Library'; +$lang->doclib->apiLibName = 'Api Library Name'; + +$lang->doclib->aclListA['default'] = 'Default'; +$lang->doclib->aclListA['custom'] = 'Custom'; + +$lang->doclib->aclListB['open'] = 'Public'; +$lang->doclib->aclListB['custom'] = 'Custom'; +$lang->doclib->aclListB['private'] = 'Private'; + +$lang->doclib->create['product'] = 'Create ' . $lang->productCommon . ' Library'; +$lang->doclib->create['execution'] = 'Create ' . $lang->executionCommon . ' Library'; +$lang->doclib->create['custom'] = 'Create Custom Library'; + +$lang->doclib->main['product'] = 'Primary Library'; +$lang->doclib->main['project'] = 'Primary Library'; +$lang->doclib->main['execution'] = 'Primary Library'; + +$lang->doclib->tabList['product'] = $lang->productCommon; +$lang->doclib->tabList['execution'] = $lang->executionCommon; +$lang->doclib->tabList['custom'] = 'Custom'; + +$lang->doclib->nameList['custom'] = 'Custom Name'; + /* Fields. */ $lang->doc->common = 'Document'; $lang->doc->id = 'ID'; @@ -229,36 +262,3 @@ $lang->doc->placeholder->url = 'URL'; $lang->doc->summary = "Total files on this page: %s , total size: %s, %s."; $lang->doc->ge = ':'; $lang->doc->point = '.'; - -$lang->doclib = new stdclass(); -$lang->doclib->name = 'Name'; -$lang->doclib->control = 'Access Control'; -$lang->doclib->group = 'Group'; -$lang->doclib->user = 'User'; -$lang->doclib->files = 'Attachments'; -$lang->doclib->all = 'All Libraries'; -$lang->doclib->select = 'Select'; -$lang->doclib->execution = $lang->executionCommon . ' Library'; -$lang->doclib->product = $lang->productCommon . ' Library'; -$lang->doclib->apiLibName = 'Api Library Name'; - -$lang->doclib->aclListA['default'] = 'Default'; -$lang->doclib->aclListA['custom'] = 'Custom'; - -$lang->doclib->aclListB['open'] = 'Public'; -$lang->doclib->aclListB['custom'] = 'Custom'; -$lang->doclib->aclListB['private'] = 'Private'; - -$lang->doclib->create['product'] = 'Create ' . $lang->productCommon . ' Library'; -$lang->doclib->create['execution'] = 'Create ' . $lang->executionCommon . ' Library'; -$lang->doclib->create['custom'] = 'Create Custom Library'; - -$lang->doclib->main['product'] = 'Primary Library'; -$lang->doclib->main['project'] = 'Primary Library'; -$lang->doclib->main['execution'] = 'Primary Library'; - -$lang->doclib->tabList['product'] = $lang->productCommon; -$lang->doclib->tabList['execution'] = $lang->executionCommon; -$lang->doclib->tabList['custom'] = 'Custom'; - -$lang->doclib->nameList['custom'] = 'Custom Name'; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index 3434c59ccb..c850ff1b94 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -9,6 +9,39 @@ * @version $Id: zh-cn.php 824 2010-05-02 15:32:06Z wwccss $ * @link http://www.zentao.net */ +$lang->doclib = new stdclass(); +$lang->doclib->name = '文档库名称'; +$lang->doclib->control = '访问控制'; +$lang->doclib->group = '分组'; +$lang->doclib->user = '用户'; +$lang->doclib->files = '附件库'; +$lang->doclib->all = '所有文档库'; +$lang->doclib->select = '选择文档库'; +$lang->doclib->execution = $lang->executionCommon . '库'; +$lang->doclib->product = $lang->productCommon . '库'; +$lang->doclib->apiLibName = '接口库名称'; + +$lang->doclib->aclListA['default'] = '默认'; +$lang->doclib->aclListA['custom'] = '自定义'; + +$lang->doclib->aclListB['open'] = '公开'; +$lang->doclib->aclListB['custom'] = '自定义'; +$lang->doclib->aclListB['private'] = '私有'; + +$lang->doclib->create['product'] = '创建' . $lang->productCommon . '文档库'; +$lang->doclib->create['execution'] = '创建' . $lang->executionCommon . '文档库'; +$lang->doclib->create['custom'] = '创建自定义文档库'; + +$lang->doclib->main['product'] = $lang->productCommon . '主库'; +$lang->doclib->main['project'] = '项目主库'; +$lang->doclib->main['execution'] = $lang->executionCommon . '主库'; + +$lang->doclib->tabList['product'] = $lang->productCommon; +$lang->doclib->tabList['execution'] = $lang->executionCommon; +$lang->doclib->tabList['custom'] = '自定义'; + +$lang->doclib->nameList['custom'] = '自定义文档库名称'; + /* 字段列表。*/ $lang->doc->common = '文档'; $lang->doc->id = '编号'; @@ -229,36 +262,3 @@ $lang->doc->placeholder->url = '相应的链接地址'; $lang->doc->summary = "本页共 %s 个附件,共计 %s,其中%s。"; $lang->doc->ge = '个'; $lang->doc->point = '、'; - -$lang->doclib = new stdclass(); -$lang->doclib->name = '文档库名称'; -$lang->doclib->control = '访问控制'; -$lang->doclib->group = '分组'; -$lang->doclib->user = '用户'; -$lang->doclib->files = '附件库'; -$lang->doclib->all = '所有文档库'; -$lang->doclib->select = '选择文档库'; -$lang->doclib->execution = $lang->executionCommon . '库'; -$lang->doclib->product = $lang->productCommon . '库'; -$lang->doclib->apiLibName = '接口库名称'; - -$lang->doclib->aclListA['default'] = '默认'; -$lang->doclib->aclListA['custom'] = '自定义'; - -$lang->doclib->aclListB['open'] = '公开'; -$lang->doclib->aclListB['custom'] = '自定义'; -$lang->doclib->aclListB['private'] = '私有'; - -$lang->doclib->create['product'] = '创建' . $lang->productCommon . '文档库'; -$lang->doclib->create['execution'] = '创建' . $lang->executionCommon . '文档库'; -$lang->doclib->create['custom'] = '创建自定义文档库'; - -$lang->doclib->main['product'] = $lang->productCommon . '主库'; -$lang->doclib->main['project'] = '项目主库'; -$lang->doclib->main['execution'] = $lang->executionCommon . '主库'; - -$lang->doclib->tabList['product'] = $lang->productCommon; -$lang->doclib->tabList['execution'] = $lang->executionCommon; -$lang->doclib->tabList['custom'] = '自定义'; - -$lang->doclib->nameList['custom'] = '自定义文档库名称'; diff --git a/module/doc/lang/zh-tw.php b/module/doc/lang/zh-tw.php index 70e9bf911b..2e9ea61fdc 100644 --- a/module/doc/lang/zh-tw.php +++ b/module/doc/lang/zh-tw.php @@ -9,6 +9,38 @@ * @version $Id: zh-tw.php 824 2010-05-02 15:32:06Z wwccss $ * @link http://www.zentao.net */ +$lang->doclib = new stdclass(); +$lang->doclib->name = '文檔庫名稱'; +$lang->doclib->control = '訪問控制'; +$lang->doclib->group = '分組'; +$lang->doclib->user = '用戶'; +$lang->doclib->files = '附件庫'; +$lang->doclib->all = '所有文檔庫'; +$lang->doclib->select = '選擇文檔庫'; +$lang->doclib->execution = $lang->executionCommon . '庫'; +$lang->doclib->product = $lang->productCommon . '庫'; + +$lang->doclib->aclListA['default'] = '預設'; +$lang->doclib->aclListA['custom'] = '自定義'; + +$lang->doclib->aclListB['open'] = '公開'; +$lang->doclib->aclListB['custom'] = '自定義'; +$lang->doclib->aclListB['private'] = '私有'; + +$lang->doclib->create['product'] = '創建' . $lang->productCommon . '文檔庫'; +$lang->doclib->create['execution'] = '創建' . $lang->executionCommon . '文檔庫'; +$lang->doclib->create['custom'] = '創建自定義文檔庫'; + +$lang->doclib->main['product'] = $lang->productCommon . '主庫'; +$lang->doclib->main['project'] = '項目主庫'; +$lang->doclib->main['execution'] = $lang->executionCommon . '主庫'; + +$lang->doclib->tabList['product'] = $lang->productCommon; +$lang->doclib->tabList['execution'] = $lang->executionCommon; +$lang->doclib->tabList['custom'] = '自定義'; + +$lang->doclib->nameList['custom'] = '自定義文檔庫名稱'; + /* 欄位列表。*/ $lang->doc->common = '文檔'; $lang->doc->id = '編號'; @@ -223,35 +255,3 @@ $lang->doc->placeholder->url = '相應的連結地址'; $lang->doc->summary = "本頁共 %s 個附件,共計 %s,其中%s。"; $lang->doc->ge = '個'; $lang->doc->point = '、'; - -$lang->doclib = new stdclass(); -$lang->doclib->name = '文檔庫名稱'; -$lang->doclib->control = '訪問控制'; -$lang->doclib->group = '分組'; -$lang->doclib->user = '用戶'; -$lang->doclib->files = '附件庫'; -$lang->doclib->all = '所有文檔庫'; -$lang->doclib->select = '選擇文檔庫'; -$lang->doclib->execution = $lang->executionCommon . '庫'; -$lang->doclib->product = $lang->productCommon . '庫'; - -$lang->doclib->aclListA['default'] = '預設'; -$lang->doclib->aclListA['custom'] = '自定義'; - -$lang->doclib->aclListB['open'] = '公開'; -$lang->doclib->aclListB['custom'] = '自定義'; -$lang->doclib->aclListB['private'] = '私有'; - -$lang->doclib->create['product'] = '創建' . $lang->productCommon . '文檔庫'; -$lang->doclib->create['execution'] = '創建' . $lang->executionCommon . '文檔庫'; -$lang->doclib->create['custom'] = '創建自定義文檔庫'; - -$lang->doclib->main['product'] = $lang->productCommon . '主庫'; -$lang->doclib->main['project'] = '項目主庫'; -$lang->doclib->main['execution'] = $lang->executionCommon . '主庫'; - -$lang->doclib->tabList['product'] = $lang->productCommon; -$lang->doclib->tabList['execution'] = $lang->executionCommon; -$lang->doclib->tabList['custom'] = '自定義'; - -$lang->doclib->nameList['custom'] = '自定義文檔庫名稱'; From 125fa381fcac7c1d31996761a413a8dd139ad1c0 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Tue, 12 Apr 2022 07:40:28 +0000 Subject: [PATCH 23/29] * Fix bug #21374. --- module/product/view/browse.html.php | 2 -- module/story/control.php | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php index 61b03db2a5..26c870a36a 100644 --- a/module/product/view/browse.html.php +++ b/module/product/view/browse.html.php @@ -143,7 +143,6 @@ $projectIDParam = $isProjectStory ? "projectID=$projectID&" : ''; ?> - - diff --git a/module/story/control.php b/module/story/control.php index abfe4b164f..8c9bb6ad70 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -229,7 +229,9 @@ class story extends control /* Set products, users and module. */ if($objectID != 0) { - $products = $this->product->getProductPairsByProject($objectID); + global $config; + $onlyNoClosed = empty($config->CRProduct) ? 'noclosed' : ''; + $products = $this->product->getProductPairsByProject($objectID, $onlyNoClosed); $productID = empty($productID) ? key($products) : $productID; $product = $this->product->getById(($productID and array_key_exists($productID, $products)) ? $productID : key($products)); $productBranches = $product->type != 'normal' ? $this->loadModel('execution')->getBranchByProduct($productID, $objectID) : array(); From 3c807bf30aa6ed8719bcd5f6e58fcbb32cf688e9 Mon Sep 17 00:00:00 2001 From: liyang <“liyang@easycorp.ltd”> Date: Tue, 12 Apr 2022 15:40:40 +0800 Subject: [PATCH 24/29] add stage data --- test/data/stage.yaml | 26 ++++++++++++++++++++++++++ test/data/zentao/config.php | 1 + 2 files changed, 27 insertions(+) create mode 100644 test/data/stage.yaml diff --git a/test/data/stage.yaml b/test/data/stage.yaml new file mode 100644 index 0000000000..a5caa9bf28 --- /dev/null +++ b/test/data/stage.yaml @@ -0,0 +1,26 @@ +title: table zt_stage +desc: "" +author: automated export +version: "1.0" +fields: + - field: id + range: 1-6 + - field: name + range: 需求,设计,开发,测试,发布,总结评审 + - field: percent + range: 10{2},50,15,10,5 + - field: type + range: request,design,dev,qa,release,review + - field: createdBy + range: admin + - field: createdDate + range: "" + prefix: "2018-02-12 12:00:00" + postfix: "" + - field: editedBy + range: admin + - field: editedDate + range: "" + prefix: "2020-02-12 13:50:27" + - field: deleted + range: "0" diff --git a/test/data/zentao/config.php b/test/data/zentao/config.php index ec3f7a238f..b2bdd5ae41 100644 --- a/test/data/zentao/config.php +++ b/test/data/zentao/config.php @@ -89,6 +89,7 @@ $builder->release = array('rows' => 10, 'extends' => array('release')); $builder->design = array('rows' => 120, 'extends' => array('design')); $builder->designspec = array('rows' => 120, 'extends' => array('designspec')); +$builder->stage = array('rows' => 6, 'extends' => array('stage')); $builder->webhook = array('rows' => 7, 'extends' => array('webhook')); $builder->entry = array('rows' => 1, 'extends' => array('entry')); From 6c85c8f49c70214618d7311ae40e29ebce401562 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=8D=8E=E4=BC=9F?= Date: Tue, 12 Apr 2022 15:47:01 +0800 Subject: [PATCH 25/29] *Beautify the interface. --- module/execution/view/ajaxgetdropmenu.html.php | 4 ++-- module/product/view/ajaxgetdropmenu.html.php | 4 ++-- module/project/view/ajaxgetdropmenu.html.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/module/execution/view/ajaxgetdropmenu.html.php b/module/execution/view/ajaxgetdropmenu.html.php index 4097d03729..b06368138c 100644 --- a/module/execution/view/ajaxgetdropmenu.html.php +++ b/module/execution/view/ajaxgetdropmenu.html.php @@ -24,7 +24,7 @@ #swapper .tree li>.list-toggle {top: -1px;} #closed {width: 90px; height: 25px; line-height: 25px; background-color: #ddd; color: #3c495c; text-align: center; margin-left: 15px; border-radius: 2px;} -#gray-line {height: 1px; margin-left: 10px; margin-bottom:2px; background-color: #ddd;} +#gray-line {width: 230px;height: 1px; margin-left: 10px; margin-bottom:2px; background-color: #ddd;} '; execution->doneExecutions;?> -
    +
    diff --git a/module/product/view/ajaxgetdropmenu.html.php b/module/product/view/ajaxgetdropmenu.html.php index 5f193d2015..722dacb0c8 100644 --- a/module/product/view/ajaxgetdropmenu.html.php +++ b/module/product/view/ajaxgetdropmenu.html.php @@ -27,7 +27,7 @@ #subHeader .tree ul {display: block;} #closed {width: 90px; height: 25px; line-height: 25px; background-color: #ddd; color: #3c495c; text-align: center; margin-left: 15px; border-radius: 2px;} -#gray-line {height: 1px; margin-left: 10px; margin-bottom:2px; background-color: #ddd;} +#gray-line {width: 230px; height: 1px; margin-left: 10px; margin-bottom:2px; background-color: #ddd;} '; product->closed?>
    -
    +
    diff --git a/module/project/view/ajaxgetdropmenu.html.php b/module/project/view/ajaxgetdropmenu.html.php index 2f9089478a..83ccf41231 100644 --- a/module/project/view/ajaxgetdropmenu.html.php +++ b/module/project/view/ajaxgetdropmenu.html.php @@ -25,7 +25,7 @@ #swapper .tree li>.list-toggle {top: -1px;} #closed {width: 90px; height: 25px; line-height: 25px; background-color: #ddd; color: #3c495c; text-align: center; margin-left: 15px; border-radius: 2px;} -#gray-line {height: 1px; margin-left: 10px; margin-bottom:2px; background-color: #ddd;} +#gray-line {width:230px; height: 1px; margin-left: 10px; margin-bottom:2px; background-color: #ddd;} Date: Tue, 12 Apr 2022 15:51:06 +0800 Subject: [PATCH 26/29] * Add unit test of stage. --- test/class/stage.class.php | 98 ++++++++++++++++++++++++++++++++ test/model/stage/batchcreate.php | 41 +++++++++++++ test/model/stage/create.php | 59 +++++++++++++++++++ test/model/stage/getbyid.php | 24 ++++++++ test/model/stage/getpairs.php | 22 +++++++ test/model/stage/getstages.php | 22 +++++++ test/model/stage/update.php | 27 +++++++++ test/ztest | 3 + 8 files changed, 296 insertions(+) create mode 100644 test/class/stage.class.php create mode 100755 test/model/stage/batchcreate.php create mode 100755 test/model/stage/create.php create mode 100755 test/model/stage/getbyid.php create mode 100755 test/model/stage/getpairs.php create mode 100755 test/model/stage/getstages.php create mode 100755 test/model/stage/update.php diff --git a/test/class/stage.class.php b/test/class/stage.class.php new file mode 100644 index 0000000000..2e15e06386 --- /dev/null +++ b/test/class/stage.class.php @@ -0,0 +1,98 @@ +objectModel = $tester->loadModel('stage'); + } + + /** + * Test create a stage. + * + * @param object $stage + * @access public + * @return object + */ + public function createTest($stage) + { + foreach($stage as $key => $value) $_POST[$key] = $value; + + $objectID = $this->objectModel->create(); + + unset($_POST); + + if(dao::isError()) return dao::getError(); + + $object = $this->objectModel->getByID($objectID); + return $object; + } + + /** + * Test batch create stages. + * + * @param array $param + * @access public + * @return int + */ + public function batchCreateTest($param) + { + foreach($param as $key => $value) $_POST[$key] = $value; + + $this->objectModel->batchCreate(); + + unset($_POST); + + if(dao::isError()) return dao::getError(); + + $objects = $this->objectModel->getStages(); + return count($objects); + } + + public function updateTest($stageID, $param) + { + foreach($param as $key => $value) $_POST[$key] = $value; + + $objects = $this->objectModel->update($stageID); + + unset($_POST); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getStagesTest($orderBy = 'id_desc') + { + $objects = $this->objectModel->getStages($orderBy = 'id_desc'); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + public function getPairsTest() + { + $objects = $this->objectModel->getPairs(); + + if(dao::isError()) return dao::getError(); + + return $objects; + } + + /** + * Test get a stage by id. + * + * @param int $stageID + * @access public + * @return object + */ + public function getByIDTest($stageID) + { + $object = $this->objectModel->getByID($stageID); + + if(dao::isError()) return dao::getError(); + + return $object; + } +} diff --git a/test/model/stage/batchcreate.php b/test/model/stage/batchcreate.php new file mode 100755 index 0000000000..cfe58e2b5f --- /dev/null +++ b/test/model/stage/batchcreate.php @@ -0,0 +1,41 @@ +#!/usr/bin/env php +batchCreate(); +cid=1 +pid=1 + +*/ +$name1 = array('1' => '批量创建的需求', '2' => '批量创建的设计', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); +$percent1 = array('1' => '1', '2' => '2', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); +$type1 = array('1' => 'request', '2' => 'design', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); + +$name2 = array('1' => '批量创建的开发', '2' => '批量创建的测试', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); +$percent2 = array('1' => '3', '2' => '4', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); +$type2 = array('1' => 'dev', '2' => 'qa', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); + +$name3 = array('1' => '批量创建的发布', '2' => '批量创建的总结评审', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); +$percent3 = array('1' => '5', '2' => '6', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); +$type3 = array('1' => 'release', '2' => 'review', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); + +$name4 = array('1' => '', '2' => '批量创建的其他', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); +$percent4 = array('1' => '1', '2' => '7', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); +$type4 = array('1' => 'request', '2' => 'other', '3' => '', '4' => '', '5' => '', '6' => '', '7' => '', '8' => '', '9' => '', '10' => ''); + +$param1 = array('name' => $name1, 'percent' => $percent1, 'type' => $type1); +$param2 = array('name' => $name2, 'percent' => $percent2, 'type' => $type2); +$param3 = array('name' => $name3, 'percent' => $percent3, 'type' => $type3); +$param4 = array('name' => $name4, 'percent' => $percent4, 'type' => $type4); + +$stage = new stageTest(); + +r($stage->batchCreateTest($param1)) && p() && e('8'); // 测试批量创建阶段 1 +r($stage->batchCreateTest($param2)) && p() && e('10'); // 测试批量创建阶段 2 +r($stage->batchCreateTest($param3)) && p() && e('12'); // 测试批量创建阶段 3 +r($stage->batchCreateTest($param4)) && p() && e('13'); // 测试批量创建阶段 4 +system("./ztest init"); diff --git a/test/model/stage/create.php b/test/model/stage/create.php new file mode 100755 index 0000000000..f36b638153 --- /dev/null +++ b/test/model/stage/create.php @@ -0,0 +1,59 @@ +#!/usr/bin/env php +create(); +cid=1 +pid=1 + +*/ + +$stage1 = new stdclass(); +$stage1->name = '新建的需求'; +$stage1->percent = 1; +$stage1->type = 'request'; + +$stage2 = new stdclass(); +$stage2->name = '新建的设计'; +$stage2->percent = 2; +$stage2->type = 'design'; + +$stage3 = new stdclass(); +$stage3->name = '新建的开发'; +$stage3->percent = 3; +$stage3->type = 'dev'; + +$stage4 = new stdclass(); +$stage4->name = '新建的测试'; +$stage4->percent = 4; +$stage4->type = 'qa'; + +$stage5 = new stdclass(); +$stage5->name = '新建的发布'; +$stage5->percent = 5; +$stage5->type = 'release'; + +$stage6 = new stdclass(); +$stage6->name = '新建的总结评审'; +$stage6->percent = 6; +$stage6->type = 'review'; + +$stage7 = new stdclass(); +$stage7->name = '新建的其他'; +$stage7->percent = 7; +$stage7->type = 'other'; + +$stage = new stageTest(); + +r($stage->createTest($stage1)) && p('name,percent,type') && e('新建的需求,1,request'); // 测试新建一个需求阶段 +r($stage->createTest($stage2)) && p('name,percent,type') && e('新建的设计,2,design'); // 测试新建一个设计阶段 +r($stage->createTest($stage3)) && p('name,percent,type') && e('新建的开发,3,dev'); // 测试新建一个开发阶段 +r($stage->createTest($stage4)) && p('name,percent,type') && e('新建的测试,4,qa'); // 测试新建一个测试阶段 +r($stage->createTest($stage5)) && p('name,percent,type') && e('新建的发布,5,release'); // 测试新建一个发布阶段 +r($stage->createTest($stage6)) && p('name,percent,type') && e('新建的总结评审,6,review'); // 测试新建一个总结评审阶段 +r($stage->createTest($stage7)) && p('name,percent,type') && e('新建的其他,7,other'); // 测试新建一个其他阶段 +system("./ztest init"); diff --git a/test/model/stage/getbyid.php b/test/model/stage/getbyid.php new file mode 100755 index 0000000000..bf6743d703 --- /dev/null +++ b/test/model/stage/getbyid.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +getByID(); +cid=1 +pid=1 + +*/ + +$stageIDList = array(1, 2, 3, 4, 5, 6); + +$stage = new stageTest(); + +r($stage->getByIDTest($stageIDList[0])) && p('name,percent,type') && e('需求,10,request'); // 测试获取阶段 1 +r($stage->getByIDTest($stageIDList[1])) && p('name,percent,type') && e('设计,10,design'); // 测试获取阶段 2 +r($stage->getByIDTest($stageIDList[2])) && p('name,percent,type') && e('开发,50,dev'); // 测试获取阶段 3 +r($stage->getByIDTest($stageIDList[3])) && p('name,percent,type') && e('测试,15,qa'); // 测试获取阶段 4 +r($stage->getByIDTest($stageIDList[4])) && p('name,percent,type') && e('发布,10,release'); // 测试获取阶段 5 +r($stage->getByIDTest($stageIDList[5])) && p('name,percent,type') && e('总结评审,5,review'); // 测试获取阶段 6 diff --git a/test/model/stage/getpairs.php b/test/model/stage/getpairs.php new file mode 100755 index 0000000000..b1c4e34e73 --- /dev/null +++ b/test/model/stage/getpairs.php @@ -0,0 +1,22 @@ +#!/usr/bin/env php +getPairs(); +cid=1 +pid=1 + +*/ + +$stage = new stageTest(); + +r($stage->getPairsTest()) && p('1') && e('需求'); // 测试获取阶段 1 +r($stage->getPairsTest()) && p('2') && e('设计'); // 测试获取阶段 2 +r($stage->getPairsTest()) && p('3') && e('开发'); // 测试获取阶段 3 +r($stage->getPairsTest()) && p('4') && e('测试'); // 测试获取阶段 4 +r($stage->getPairsTest()) && p('5') && e('发布'); // 测试获取阶段 5 +r($stage->getPairsTest()) && p('6') && e('总结评审'); // 测试获取阶段 6 diff --git a/test/model/stage/getstages.php b/test/model/stage/getstages.php new file mode 100755 index 0000000000..d58f5146f5 --- /dev/null +++ b/test/model/stage/getstages.php @@ -0,0 +1,22 @@ +#!/usr/bin/env php +getStages(); +cid=1 +pid=1 + +*/ + +$stage = new stageTest(); + +r($stage->getStagesTest()) && p('1:name,percent,type') && e('需求,10,request'); // 测试获取阶段 1 +r($stage->getStagesTest()) && p('2:name,percent,type') && e('设计,10,design'); // 测试获取阶段 2 +r($stage->getStagesTest()) && p('3:name,percent,type') && e('开发,50,dev'); // 测试获取阶段 3 +r($stage->getStagesTest()) && p('4:name,percent,type') && e('测试,15,qa'); // 测试获取阶段 4 +r($stage->getStagesTest()) && p('5:name,percent,type') && e('发布,10,release'); // 测试获取阶段 5 +r($stage->getStagesTest()) && p('6:name,percent,type') && e('总结评审,5,review'); // 测试获取阶段 6 diff --git a/test/model/stage/update.php b/test/model/stage/update.php new file mode 100755 index 0000000000..e52ea89cb5 --- /dev/null +++ b/test/model/stage/update.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +update(); +cid=1 +pid=1 + +*/ + +$stageID = 1; + +$changeName = array('name' => '修改后的需求'); +$changePercent = array('percent' => '15'); +$changeType = array('type' => 'other'); + +$stage = new stageTest(); + +r($stage->updateTest($stageID, $changeName)) && p('0:field,old,new') && e('name,需求,修改后的需求'); // 测试修改名称 +r($stage->updateTest($stageID, $changePercent)) && p('0:field,old,new') && e('percent,10,15'); // 测试修改工作量占比 +r($stage->updateTest($stageID, $changeType)) && p('0:field,old,new') && e('type,request,other'); // 测试修改阶段分类 +system("./ztest init"); + diff --git a/test/ztest b/test/ztest index a03d2f0b42..4b11c90231 100755 --- a/test/ztest +++ b/test/ztest @@ -76,6 +76,9 @@ switch($argv[1]) case 'cron': ztfRun('model/cron'); break; + case 'stage': + ztfRun('model/stage'); + break; case 'design': ztfRun('model/design'); break; From 6cdeacd9ac677f66b47880287c23681d1860ea34 Mon Sep 17 00:00:00 2001 From: zhouxin Date: Tue, 12 Apr 2022 07:51:55 +0000 Subject: [PATCH 27/29] * Fix bug #21374. --- module/story/control.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module/story/control.php b/module/story/control.php index 8c9bb6ad70..d2b43529cb 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -229,8 +229,7 @@ class story extends control /* Set products, users and module. */ if($objectID != 0) { - global $config; - $onlyNoClosed = empty($config->CRProduct) ? 'noclosed' : ''; + $onlyNoClosed = empty($this->config->CRProduct) ? 'noclosed' : ''; $products = $this->product->getProductPairsByProject($objectID, $onlyNoClosed); $productID = empty($productID) ? key($products) : $productID; $product = $this->product->getById(($productID and array_key_exists($productID, $products)) ? $productID : key($products)); From bdb910be616499de6584c5eb1747ff173f804cab Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 12 Apr 2022 15:54:15 +0800 Subject: [PATCH 28/29] * Add unit test of stage. --- test/class/stage.class.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/class/stage.class.php b/test/class/stage.class.php index 2e15e06386..55d04a9e87 100644 --- a/test/class/stage.class.php +++ b/test/class/stage.class.php @@ -49,6 +49,14 @@ class stageTest return count($objects); } + /** + * Test update a stage. + * + * @param int $stageID + * @param array $param + * @access public + * @return array + */ public function updateTest($stageID, $param) { foreach($param as $key => $value) $_POST[$key] = $value; @@ -62,6 +70,13 @@ class stageTest return $objects; } + /** + * Test get stages. + * + * @param string $orderBy + * @access public + * @return array + */ public function getStagesTest($orderBy = 'id_desc') { $objects = $this->objectModel->getStages($orderBy = 'id_desc'); @@ -71,6 +86,12 @@ class stageTest return $objects; } + /** + * Test get pairs of stage. + * + * @access public + * @return array + */ public function getPairsTest() { $objects = $this->objectModel->getPairs(); From 41b48ac200169b3ee3fb9f35029a8866af579bc1 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 13 Apr 2022 09:13:50 +0800 Subject: [PATCH 29/29] * Fix bug of create test case. --- module/testcase/model.php | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/module/testcase/model.php b/module/testcase/model.php index a39c3980dd..003e8cc7dd 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -1819,6 +1819,7 @@ class testcaseModel extends model */ public function syncCase2Project($case, $caseID) { + $projects = array(); if(!empty($case->story)) { $projects = $this->dao->select('project')->from(TABLE_PROJECTSTORY)->where('story')->eq($case->story)->fetchPairs(); @@ -1831,27 +1832,25 @@ class testcaseModel extends model { $projects = array($this->session->execution); } + if(empty($projects)) return; $this->loadModel('action'); $objectInfo = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->in($projects)->fetchAll('id'); - if(!empty($projects)) + foreach($projects as $projectID) { - foreach($projects as $projectID) - { - $lastOrder = (int)$this->dao->select('*')->from(TABLE_PROJECTCASE)->where('project')->eq($projectID)->orderBy('order_desc')->limit(1)->fetch('order'); - $data = new stdclass(); - $data->project = $projectID; - $data->product = $case->product; - $data->case = $caseID; - $data->version = 1; - $data->order = ++ $lastOrder; - $this->dao->insert(TABLE_PROJECTCASE)->data($data)->exec(); + $lastOrder = (int)$this->dao->select('*')->from(TABLE_PROJECTCASE)->where('project')->eq($projectID)->orderBy('order_desc')->limit(1)->fetch('order'); + $data = new stdclass(); + $data->project = $projectID; + $data->product = $case->product; + $data->case = $caseID; + $data->version = 1; + $data->order = ++ $lastOrder; + $this->dao->insert(TABLE_PROJECTCASE)->data($data)->exec(); - $objectType = $objectInfo[$projectID]->type; - if($objectType == 'project') $this->action->create('case', $caseID, 'linked2project', '', $projectID); - if(in_array($objectType, array('sprint', 'stage'))) $this->action->create('case', $caseID, 'linked2execution', '', $projectID); - } + $objectType = $objectInfo[$projectID]->type; + if($objectType == 'project') $this->action->create('case', $caseID, 'linked2project', '', $projectID); + if(in_array($objectType, array('sprint', 'stage'))) $this->action->create('case', $caseID, 'linked2execution', '', $projectID); } }