mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-02 19:39:26 +01:00
Log the format attempted
r38201: Give a warning if imported type is not valid r38218: Add current record to the end of errors / warnings r38244: Make warning about missing type into error
This commit is contained in:
parent
8af34bfef8
commit
e973f8dd0e
@ -342,13 +342,15 @@ class importexport_import_csv implements importexport_iface_import_record { //,
|
|||||||
try {
|
try {
|
||||||
$formatted = new egw_time($record[$name]);
|
$formatted = new egw_time($record[$name]);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$warnings[] = $name.': ' . $e->getMessage();
|
$warnings[] = $name.': ' . $e->getMessage() . "\n" .
|
||||||
|
'Format: '.'!'.egw_time::$user_dateformat . ' ' .egw_time::$user_timeformat;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$errors = egw_time::getLastErrors();
|
$errors = egw_time::getLastErrors();
|
||||||
foreach($errors['errors'] as $char => $msg)
|
foreach($errors['errors'] as $char => $msg)
|
||||||
{
|
{
|
||||||
$warnings[] = "$name: [$char] $msg";
|
$warnings[] = "$name: [$char] $msg\n".
|
||||||
|
'Format: '.'!'.egw_time::$user_dateformat . ' ' .egw_time::$user_timeformat;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,6 +176,13 @@ class infolog_import_infologs_csv implements importexport_iface_import_plugin {
|
|||||||
$result = importexport_import_csv::convert($record, infolog_egw_record::$types, 'infolog', $lookups, $_definition->plugin_options['convert']);
|
$result = importexport_import_csv::convert($record, infolog_egw_record::$types, 'infolog', $lookups, $_definition->plugin_options['convert']);
|
||||||
if($result) $this->warnings[$import_csv->get_current_position()] = $result;
|
if($result) $this->warnings[$import_csv->get_current_position()] = $result;
|
||||||
|
|
||||||
|
// Make sure type is valid
|
||||||
|
if(!$record['info_type'] || $record['info_type'] && !$this->boinfolog->enums['type'][$record['info_type']])
|
||||||
|
{
|
||||||
|
$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
|
// Set default status for type, if not specified
|
||||||
if(!$record['info_status'] && $record['info_type'])
|
if(!$record['info_status'] && $record['info_type'])
|
||||||
{
|
{
|
||||||
@ -264,6 +271,12 @@ class infolog_import_infologs_csv implements importexport_iface_import_plugin {
|
|||||||
$success = $this->action( 'insert', $record, $import_csv->get_current_position() );
|
$success = $this->action( 'insert', $record, $import_csv->get_current_position() );
|
||||||
}
|
}
|
||||||
if($success) $count++;
|
if($success) $count++;
|
||||||
|
if($this->warnings[$import_csv->get_current_position()]) {
|
||||||
|
$this->warnings[$import_csv->get_current_position()] .= "\nRecord:\n" .array2string($record);
|
||||||
|
}
|
||||||
|
if($this->errors[$import_csv->get_current_position()]) {
|
||||||
|
$this->errors[$import_csv->get_current_position()] .= "\nRecord:\n" .array2string($record);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $count;
|
return $count;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user