Fix invalid type when importing - typo, and also check translated type too

This commit is contained in:
Nathan Gray 2012-10-09 15:57:17 +00:00
parent a0a3cfb4fc
commit 074cab0f67

View File

@ -151,7 +151,7 @@ class infolog_import_infologs_csv implements importexport_iface_import_plugin {
$_definition->plugin_options['record_owner'] = $this->user;
$_lookups = array(
'info_type' => $this->boinfolog->enums['types'],
'info_type' => $this->boinfolog->enums['type'],
'info_status' => $this->boinfolog->status['task']
);
@ -180,10 +180,19 @@ class infolog_import_infologs_csv implements importexport_iface_import_plugin {
// Make sure type is valid
if(!$record['info_type'] || $record['info_type'] && !$this->boinfolog->enums['type'][$record['info_type']])
{
// Check for translated type
$un_trans = translation::get_message_id($record['info_type'],'infolog');
if($record['info_type'] && $this->boinfolog->enums['type'][$un_trans])
{
$record['info_type'] = $un_trans;
}
else
{
$this->errors[$import_csv->get_current_position()] .= ($this->errors[$import_csv->get_current_position()] ? "\n":'').
lang('Unknown type: %1', $record['info_type']);
}
}
// Set default status for type, if not specified
if(!$record['info_status'] && $record['info_type'])