* Fix bug for bug import.

This commit is contained in:
tanghucheng
2022-08-14 10:40:40 +08:00
parent d3619ab1ad
commit 9a4d97f7ed
4 changed files with 13 additions and 7 deletions
+1
View File
@@ -309,6 +309,7 @@ $config->bug->datatable->fieldList['assignedTo']['title'] = 'assignedToAB';
$config->bug->datatable->fieldList['assignedTo']['fixed'] = 'no';
$config->bug->datatable->fieldList['assignedTo']['width'] = '120';
$config->bug->datatable->fieldList['assignedTo']['required'] = 'no';
$config->bug->datatable->fieldList['assignedTo']['dataSource'] = array('module' => 'bug', 'method' =>'getProductMemberPairs', 'params' => '$productID&$branch');
$config->bug->datatable->fieldList['assignedDate']['title'] = 'assignedDate';
$config->bug->datatable->fieldList['assignedDate']['fixed'] = 'no';
+3
View File
@@ -19,6 +19,9 @@ $config->port->sysLangFields = ',pri,status,type,mode,severity,os,browser,resol
$config->port->sysDataFields = 'execution,product,user';
$config->port->userFields = 'assignedTo,openedBy,finishedBy,canceledBy,closedBy,lastEditedBy,lastRunner,resolvedBy,reviewedBy';
$config->port->defaultZeroField = 'severity,pri';
$config->port->defaultEmptyField = '';
$config->port->import = new stdClass();
$config->port->dateMatch = '/[1-9]\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/';
+1 -1
View File
@@ -182,7 +182,7 @@ class port extends control
$fieldList = $this->port->initFieldList($model, $fields, false);
if(empty($fieldList[$field]['values'])) $fieldList[$field]['values'] = array();
if(!isset($fieldList[$field]['values'][''])) $fieldList[$field]['values'][''] = '';
$multiple = $fieldList[$field]['control'] == 'multiple' ? 'multiple' : '';
$name = $field . "[$index]";
+8 -6
View File
@@ -212,6 +212,7 @@ class portModel extends model
*/
public function initPostFields($model = '')
{
$this->commonActions($model);
$datas = fixer::input('post')->get();
$objectData = array();
foreach ($datas as $field => $data)
@@ -220,7 +221,7 @@ class portModel extends model
{
foreach($data as $key => $value)
{
if(is_array($value) and isset($this->config->$model->fieldList[$field]) and $this->config->$model->fieldList[$field]['control'] == 'multiple') $value = implode(',', $value);
if(is_array($value)) $value = join(',', $value);
$objectData[$key][$field] = $value;
}
}
@@ -268,7 +269,6 @@ class portModel extends model
$modelFieldList['values'] = $this->initValues($model, $field, $modelFieldList, $withKey);
$fieldList[$field] = $modelFieldList;
}
return $fieldList;
}
@@ -313,8 +313,9 @@ class portModel extends model
*/
public function initControl($model, $field)
{
if(isset($this->modelFieldList[$field]['control'])) return $this->modelFieldList[$field]['control'];
if(isset($this->modelLang->{$field.'List'})) return 'select';
if(isset($this->modelFieldList[$field]['control'])) return $this->modelFieldList[$field]['control'];
if(isset($this->modelLang->{$field.'List'})) return 'select';
if(isset($this->modelFieldList[$field]['dataSource'])) return 'select';
if(strpos($this->portConfig->sysDataFields, $field) !== false) return 'select';
return $this->portConfig->fieldList['control'];
@@ -549,7 +550,7 @@ class portModel extends model
if(empty($rows)) return $exportDatas;
$exportDatas['user'] = $this->loadModel('user')->getPairs('devfirst|noclosed|nodeleted');
$exportDatas['user'] = $this->loadModel('user')->getPairs('noclosed|nodeleted|noletter');
foreach ($rows as $id => $values)
{
@@ -816,6 +817,7 @@ class portModel extends model
{
foreach($data as $field => $cellValue)
{
if(strpos($this->portConfig->dateFeilds, $field) !== false and helper::isZeroDate($cellValue)) $datas[$key]->$field = '';
if(strpos($filter, $field) !== false) continue;
if(is_array($cellValue)) continue;
if(strrpos($cellValue, '(#') === false)
@@ -1262,7 +1264,7 @@ class portModel extends model
if($control == 'select' or $control == 'multiple')
{
if(!empty($values[$selected])) $options = array($selected => $values[$selected]);
if(empty($options) and isset($values[0])) $options = array_slice($values, 0, 1);
if(empty($options) and is_array($values)) $options = array_slice($values, 0, 1);
}
if($control == 'select') $html .= '<td>' . html::select("$name", $options, $selected, "class='form-control picker-select nopicker' data-field='{$field}' data-index='{$row}'") . '</td>';