From f0928f2f3e4abda9bb1af8863e84eb3a5d56d8fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AE=8B=E8=BE=B0=E8=BD=A9?= Date: Thu, 27 Apr 2023 10:49:24 +0800 Subject: [PATCH] * Remove bug config and zen. --- module/bug/config/form.php | 38 -------------- module/bug/zen.php | 103 ------------------------------------- 2 files changed, 141 deletions(-) delete mode 100644 module/bug/config/form.php delete mode 100644 module/bug/zen.php diff --git a/module/bug/config/form.php b/module/bug/config/form.php deleted file mode 100644 index c7bd406bac..0000000000 --- a/module/bug/config/form.php +++ /dev/null @@ -1,38 +0,0 @@ -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' => '

[步骤]


[结果]


[期望]


'); - -$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' => ''); diff --git a/module/bug/zen.php b/module/bug/zen.php deleted file mode 100644 index 45be7a8c42..0000000000 --- a/module/bug/zen.php +++ /dev/null @@ -1,103 +0,0 @@ -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); - } - -}