From 294b3e0ccfec958e4979af03d32d8f8f845de29b Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Sat, 10 Oct 2020 16:55:47 +0800 Subject: [PATCH] * Add notes. --- module/bug/model.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index 3c48c66211..f7a0e6157e 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -129,7 +129,7 @@ class bugModel extends model * * @param string $from object that is transfered to bug. * @access public - * @return int|bool + * @return array|bool */ public function create($from = '') { @@ -177,17 +177,19 @@ class bugModel extends model * Batch create * * @param int $productID + * @param int $branch * @access public * @return void */ public function batchCreate($productID, $branch = 0) { + /* Load module and init vars. */ $this->loadModel('action'); - $branch = (int)$branch; - $productID = (int)$productID; - $now = helper::now(); - $actions = array(); - $data = fixer::input('post')->get(); + $branch = (int)$branch; + $productID = (int)$productID; + $now = helper::now(); + $actions = array(); + $data = fixer::input('post')->get(); $result = $this->loadModel('common')->removeDuplicate('bug', $data, "product={$productID}"); $data = $result['data']; @@ -220,8 +222,10 @@ class bugModel extends model $data->browsers[$i] = $browser; } + /* If there are images to upload, load the file module. */ if(isset($data->uploadImage)) $this->loadModel('file'); $extendFields = $this->getFlowExtendFields(); + $bugs = array(); foreach($data->title as $i => $title) { @@ -246,6 +250,7 @@ class bugModel extends model $bug->browser = $data->browsers[$i]; $bug->keywords = $data->keywords[$i]; + /* Assign the bug to the person in charge of the module. */ if(!empty($moduleOwners[$bug->module])) { $bug->assignedTo = $moduleOwners[$bug->module]; @@ -259,6 +264,7 @@ class bugModel extends model if($message) die(js::alert($message)); } + /* Required field check. */ foreach(explode(',', $this->config->bug->create->requiredFields) as $field) { $field = trim($field); @@ -268,6 +274,7 @@ class bugModel extends model $bugs[$i] = $bug; } + /* When the bug is created by uploading an image, add the image to the step of the bug. */ foreach($bugs as $i => $bug) { if(!empty($data->uploadImage[$i])) @@ -305,6 +312,7 @@ class bugModel extends model $this->executeHooks($bugID); + /* When the bug is created by uploading the image, add the image to the file of the bug. */ $this->loadModel('score')->create('bug', 'create', $bugID); if(!empty($data->uploadImage[$i]) and !empty($file)) {