* Optimize code.

This commit is contained in:
xieqiyu
2022-09-01 11:04:08 +08:00
parent d552aa67f9
commit 16094e64d4
5 changed files with 6 additions and 10 deletions
+1 -2
View File
@@ -194,8 +194,7 @@ class bugModel extends model
$title = trim($title);
if(empty($title))
{
$canNotEmpty = $this->common->checkFieldEmpty('bug', $data, $i);
if($canNotEmpty)
if($this->common->checkValidRow('bug', $data, $i))
{
dao::$errors['message'][] = sprintf($this->lang->error->notempty, $this->lang->bug->title);
return false;
+2 -2
View File
@@ -3483,7 +3483,7 @@ EOD;
}
/**
* Check the field should be empty.
* Check valid row.
*
* @param string $objectType
* @param array $postData
@@ -3491,7 +3491,7 @@ EOD;
* @access public
* @return bool
*/
public function checkFieldEmpty($objectType, $postData = array(), $index = 0)
public function checkValidRow($objectType, $postData = array(), $index = 0)
{
if(empty($postData)) return false;
+1 -2
View File
@@ -499,8 +499,7 @@ class storyModel extends model
{
if(empty($title))
{
$canNotEmpty = $this->common->checkFieldEmpty('story', $stories, $i);
if($canNotEmpty)
if($this->common->checkValidRow('story', $stories, $i))
{
dao::$errors['message'][] = sprintf($this->lang->error->notempty, $this->lang->story->title);
return false;
+1 -2
View File
@@ -355,8 +355,7 @@ class taskModel extends model
if(empty($tasks->name[$i]))
{
$canNotEmpty = $this->common->checkFieldEmpty('task', $tasks, $i);
if($canNotEmpty)
if($this->common->checkValidRow('task', $tasks, $i))
{
dao::$errors['message'][] = sprintf($this->lang->error->notempty, $this->lang->task->name);
return false;
+1 -2
View File
@@ -157,8 +157,7 @@ class testcaseModel extends model
{
if(empty($title))
{
$canNotEmpty = $this->common->checkFieldEmpty('testcase', $cases, $i);
if($canNotEmpty)
if($this->common->checkValidRow('testcase', $cases, $i))
{
dao::$errors['message'][] = sprintf($this->lang->error->notempty, $this->lang->testcase->title);
return false;