* Optimize code for bug-batchCreate.

This commit is contained in:
liumengyi
2023-05-23 13:40:26 +08:00
parent bc0a02c0e6
commit 254a6db995
4 changed files with 46 additions and 106 deletions
+3 -10
View File
@@ -91,12 +91,8 @@ class bugModel extends model
foreach($bugs as $index => $bug)
{
/* Get lane id, remove laneID from bug. */
$laneID = zget($output, 'laneID', 0);
if(isset($bug->laneID))
{
$laneID = $bug->laneID;
unset($bug->laneID);
}
$laneID = !empty($bug->laneID) ? zget($output, 'laneID', 0) : $bug->laneID;
unset($bug->laneID);
$uploadImage = !empty($uploadImages[$index]) ? $uploadImages[$index] : '';
@@ -2985,14 +2981,11 @@ class bugModel extends model
continue;
}
/* Title cannot be empty. */
if(empty($bug->title)) dao::$errors['message'][] = sprintf($this->lang->error->notempty, $this->lang->bug->title);
/* Check required fields. */
foreach(explode(',', $this->config->bug->create->requiredFields) as $field)
{
$field = trim($field);
if($field and empty($bug->$field) and $field != 'title') dao::$errors['message'][] = sprintf($this->lang->error->notempty, $this->lang->bug->$field);
if($field and empty($bug->$field) and $field != 'title') dao::$errors["{$filed}[{$index}]"] = sprintf($this->lang->error->notempty, $this->lang->bug->$field);
}
}