* Remove bug config and zen.
This commit is contained in:
@@ -1,38 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
$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->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->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' => '<p>[步骤]</p><br/><p>[结果]</p><br/><p>[期望]</p><br/>');
|
||||
|
||||
$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->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' => '');
|
||||
@@ -1,103 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
class bugZen extends bug
|
||||
{
|
||||
/**
|
||||
* 处理请求数据
|
||||
* Processing request data.
|
||||
*
|
||||
* @param object $formData
|
||||
* @return object|false
|
||||
*/
|
||||
protected function beforeCreate(object $formData): object|bool
|
||||
{
|
||||
$now = helper::now();
|
||||
$bug = $formData->setDefault('openedBy', $this->app->user->account)
|
||||
->setDefault('openedDate', $now)
|
||||
->setIF($this->lang->navGroup->bug != 'qa', 'project', $this->session->project)
|
||||
->setIF($this->post->assignedTo != '', 'assignedDate', $now)
|
||||
->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story))
|
||||
->setIF(strpos($this->config->bug->create->requiredFields, 'deadline') !== false, 'deadline', $this->post->deadline)
|
||||
->setIF(strpos($this->config->bug->create->requiredFields, 'execution') !== false, 'execution', $this->post->execution)
|
||||
->stripTags($this->config->bug->editor->create['id'], $this->config->allowedTags)
|
||||
->cleanInt('product,execution,module,severity')
|
||||
->remove('files,labels,uid,oldTaskID,contactListMenu,region,lane,ticket,deleteFiles,resultFiles')
|
||||
->get();
|
||||
|
||||
$bug = $this->loadModel('file')->processImgURL($bug, $this->config->bug->editor->create['id'], $formData->rawdata->uid);
|
||||
|
||||
return $bug;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建bug。
|
||||
* Create a bug.
|
||||
*
|
||||
* @param object $bug
|
||||
* @access protected
|
||||
* @return array|false
|
||||
*/
|
||||
protected function doCreate(object $bug): array|bool
|
||||
{
|
||||
/* Check repeat bug. */
|
||||
$result = $this->loadModel('common')->removeDuplicate('bug', $bug, "product={$bug->product}");
|
||||
if($result and $result['stop']) return array('status' => 'exists', 'id' => $result['duplicate']);
|
||||
|
||||
return $this->bug->create($bug);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建bug后数据处理
|
||||
* Do thing after create a bug.
|
||||
*
|
||||
* @param object $bug
|
||||
* @param object $formData
|
||||
* @param string $extra
|
||||
* @return void
|
||||
*/
|
||||
protected function afterCreate(object $bug, object $formData, string $extras): void
|
||||
{
|
||||
$extras = str_replace(array(',', ' '), array('&', ''), $extras);
|
||||
parse_str($extras, $output);
|
||||
$from = isset($output['from']) ? $output['from'] : '';
|
||||
|
||||
if(isset($formData->rawdata['resultFiles']))
|
||||
{
|
||||
$resultFiles = $formData->rawdata['resultFiles'];
|
||||
if(isset($formData->rawdata['deleteFiles']))
|
||||
{
|
||||
foreach($formData->rawdata['deleteFiles'] as $deletedCaseFileID) $resultFiles = trim(str_replace(",$deletedCaseFileID,", ',', ",$resultFiles,"), ',');
|
||||
}
|
||||
$files = $this->dao->select('*')->from(TABLE_FILE)->where('id')->in($resultFiles)->fetchAll('id');
|
||||
foreach($files as $file)
|
||||
{
|
||||
unset($file->id);
|
||||
$file->objectType = 'bug';
|
||||
$file->objectID = $bugID;
|
||||
$this->dao->insert(TABLE_FILE)->data($file)->exec();
|
||||
}
|
||||
}
|
||||
|
||||
$this->file->updateObjectID($formData->rawdata->uid, $bugID, 'bug');
|
||||
$this->file->saveUpload('bug', $bugID);
|
||||
empty($bug->case) ? $this->loadModel('score')->create('bug', 'create', $bugID) : $this->loadModel('score')->create('bug', 'createFormCase', $bug->case);
|
||||
|
||||
if($bug->execution)
|
||||
{
|
||||
$this->loadModel('kanban');
|
||||
|
||||
$laneID = isset($output['laneID']) ? $output['laneID'] : 0;
|
||||
if(!empty($formData->rawdata['lane'])) $laneID = $formData->rawdata['lane'];
|
||||
|
||||
$columnID = $this->kanban->getColumnIDByLaneID($laneID, 'unconfirmed');
|
||||
if(empty($columnID)) $columnID = isset($output['columnID']) ? $output['columnID'] : 0;
|
||||
|
||||
if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($bug->execution, $laneID, $columnID, 'bug', $bugID);
|
||||
if(empty($laneID) or empty($columnID)) $this->kanban->updateLane($bug->execution, 'bug');
|
||||
}
|
||||
|
||||
/* Callback the callable method to process the related data for object that is transfered to bug. */
|
||||
if($from && is_callable(array($this, $this->config->bug->fromObjects[$from]['callback']))) call_user_func(array($this, $this->config->bug->fromObjects[$from]['callback']), $bugID);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user