Merge branch 'importExport'
This commit is contained in:
@@ -28,4 +28,9 @@ function submitForm(type)
|
||||
$('#importNoticeModal .form-actions .btn').addClass('disabled');
|
||||
$("button[data-target='#importNoticeModal']").closest('form').submit();
|
||||
}
|
||||
|
||||
$('#importNoticeModal .close').click(function()
|
||||
{
|
||||
$('#importNoticeModal .form-actions .btn').removeClass('disabled');
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -159,7 +159,6 @@ class port extends control
|
||||
$datas = $this->port->getPageDatas($formatDatas, $pagerID);
|
||||
|
||||
if($model == 'task') $datas = $this->task->processDatas4Task($datas);
|
||||
|
||||
$html = $this->port->buildNextList($datas->datas, $lastID, $fields, $pagerID, $model);
|
||||
die($html);
|
||||
}
|
||||
|
||||
+71
-22
@@ -198,10 +198,12 @@ class portModel extends model
|
||||
/* Get export rows and fields datas */
|
||||
$exportDatas = $this->getExportDatas($fieldList, $rows);
|
||||
|
||||
$exportDatas['rows'] = $this->$model->processExportData($exportDatas['rows']);
|
||||
$fields = $exportDatas['fields'];
|
||||
$rows = $exportDatas['rows'];
|
||||
if($this->config->edition != 'open') list($fields, $rows) = $this->loadModel('workflowfield')->appendDataFromFlow($fields, $rows, $model);
|
||||
|
||||
$this->post->set('rows', $exportDatas['rows']);
|
||||
$this->post->set('fields', $exportDatas['fields']);
|
||||
$this->post->set('rows', $rows);
|
||||
$this->post->set('fields', $fields);
|
||||
$this->post->set('kind', $model);
|
||||
}
|
||||
|
||||
@@ -251,6 +253,7 @@ class portModel extends model
|
||||
if(empty($fields)) return false;
|
||||
|
||||
if(!is_array($fields)) $fields = explode(',', $fields);
|
||||
|
||||
$fieldList = array();
|
||||
/* build module fieldList. */
|
||||
foreach($fields as $key => $field)
|
||||
@@ -277,6 +280,35 @@ class portModel extends model
|
||||
$fieldList['mailto']['control'] = 'multiple';
|
||||
$fieldList['mailto']['values'] = $this->portConfig->sysDataList['user'];
|
||||
}
|
||||
|
||||
if($this->config->edition != 'open')
|
||||
{
|
||||
/* Set workflow fields .*/
|
||||
$workflowFields = $this->dao->select('*')->from(TABLE_WORKFLOWFIELD)
|
||||
->where('module')->eq($model)
|
||||
->andWhere('buildin')->eq(0)
|
||||
->fetchAll('id');
|
||||
|
||||
foreach($workflowFields as $field)
|
||||
{
|
||||
if(!in_array($field->control, array('select', 'radio', 'multi-select'))) continue;
|
||||
if(!isset($fields[$field->field]) and !array_search($field->field, $fields)) continue;
|
||||
if(empty($field->options)) continue;
|
||||
|
||||
$field = $this->loadModel('workflowfield')->processFieldOptions($field);
|
||||
$options = $this->workflowfield->getFieldOptions($field, true);
|
||||
if($options)
|
||||
{
|
||||
$control = $field->control == 'multi-select' ? 'multiple' : 'select';
|
||||
$fieldList[$field->field]['title'] = $field->name;
|
||||
$fieldList[$field->field]['control'] = $control;
|
||||
$fieldList[$field->field]['values'] = $options;
|
||||
$fieldList[$field->field]['from'] = 'workflow';
|
||||
$this->config->$model->listFields .= ',' . $field->field;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $fieldList;
|
||||
}
|
||||
|
||||
@@ -443,7 +475,7 @@ class portModel extends model
|
||||
|
||||
$modelData = $this->processRows4Fields($rows, $fields);
|
||||
|
||||
$modelData = $this->getNatureDatas($model, $modelData, $filter);
|
||||
$modelData = $this->getNatureDatas($model, $modelData, $filter, $fields);
|
||||
|
||||
$this->createTmpFile($modelData);
|
||||
}
|
||||
@@ -451,7 +483,8 @@ class portModel extends model
|
||||
{
|
||||
$modelData = $this->getDatasByFile($tmpFile);
|
||||
}
|
||||
|
||||
if(isset($fields['id'])) unset($fields['id']);
|
||||
$this->session->set($model . 'TemplateFields', array_keys($fields));
|
||||
return $modelData;
|
||||
}
|
||||
|
||||
@@ -650,7 +683,6 @@ class portModel extends model
|
||||
{
|
||||
$lists = array();
|
||||
$this->commonActions($model);
|
||||
|
||||
if(!empty($this->modelListFields))
|
||||
{
|
||||
$listFields = $this->modelListFields;
|
||||
@@ -663,6 +695,7 @@ class portModel extends model
|
||||
$lists[$listName] = $fieldList[$field]['values'];
|
||||
if(strpos($this->config->$model->sysLangFields, $field)) $lists[$listName] = join(',', $fieldList[$field]['values']);
|
||||
}
|
||||
$this->config->excel->sysDataField[] = $field;
|
||||
}
|
||||
|
||||
$lists['listStyle'] = $listFields;
|
||||
@@ -828,20 +861,39 @@ class portModel extends model
|
||||
* @param int $model
|
||||
* @param int $datas
|
||||
* @param string $filter
|
||||
* @param string $fields
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getNatureDatas($model, $datas, $filter = '')
|
||||
public function getNatureDatas($model, $datas, $filter = '', $fields = '')
|
||||
{
|
||||
$fieldList = $this->initFieldList($model, array_keys($fields), false);
|
||||
$lang = $this->lang->$model;
|
||||
|
||||
foreach($datas as $key => $data)
|
||||
{
|
||||
foreach($data as $field => $cellValue)
|
||||
{
|
||||
if(empty($cellValue)) continue;
|
||||
if(strpos($this->portConfig->dateFeilds, $field) !== false and helper::isZeroDate($cellValue)) $datas[$key]->$field = '';
|
||||
if(strpos($filter, $field) !== false) continue;
|
||||
//if(strpos($filter, $field) !== false) continue;
|
||||
if(is_array($cellValue)) continue;
|
||||
if(strrpos($cellValue, '(#') === false)
|
||||
|
||||
if(!empty($fieldList[$field]['from']) and in_array($fieldList[$field]['control'], array('select', 'multiple')))
|
||||
{
|
||||
$control = $fieldList[$field]['control'];
|
||||
if($control == 'multiple')
|
||||
{
|
||||
$cellValue = explode("\n", $cellValue);
|
||||
foreach($cellValue as &$value) $value = array_search($value, $fieldList[$field]['values'], true);
|
||||
$datas[$key]->$field = join(',', $cellValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
$datas[$key]->$field = array_search($cellValue, $fieldList[$field]['values']);
|
||||
}
|
||||
}
|
||||
elseif(strrpos($cellValue, '(#') === false)
|
||||
{
|
||||
if(!isset($lang->{$field . 'List'}) or !is_array($lang->{$field . 'List'})) continue;
|
||||
|
||||
@@ -944,6 +996,7 @@ class portModel extends model
|
||||
$this->commonActions($model);
|
||||
$modelLang = $this->lang->$model;
|
||||
$fields = explode(',', $this->modelConfig->templateFields);
|
||||
|
||||
array_unshift($fields, 'id');
|
||||
foreach($fields as $key => $fieldName)
|
||||
{
|
||||
@@ -952,6 +1005,15 @@ class portModel extends model
|
||||
unset($fields[$key]);
|
||||
}
|
||||
|
||||
if($this->config->edition != 'open')
|
||||
{
|
||||
$appendFields = $this->loadModel('workflowaction')->getFields($model, 'showimport', false);
|
||||
foreach($appendFields as $appendField)
|
||||
{
|
||||
if(!$appendField->buildin and $appendField->show) $fields[$appendField->field] = $appendField->name;
|
||||
}
|
||||
}
|
||||
|
||||
return $fields;
|
||||
}
|
||||
|
||||
@@ -1226,8 +1288,6 @@ class portModel extends model
|
||||
|
||||
$importFields = !empty($_SESSION[$model . 'TemplateFields']) ? $_SESSION[$model . 'TemplateFields'] : $this->config->$model->templateFields;
|
||||
|
||||
$this->getWorkFlowFields($model);
|
||||
|
||||
$datas->requiredFields = $this->config->$model->create->requiredFields;
|
||||
$datas->allPager = isset($datas->allPager) ? $datas->allPager : 1;
|
||||
$datas->pagerID = $pagerID;
|
||||
@@ -1259,7 +1319,6 @@ class portModel extends model
|
||||
$addID = 1;
|
||||
if($model == 'task') $members = $this->loadModel('user')->getTeamMemberPairs($this->session->taskPortParams['executionID'], 'execution');
|
||||
|
||||
$appendFields = $this->session->appendFields;
|
||||
$showImportCount = $this->config->port->lazyLoading ? $this->config->port->showImportCount : $this->maxImport;
|
||||
$lastRow = $lastID + $key + $showImportCount;
|
||||
|
||||
@@ -1346,16 +1405,6 @@ class portModel extends model
|
||||
else $html .= '<td>' . html::input("$name", $selected, "class='form-control autocomplete='off'") . '</td>';
|
||||
}
|
||||
|
||||
if(!empty($appendFields))
|
||||
{
|
||||
$this->loadModel('flow');
|
||||
foreach($appendFields as $field)
|
||||
{
|
||||
if(!$field->show) continue;
|
||||
$value = $field->defaultValue ? $field->defaultValue : zget($object, $field->field, '');
|
||||
$html .='<td>' . $this->flow->buildControl($field, $value, "$field->field[$key]", true) . '</td>';
|
||||
}
|
||||
}
|
||||
$html .= '</tr>' . "\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -4,16 +4,3 @@
|
||||
<th class='c-<?php echo $key?>' id='<?php echo $key;?>'> <?php echo $value['title'];?></th>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
<?php
|
||||
if(!empty($appendFields))
|
||||
{
|
||||
foreach($appendFields as $field)
|
||||
{
|
||||
if(!$field->show) continue;
|
||||
|
||||
$width = ($field->width && $field->width != 'auto' ? $field->width . 'px' : 'auto');
|
||||
$required = strpos(",$field->rules,", ",$notEmptyRule->id,") !== false ? 'required' : '';
|
||||
echo "<th class='$required' style='width: $width'>$field->name</th>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user