* Code for task#66955.
This commit is contained in:
@@ -56,7 +56,7 @@ $config->bug->custom->createFields = $config->bug->list->customCreateFields
|
||||
$config->bug->custom->batchCreateFields = 'project,execution,deadline,steps,type,severity,os,browser,%s';
|
||||
$config->bug->custom->batchEditFields = 'type,severity,pri,assignedTo,deadline,status,resolvedBy,resolution';
|
||||
|
||||
$config->bug->excludeCheckFileds = 'severity,title,keywords';
|
||||
$config->bug->excludeCheckFileds = ',severities,';
|
||||
|
||||
$config->bug->editor = new stdclass();
|
||||
$config->bug->editor->create = array('id' => 'steps', 'tools' => 'bugTools');
|
||||
|
||||
@@ -194,13 +194,16 @@ class bugModel extends model
|
||||
$title = trim($title);
|
||||
if(empty($title))
|
||||
{
|
||||
$this->common->checkFieldEmpty('bug', 'title', $data, $i);
|
||||
if(dao::isError()) return false;
|
||||
$canNotEmpty = $this->common->checkFieldEmpty('bug', $data, $i);
|
||||
if($canNotEmpty)
|
||||
{
|
||||
dao::$errors['message'][] = sprintf($this->lang->error->notempty, $this->lang->bug->title);
|
||||
return false;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
$bug = new stdClass();
|
||||
$bug->openedBy = $this->app->user->account;
|
||||
$bug->openedDate = $now;
|
||||
|
||||
+6
-13
@@ -3486,29 +3486,22 @@ EOD;
|
||||
* Check the field should be empty.
|
||||
*
|
||||
* @param string $objectType
|
||||
* @param string $checkField
|
||||
* @param array $postData
|
||||
* @param int $index
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function checkFieldEmpty($objectType, $checkField, $postData = array(), $index = 0)
|
||||
public function checkFieldEmpty($objectType, $postData = array(), $index = 0)
|
||||
{
|
||||
if(empty($postData)) return true;
|
||||
if(empty($postData)) return false;
|
||||
|
||||
foreach(explode(',', $this->config->$objectType->custom->batchCreateFields . ',' . $this->config->$objectType->create->requiredFields) as $field)
|
||||
foreach($postData as $key => $value)
|
||||
{
|
||||
if(empty($field) or strpos($this->config->$objectType->excludeCheckFileds, $field) !== false) continue;
|
||||
|
||||
if($objectType == 'bug') $field = strpos('steps,os', $field) !== false ? $field . 'es' : $field . 's';
|
||||
if(isset($postData->$field) and !empty($postData->$field[$index]) and $postData->$field[$index] != 'ditto')
|
||||
{
|
||||
dao::$errors['message'][] = sprintf($this->lang->error->notempty, $this->lang->$objectType->$checkField);
|
||||
return false;
|
||||
}
|
||||
if(!is_array($value) or strpos($this->config->$objectType->excludeCheckFileds, ",$key,") !== false) continue;
|
||||
if(isset($value[$index]) and !empty($value[$index]) and $value[$index] != 'ditto') return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,8 @@ $config->story->custom->createFields = $config->story->list->customCreateFi
|
||||
$config->story->custom->batchCreateFields = 'module,plan,spec,pri,estimate,review,%s';
|
||||
$config->story->custom->batchEditFields = 'branch,module,plan,estimate,pri,source,stage,closedBy,closedReason';
|
||||
|
||||
$config->story->excludeCheckFileds = ',uploadImage,category,reviewer,reviewDitto,';
|
||||
|
||||
global $lang, $app;
|
||||
$config->story->datatable = new stdclass();
|
||||
if($app->tab == 'execution')
|
||||
|
||||
@@ -499,8 +499,12 @@ class storyModel extends model
|
||||
{
|
||||
if(empty($title))
|
||||
{
|
||||
$this->common->checkFieldEmpty('story', 'title', $stories, $i);
|
||||
if(dao::isError()) return false;
|
||||
$canNotEmpty = $this->common->checkFieldEmpty('story', $stories, $i);
|
||||
if($canNotEmpty)
|
||||
{
|
||||
dao::$errors['message'][] = sprintf($this->lang->error->notempty, $this->lang->story->title);
|
||||
return false;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ $config->task->custom->createFields = $config->task->customCreateFields;
|
||||
$config->task->custom->batchCreateFields = 'module,story,assignedTo,estimate,desc,pri';
|
||||
$config->task->custom->batchEditFields = 'module,assignedTo,status,pri,estimate,record,left';
|
||||
|
||||
$config->task->excludeCheckFileds = 'pri';
|
||||
$config->task->excludeCheckFileds = ',pri,estStartedDitto,deadlineDitto,';
|
||||
|
||||
$config->task->datatable = new stdclass();
|
||||
$config->task->datatable->defaultField = array('id', 'pri', 'name', 'status', 'assignedTo', 'finishedBy', 'estimate', 'consumed', 'left', 'progress', 'deadline', 'actions');
|
||||
|
||||
@@ -355,9 +355,12 @@ class taskModel extends model
|
||||
|
||||
if(empty($tasks->name[$i]))
|
||||
{
|
||||
$this->common->checkFieldEmpty('task', 'name', $tasks, $i);
|
||||
if(dao::isError()) return false;
|
||||
|
||||
$canNotEmpty = $this->common->checkFieldEmpty('task', $tasks, $i);
|
||||
if($canNotEmpty)
|
||||
{
|
||||
dao::$errors['message'][] = sprintf($this->lang->error->notempty, $this->lang->task->name);
|
||||
return false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ $config->testcase->custom->createFields = $config->testcase->customCreateFi
|
||||
$config->testcase->custom->batchCreateFields = 'module,story,%s';
|
||||
$config->testcase->custom->batchEditFields = 'branch,module,stage,status,pri,story';
|
||||
|
||||
$config->testcase->excludeCheckFileds = 'pri,type,stage';
|
||||
$config->testcase->excludeCheckFileds = ',pri,type,stage,';
|
||||
|
||||
global $lang;
|
||||
$config->testcase->search['module'] = 'testcase';
|
||||
|
||||
@@ -157,8 +157,12 @@ class testcaseModel extends model
|
||||
{
|
||||
if(empty($title))
|
||||
{
|
||||
$result = $this->common->checkFieldEmpty('testcase', 'title', $cases, $i);
|
||||
if(dao::isError()) return false;
|
||||
$canNotEmpty = $this->common->checkFieldEmpty('testcase', $cases, $i);
|
||||
if($canNotEmpty)
|
||||
{
|
||||
dao::$errors['message'][] = sprintf($this->lang->error->notempty, $this->lang->testcase->title);
|
||||
return false;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user