* Optimize code.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user