Merge pull request 'daitingting_format_codes' (#43) from daitingting_format_codes into master
Reviewed-on: https://git.zcorp.cc/easycorp/zentaopms/pulls/43
This commit is contained in:
@@ -31,10 +31,10 @@ class bug extends control
|
||||
|
||||
/**
|
||||
* 构造函数
|
||||
|
||||
*
|
||||
* 1.加载其他模块model类。
|
||||
* 2.获取产品,并输出到视图
|
||||
|
||||
*
|
||||
* The construct function.
|
||||
*
|
||||
* 1. Load model of other modules.
|
||||
@@ -658,7 +658,7 @@ class bug extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新bug信息。
|
||||
* 更新 bug 信息。
|
||||
* Edit a bug.
|
||||
*
|
||||
* @param string $bugID
|
||||
@@ -669,10 +669,11 @@ class bug extends control
|
||||
*/
|
||||
public function edit(string $bugID, bool $comment = false, string $kanbanGroup = 'default')
|
||||
{
|
||||
$bugID = (int)$bugID;
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$oldBug = $this->bug->getByID($bugID);
|
||||
|
||||
$oldBug = $this->bug->getByID($bugID);
|
||||
$formData = form::data($this->config->bug->form->edit);
|
||||
$bug = $this->bugZen->prepareEditExtras($formData, $oldBug);
|
||||
if(!$bug) return $this->send($this->bugZen->errorEdit());
|
||||
|
||||
@@ -397,7 +397,7 @@ class bugModel extends model
|
||||
* @access public
|
||||
* @return object|false
|
||||
*/
|
||||
public function getByID(string $bugID, bool $setImgSize = false): object|false
|
||||
public function getByID(int $bugID, bool $setImgSize = false): object|false
|
||||
{
|
||||
$bug = $this->bugTao->fetchBugInfo($bugID);
|
||||
if(!$bug) return false;
|
||||
@@ -532,11 +532,11 @@ class bugModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新bug信息。
|
||||
* 更新 bug 信息。
|
||||
* Update a bug.
|
||||
*
|
||||
* @param object $bug
|
||||
* @param object $oldBug
|
||||
* @param object $bug
|
||||
* @param object $oldBug
|
||||
* @access public
|
||||
* @return array|false
|
||||
*/
|
||||
|
||||
+17
-17
@@ -170,26 +170,26 @@ class bugTao extends bugModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新完bug后的相关处理。
|
||||
* 更新完 bug 后的相关处理。
|
||||
* Relevant processing after updating bug.
|
||||
*
|
||||
* @param object $bug
|
||||
* @param object $oldBug
|
||||
* @param object $bug
|
||||
* @param object $oldBug
|
||||
* @access protected
|
||||
* @return void
|
||||
* @return bool
|
||||
*/
|
||||
protected function afterUpdate(object $bug, object $oldBug)
|
||||
protected function afterUpdate(object $bug, object $oldBug): bool
|
||||
{
|
||||
/* 解除旧的版本关联关系,关联新的版本。*/
|
||||
/* Link bug to build and release. */
|
||||
/* Unlink old resolved build and link new resolved build. */
|
||||
if($bug->resolution == 'fixed' && !empty($bug->resolvedBuild) && $bug->resolvedBuild != $oldBug->resolvedBuild)
|
||||
{
|
||||
if(!empty($oldBug->resolvedBuild)) $this->loadModel('build')->unlinkBug($oldBug->resolvedBuild, $bug->id);
|
||||
$this->linkBugToBuild($bug->id, $bug->resolvedBuild);
|
||||
}
|
||||
|
||||
/* 解除旧的计划关联关系,关联新的计划。*/
|
||||
/* Link new plan, unlink old plan. */
|
||||
/* 记录解除旧的计划关联关系和关联新的计划的历史。*/
|
||||
/* Create actions for linking new plan and unlinking old plan. */
|
||||
if($bug->plan != $oldBug->plan)
|
||||
{
|
||||
$this->loadModel('action');
|
||||
@@ -199,11 +199,11 @@ class bugTao extends bugModel
|
||||
|
||||
$this->updateLinkBug($bug->id, $bug->linkBug, $oldBug->linkBug);
|
||||
|
||||
/* 给bug解决者积分奖励。*/
|
||||
/* Add score to resolvedby. */
|
||||
/* 给 bug 解决者积分奖励。*/
|
||||
/* Add score to the user who resolved the bug. */
|
||||
if(!empty($bug->resolvedBy)) $this->loadModel('score')->create('bug', 'resolve', $bug->id);
|
||||
|
||||
/* 更新bug所属看板的泳道。*/
|
||||
/* 更新 bug 所属看板的泳道。*/
|
||||
/* Update the lane of the bug kanban. */
|
||||
if($bug->execution and $bug->status != $oldBug->status) $this->loadModel('kanban')->updateLane($bug->execution, 'bug');
|
||||
|
||||
@@ -211,7 +211,7 @@ class bugTao extends bugModel
|
||||
/* Update the status of feedback. */
|
||||
if(($this->config->edition != 'open') && $oldBug->feedback) $this->loadModel('feedback')->updateStatus('bug', $oldBug->feedback, $bug->status, $oldBug->status);
|
||||
|
||||
/* 更新bug的附件。*/
|
||||
/* 更新 bug 的附件。*/
|
||||
/* Update the files of bug. */
|
||||
$this->loadModel('file')->processFile4Object('bug', $oldBug, $bug);
|
||||
|
||||
@@ -219,16 +219,16 @@ class bugTao extends bugModel
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新相关bug。
|
||||
* 更新相关 bug。
|
||||
* Update the linked bug.
|
||||
*
|
||||
* @param string $bugID
|
||||
* @param string $linkBug
|
||||
* @param string $oldLinkBug
|
||||
* @param int $bugID
|
||||
* @param string $linkBug
|
||||
* @param string $oldLinkBug
|
||||
* @access protected
|
||||
* @return bool
|
||||
*/
|
||||
protected function updateLinkBug(string $bugID, string $linkBug, string $oldLinkBug): bool
|
||||
protected function updateLinkBug(int $bugID, string $linkBug, string $oldLinkBug): bool
|
||||
{
|
||||
$linkBugs = explode(',', $linkBug);
|
||||
$oldLinkBugs = explode(',', $oldLinkBug);
|
||||
|
||||
@@ -60,7 +60,7 @@ cid=1
|
||||
|
||||
initData();
|
||||
|
||||
$bugIdList = array('1', '2');
|
||||
$bugIdList = array(1, 2);
|
||||
|
||||
$t_uptitle = array('title' => 'john');
|
||||
$t_uptype = array('type' => 'config');
|
||||
@@ -83,4 +83,4 @@ r($bug->updateObject($bugIdList[0], $t_unnotifyEmail)) && p('notifyEmail:0')
|
||||
r($bug->updateObject($bugIdList[0], $t_resolution1)) && p('resolution:0') && e('『解决方案』不能为空。'); // 测试解决者不为空时,不输入解决方案
|
||||
r($bug->updateObject($bugIdList[0], $t_resolution2)) && p('resolution:0') && e('『解决方案』不能为空。'); // 测试由谁关闭不为空时,不输入解决方案
|
||||
r($bug->updateObject($bugIdList[0], $t_unduplicateBug)) && p('duplicateBug:0') && e('『重复Bug』不能为空。'); // 测试解决方案为重复Bug时,不输入重复Bug值
|
||||
r($bug->updateObject($bugIdList[0], $t_unresolvedBuild)) && p('resolvedBuild:0') && e('『解决版本』不能为空。'); // 测试解决方案为已修复时,不输入解决版本
|
||||
r($bug->updateObject($bugIdList[0], $t_unresolvedBuild)) && p('resolvedBuild:0') && e('『解决版本』不能为空。'); // 测试解决方案为已修复时,不输入解决版本
|
||||
|
||||
@@ -38,13 +38,11 @@ cid=1
|
||||
|
||||
- 测试关联bug3的关联bug同步更新为1,2属性3 @1,2
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
initData();
|
||||
|
||||
$bugIDList = array('1', '2', '3');
|
||||
$bugIDList = array(1, 2, 3);
|
||||
|
||||
$bug = new bugTest();
|
||||
r($bug->updateLinkBugTest($bugIDList[0], '2', '')) && p('2', ';') && e('1'); //测试关联bug2的关联bug同步更新为1
|
||||
|
||||
+35
-37
@@ -103,8 +103,8 @@ class bugZen extends bug
|
||||
* 处理更新请求数据。
|
||||
* Processing request data.
|
||||
*
|
||||
* @param string $bugID
|
||||
* @param form $formData
|
||||
* @param form $formData
|
||||
* @param object $oldBug
|
||||
* @access protected
|
||||
* @return object|false
|
||||
*/
|
||||
@@ -148,15 +148,14 @@ class bugZen extends bug
|
||||
return $bug;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 返回错误信息。
|
||||
* return error.
|
||||
*
|
||||
* @access protected
|
||||
* @return array|viod
|
||||
* @return array
|
||||
*/
|
||||
protected function errorEdit()
|
||||
protected function errorEdit(): array
|
||||
{
|
||||
if(defined('RUN_MODE') && RUN_MODE == 'api') return array('status' => 'error', 'message' => dao::getError());
|
||||
|
||||
@@ -167,13 +166,13 @@ class bugZen extends bug
|
||||
* 更新成功后的相关处理。
|
||||
* Relevant processing after updating bug.
|
||||
*
|
||||
* @param int $bugID
|
||||
* @param string $comment
|
||||
* @param array $changes
|
||||
* @param int $bugID
|
||||
* @param string $comment
|
||||
* @param array $changes
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function processAfterEdit(int $bugID, string $comment, array $changes)
|
||||
protected function processAfterEdit(int $bugID, string $comment, array $changes): void
|
||||
{
|
||||
if($this->post->comment || !empty($changes))
|
||||
{
|
||||
@@ -186,20 +185,20 @@ class bugZen extends bug
|
||||
|
||||
/**
|
||||
* 返回不同的结果。
|
||||
* Response after updating bug.
|
||||
* Respond after updating bug.
|
||||
*
|
||||
* @param string $bugID
|
||||
* @param array $changes
|
||||
* @param string $kanbanGroup
|
||||
* @param int $bugID
|
||||
* @param array $changes
|
||||
* @param string $kanbanGroup
|
||||
* @access protected
|
||||
* @return array
|
||||
*/
|
||||
protected function responseAfterEdit(string $bugID, array $changes, string $kanbanGroup): array
|
||||
protected function responseAfterEdit(int $bugID, array $changes, string $kanbanGroup): array
|
||||
{
|
||||
if(defined('RUN_MODE') && RUN_MODE == 'api') return array('status' => 'success', 'data' => $bugID);
|
||||
|
||||
/* 如果bug转任务,如果bug的状态发生变化,提示是否更新任务状态。*/
|
||||
/* This bug has been converted to a task, update the status of the relatedtask or not. */
|
||||
/* 如果 bug 转任务并且 bug 的状态发生变化,提示是否更新任务状态。*/
|
||||
/* This bug has been converted to a task, update the status of the related task or not. */
|
||||
$bug = $this->bug->getByID($bugID);
|
||||
if($bug->toTask and !empty($changes))
|
||||
{
|
||||
@@ -211,12 +210,12 @@ class bugZen extends bug
|
||||
}
|
||||
}
|
||||
|
||||
/* 弹窗里编辑bug的返回。*/
|
||||
/* Response when edit in modal. */
|
||||
/* 在弹窗里编辑 bug 时的返回。*/
|
||||
/* Respond after updating in modal. */
|
||||
if(isonlybody())
|
||||
{
|
||||
/* 在执行应用下,编辑看板中的bug数据时,更新看板数据。*/
|
||||
/* Update kanban data after edited bug in kanban. */
|
||||
/* 在执行应用下,编辑看板中的 bug 数据时,更新看板数据。*/
|
||||
/* Update kanban data after updating bug in kanban. */
|
||||
if($this->app->tab == 'execution')
|
||||
{
|
||||
$this->loadModel('kanban');
|
||||
@@ -224,8 +223,8 @@ class bugZen extends bug
|
||||
$execution = $this->loadModel('execution')->getByID($bug->execution);
|
||||
$execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all';
|
||||
|
||||
/* 1.看板类型的执行。*/
|
||||
/* 1.The kanban exectuion. */
|
||||
/* 看板类型的执行。*/
|
||||
/* The kanban exectuion. */
|
||||
if(isset($execution->type) && $execution->type == 'kanban')
|
||||
{
|
||||
$rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : '';
|
||||
@@ -233,8 +232,8 @@ class bugZen extends bug
|
||||
$kanbanData = json_encode($kanbanData);
|
||||
return array('result' => 'success', 'closeModal' => true, 'callback' => "updateKanban($kanbanData)");
|
||||
}
|
||||
/* 2.执行中的看板。*/
|
||||
/* 2.The kanban of execution. */
|
||||
/* 执行中的看板。*/
|
||||
/* The kanban of execution. */
|
||||
else
|
||||
{
|
||||
$execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default';
|
||||
@@ -783,16 +782,15 @@ class bugZen extends bug
|
||||
* 设置编辑页面的导航。
|
||||
* Set edit menu.
|
||||
*
|
||||
* @param object $bug
|
||||
* @param object $bug
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function setEditMenu(object $bug)
|
||||
protected function setEditMenu(object $bug): void
|
||||
{
|
||||
if($this->app->tab == 'project') $this->project->setMenu($bug->project);
|
||||
if($this->app->tab == 'execution') $this->execution->setMenu($bug->execution);
|
||||
if($this->app->tab == 'qa') $this->qa->setMenu($this->products, $bug->product, $bug->branch);
|
||||
/* 是否有用?*/
|
||||
if($this->app->tab == 'devops')
|
||||
{
|
||||
session_write_close();
|
||||
@@ -808,13 +806,13 @@ class bugZen extends bug
|
||||
* 获取页面所需的变量, 并输出到前台。
|
||||
* Get the data required by the view page and output.
|
||||
*
|
||||
* @param object $bug
|
||||
* @param object $bug
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function buildEditForm(object $bug)
|
||||
protected function buildEditForm(object $bug): void
|
||||
{
|
||||
/* 删掉当前bug类型不属于的并且已经弃用的类型。*/
|
||||
/* 删掉当前 bug 类型不属于的并且已经弃用的类型。*/
|
||||
/* Unset discarded types. */
|
||||
foreach($this->config->bug->discardedTypes as $type)
|
||||
{
|
||||
@@ -830,7 +828,7 @@ class bugZen extends bug
|
||||
$execution = $this->execution->getByID($bug->execution);
|
||||
|
||||
/* 获取影响版本列表和解决版本列表。*/
|
||||
/* Get the openedBuilds and resolvedBuilds. */
|
||||
/* Get the affected builds and resolved builds. */
|
||||
$objectType = '';
|
||||
if($bug->project) $objectType = 'project';
|
||||
if($bug->execution) $objectType = 'execution';
|
||||
@@ -861,13 +859,13 @@ class bugZen extends bug
|
||||
$branchTagOption[$bug->branch] = $branchTagName;
|
||||
}
|
||||
|
||||
/* 获取moduleOptionMenu。*/
|
||||
/* Get moduleOptionMenu. */
|
||||
/* 获取所属模块列表。*/
|
||||
/* Get module option menu. */
|
||||
$moduleOptionMenu = $this->tree->getOptionMenu($bug->product, $viewType = 'bug', $startModuleID = 0, $bug->branch);
|
||||
if(!isset($moduleOptionMenu[$bug->module])) $moduleOptionMenu += $this->tree->getModulesName($bug->module);
|
||||
|
||||
/* 获取指派给用户列表。*/
|
||||
/* Get assigned to member. */
|
||||
/* Get the user pairs for assign. */
|
||||
if($bug->execution)
|
||||
{
|
||||
$assignedToList = $this->user->getTeamMemberPairs($bug->execution, 'execution');
|
||||
@@ -890,7 +888,7 @@ class bugZen extends bug
|
||||
}
|
||||
if($bug->status == 'closed') $assignedToList['closed'] = 'Closed';
|
||||
|
||||
/* 获取该bug关联产品和分支下的bug列表。*/
|
||||
/* 获取该 bug 关联产品和分支下的 bug 列表。*/
|
||||
/* Get bugs of current product. */
|
||||
$branch = '';
|
||||
if($product->type == 'branch') $branch = $bug->branch > 0 ? "{$bug->branch},0" : '0';
|
||||
@@ -911,8 +909,8 @@ class bugZen extends bug
|
||||
$projects[$project->id] = $project->name . "({$this->lang->bug->deleted})";
|
||||
}
|
||||
|
||||
/* 如果产品列表没有bug相关的产品,把该产品加入产品列表。*/
|
||||
/* Add product related by the bug when it is not in the products. */
|
||||
/* 如果产品列表没有 bug 相关的产品,把该产品加入产品列表。*/
|
||||
/* Add product related to the bug when it is not in the products. */
|
||||
if(!isset($this->products[$bug->product]))
|
||||
{
|
||||
$this->products[$bug->product] = $product->name;
|
||||
|
||||
Reference in New Issue
Block a user