* Code for close bug.
This commit is contained in:
+44
-31
@@ -2,38 +2,51 @@
|
||||
declare(strict_types=1);
|
||||
global $lang;
|
||||
|
||||
$config->bug->createform = array();
|
||||
$config->bug->createform['title'] = array('required' => true, 'type' => 'string', 'filter' => 'trim');
|
||||
$config->bug->createform['openedBuild'] = array('required' => true, 'type' => 'array', 'filter' => 'join');
|
||||
$config->bug->form = new stdclass();
|
||||
|
||||
$config->bug->createform['product'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->createform['branch'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->createform['module'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->createform['project'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->createform['execution'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->createform['assignedTo'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
$config->bug->createform['deadline'] = array('required' => false, 'type' => 'date', 'default' => '');
|
||||
$config->bug->createform['feedbackBy'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
$config->bug->createform['notifyEmail'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
$config->bug->createform['type'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
$config->bug->form->create = array();
|
||||
$config->bug->form->create['title'] = array('required' => true, 'type' => 'string', 'filter' => 'trim');
|
||||
$config->bug->form->create['openedBuild'] = array('required' => true, 'type' => 'array', 'filter' => 'join');
|
||||
|
||||
$config->bug->createform['os'] = array('required' => false, 'type' => 'array', 'default' => array(''), 'filter' => 'join');
|
||||
$config->bug->createform['browser'] = array('required' => false, 'type' => 'array', 'default' => array(''), 'filter' => 'join');
|
||||
$config->bug->createform['color'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
$config->bug->createform['severity'] = array('required' => false, 'type' => 'int', 'default' => 3);
|
||||
$config->bug->createform['pri'] = array('required' => false, 'type' => 'int', 'default' => 3);
|
||||
$config->bug->createform['steps'] = array('required' => false, 'type' => 'string', 'default' => $lang->bug->tplStep . $lang->bug->tplResult . $lang->bug->tplExpect);
|
||||
$config->bug->form->create['product'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->form->create['branch'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->form->create['module'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->form->create['project'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->form->create['execution'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->form->create['assignedTo'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
$config->bug->form->create['deadline'] = array('required' => false, 'type' => 'date', 'default' => '');
|
||||
$config->bug->form->create['feedbackBy'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
$config->bug->form->create['notifyEmail'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
$config->bug->form->create['type'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
|
||||
$config->bug->createform['story'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->createform['task'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->createform['oldTaskID'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->createform['case'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->createform['caseVersion'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->createform['result'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->createform['testtask'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->form->create['os'] = array('required' => false, 'type' => 'array', 'default' => array(''), 'filter' => 'join');
|
||||
$config->bug->form->create['browser'] = array('required' => false, 'type' => 'array', 'default' => array(''), 'filter' => 'join');
|
||||
$config->bug->form->create['color'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
$config->bug->form->create['severity'] = array('required' => false, 'type' => 'int', 'default' => 3);
|
||||
$config->bug->form->create['pri'] = array('required' => false, 'type' => 'int', 'default' => 3);
|
||||
$config->bug->form->create['steps'] = array('required' => false, 'type' => 'string', 'default' => $lang->bug->tplStep . $lang->bug->tplResult . $lang->bug->tplExpect);
|
||||
|
||||
$config->bug->createform['mailto'] = array('required' => false, 'type' => 'array', 'default' => array(''), 'filter' => 'join');
|
||||
$config->bug->createform['keywords'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
$config->bug->createform['status'] = array('required' => false, 'type' => 'string', 'default' => 'active');
|
||||
$config->bug->createform['issueKey'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
$config->bug->createform['uid'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
$config->bug->form->create['story'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->form->create['task'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->form->create['oldTaskID'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->form->create['case'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->form->create['caseVersion'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->form->create['result'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
$config->bug->form->create['testtask'] = array('required' => false, 'type' => 'int', 'default' => 0);
|
||||
|
||||
$config->bug->form->create['mailto'] = array('required' => false, 'type' => 'array', 'default' => array(''), 'filter' => 'join');
|
||||
$config->bug->form->create['keywords'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
$config->bug->form->create['status'] = array('required' => false, 'type' => 'string', 'default' => 'active');
|
||||
$config->bug->form->create['issueKey'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
$config->bug->form->create['uid'] = array('required' => false, 'type' => 'string', 'default' => '');
|
||||
|
||||
global $app;
|
||||
$config->bug->form->close = array();
|
||||
$config->bug->form->close['status'] = array('required' => false, 'type' => 'string', 'default' => 'closed');
|
||||
$config->bug->form->close['confirmed'] = array('required' => false, 'type' => 'int', 'default' => 1);
|
||||
$config->bug->form->close['assignedDate'] = array('required' => false, 'type' => 'string', 'default' => helper::now());
|
||||
$config->bug->form->close['lastEditedBy'] = array('required' => false, 'type' => 'string', 'default' => $app->user->account);
|
||||
$config->bug->form->close['lastEditedDate'] = array('required' => false, 'type' => 'string', 'default' => helper::now());
|
||||
$config->bug->form->close['closedBy'] = array('required' => false, 'type' => 'string', 'default' => $app->user->account);
|
||||
$config->bug->form->close['closedDate'] = array('required' => false, 'type' => 'string', 'default' => helper::now());
|
||||
$config->bug->form->close['comment'] = array('required' => false, 'type' => 'string', 'default' => '');;
|
||||
|
||||
+15
-25
@@ -328,7 +328,7 @@ class bug extends control
|
||||
{
|
||||
$response['result'] = 'success';
|
||||
|
||||
$formData = form::data($this->config->bug->createform);
|
||||
$formData = form::data($this->config->bug->form->create);
|
||||
$bug = $this->bugZen->beforeCreate($formData);
|
||||
$bugResult = $this->bugZen->doCreate($bug);
|
||||
|
||||
@@ -1875,48 +1875,48 @@ class bug extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭一个bug。
|
||||
* Close a bug.
|
||||
*
|
||||
* @param int $bugID
|
||||
* @param string $bugID
|
||||
* @param string $extra
|
||||
* @param string $from taskkanban
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function close($bugID, $extra = '', $from = '')
|
||||
public function close(string $bugID, string $extra = '', string $from = '')
|
||||
{
|
||||
$bug = $this->bug->getById($bugID);
|
||||
$oldBug = $this->bug->getByID((int)$bugID);
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
$changes = $this->bug->close($bugID, $extra);
|
||||
$data = form::data($this->config->bug->form->close);
|
||||
|
||||
$bug = $this->bugZen->prepareCloseExtras($data, $bugID);
|
||||
$this->bug->close($bug, $extra);
|
||||
if(dao::isError()) return print(js::error(dao::getError()));
|
||||
|
||||
$actionID = $this->action->create('bug', $bugID, 'Closed', $this->post->comment);
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
|
||||
$this->dao->update(TABLE_BUG)->set('assignedTo')->eq('closed')->where('id')->eq((int)$bugID)->exec();
|
||||
|
||||
$this->executeHooks($bugID);
|
||||
|
||||
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
|
||||
parse_str($extra, $output);
|
||||
if(isonlybody())
|
||||
{
|
||||
$execution = $this->loadModel('execution')->getByID($bug->execution);
|
||||
$execution = $this->loadModel('execution')->getByID($oldBug->execution);
|
||||
$execLaneType = $this->session->execLaneType ? $this->session->execLaneType : 'all';
|
||||
$execGroupBy = $this->session->execGroupBy ? $this->session->execGroupBy : 'default';
|
||||
if($this->app->tab == 'execution' and isset($execution->type) and $execution->type == 'kanban')
|
||||
{
|
||||
$rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : '';
|
||||
$regionID = !empty($output['regionID']) ? $output['regionID'] : 0;
|
||||
$kanbanData = $this->loadModel('kanban')->getRDKanban($bug->execution, $execLaneType, 'id_desc', $regionID, $execGroupBy, $rdSearchValue);
|
||||
$kanbanData = $this->loadModel('kanban')->getRDKanban($oldBug->execution, $execLaneType, 'id_desc', $regionID, $execGroupBy, $rdSearchValue);
|
||||
$kanbanData = json_encode($kanbanData);
|
||||
return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $regionID)"));
|
||||
}
|
||||
elseif($from == 'taskkanban')
|
||||
{
|
||||
$taskSearchValue = $this->session->taskSearchValue ? $this->session->taskSearchValue : '';
|
||||
$kanbanData = $this->loadModel('kanban')->getExecutionKanban($bug->execution, $execLaneType, $execGroupBy, $taskSearchValue);
|
||||
$kanbanData = $this->loadModel('kanban')->getExecutionKanban($oldBug->execution, $execLaneType, $execGroupBy, $taskSearchValue);
|
||||
$kanbanType = $execLaneType == 'all' ? 'bug' : key($kanbanData);
|
||||
$kanbanData = $kanbanData[$kanbanType];
|
||||
$kanbanData = json_encode($kanbanData);
|
||||
@@ -1937,18 +1937,8 @@ class bug extends control
|
||||
}
|
||||
}
|
||||
|
||||
$productID = $bug->product;
|
||||
$this->bug->checkBugExecutionPriv($bug);
|
||||
$this->qa->setMenu($this->products, $productID, $bug->branch);
|
||||
|
||||
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->bug->close;
|
||||
$this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]);
|
||||
$this->view->position[] = $this->lang->bug->close;
|
||||
|
||||
$this->view->bug = $bug;
|
||||
$this->view->users = $this->user->getPairs('noletter');
|
||||
$this->view->actions = $this->action->getList('bug', $bugID);
|
||||
$this->display();
|
||||
$this->bug->checkBugExecutionPriv($oldBug);
|
||||
$this->bugZen->buildCloseForm($oldBug);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+15
-25
@@ -1338,45 +1338,35 @@ class bugModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭一个bug。
|
||||
* Close a bug.
|
||||
*
|
||||
* @param int $bugID
|
||||
* @param object $bug
|
||||
* @param string $extra
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function close($bugID, $extra = '')
|
||||
public function close(object $bug, string $extra = '')
|
||||
{
|
||||
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
|
||||
$this->dao->update(TABLE_BUG)->data($bug, 'comment')->autoCheck()->checkFlow()->where('id')->eq((int)$bug->id)->exec();
|
||||
|
||||
$oldBug = $this->getByID((int)$bug->id);
|
||||
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
|
||||
parse_str($extra, $output);
|
||||
|
||||
$now = helper::now();
|
||||
$oldBug = $this->getById($bugID);
|
||||
$bug = fixer::input('post')
|
||||
->add('id', $bugID)
|
||||
->add('status', 'closed')
|
||||
->add('confirmed', 1)
|
||||
->setDefault('assignedDate', $now)
|
||||
->setDefault('lastEditedBy', $this->app->user->account)
|
||||
->setDefault('lastEditedDate', $now)
|
||||
->setDefault('closedBy', $this->app->user->account)
|
||||
->setDefault('closedDate', $now)
|
||||
->stripTags($this->config->bug->editor->close['id'], $this->config->allowedTags)
|
||||
->remove('comment')
|
||||
->get();
|
||||
|
||||
$bug = $this->loadModel('file')->processImgURL($bug, $this->config->bug->editor->close['id'], $this->post->uid);
|
||||
$this->dao->update(TABLE_BUG)->data($bug)->autoCheck()->checkFlow()->where('id')->eq((int)$bugID)->exec();
|
||||
if($oldBug->execution)
|
||||
{
|
||||
$this->loadModel('kanban');
|
||||
if(!isset($output['toColID'])) $this->kanban->updateLane($oldBug->execution, 'bug', $bugID);
|
||||
if(isset($output['toColID'])) $this->kanban->moveCard($bugID, $output['fromColID'], $output['toColID'], $output['fromLaneID'], $output['toLaneID']);
|
||||
if(!isset($output['toColID'])) $this->kanban->updateLane($oldBug->execution, 'bug', $bug->id);
|
||||
if(isset($output['toColID'])) $this->kanban->moveCard($bug->id, $output['fromColID'], $output['toColID'], $output['fromLaneID'], $output['toLaneID']);
|
||||
}
|
||||
|
||||
if(($this->config->edition == 'biz' || $this->config->edition == 'max') && $oldBug->feedback) $this->loadModel('feedback')->updateStatus('bug', $oldBug->feedback, $bug->status, $oldBug->status);
|
||||
|
||||
return common::createChanges($oldBug, $bug);
|
||||
$this->loadModel('action');
|
||||
$changes = common::createChanges($oldBug, $bug);
|
||||
$actionID = $this->action->create('bug', $bug->id, 'Closed', $bug->comment);
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
$this->dao->update(TABLE_BUG)->set('assignedTo')->eq('closed')->where('id')->eq((int)$bug->id)->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3100,7 +3090,7 @@ class bugModel extends model
|
||||
{
|
||||
/* Set toList and ccList. */
|
||||
$toList = $bug->assignedTo ? $bug->assignedTo : '';
|
||||
$ccList = trim($bug->mailto, ',');
|
||||
$ccList = trim((string)$bug->mailto, ',');
|
||||
if(empty($toList))
|
||||
{
|
||||
if(empty($ccList)) return false;
|
||||
|
||||
@@ -227,4 +227,39 @@ class bugZen extends bug
|
||||
|
||||
$this->view->projects = array('' => '') + $projects;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理关闭bug页面的请求数据。
|
||||
* Prepare close request data.
|
||||
*
|
||||
* @param object $data
|
||||
* @param int $bugID
|
||||
* @access protected
|
||||
* @return object
|
||||
*/
|
||||
protected function prepareCloseExtras(object $data, int $bugID): object
|
||||
{
|
||||
$bug = $data->add('id', $bugID)
|
||||
->stripTags($this->config->bug->editor->close['id'], $this->config->allowedTags)
|
||||
->get();
|
||||
|
||||
$bug = $this->loadModel('file')->processImgURL($bug, $this->config->bug->editor->close['id'], $data->rawdata->uid);
|
||||
return $bug;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建关闭bug页面。
|
||||
* Build the page of close bug.
|
||||
*
|
||||
* @param object $bug
|
||||
* @access protected
|
||||
* @return void
|
||||
*/
|
||||
protected function buildCloseForm(object $bug)
|
||||
{
|
||||
$this->view->bug = $bug;
|
||||
$this->view->users = $this->user->getPairs('noletter');
|
||||
$this->view->actions = $this->action->getList('bug', $bug->id);
|
||||
$this->display();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user