mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-24 23:58:54 +01:00
More robust handling of importing date-times:
1. Check against user's preference 2. Try any other possibilities, by egw_time 3. Error, unless app plugin takes special measures
This commit is contained in:
parent
34502fc66f
commit
6fa67b2e28
@ -321,14 +321,23 @@ class importexport_import_csv implements importexport_iface_import_record { //,
|
||||
if($format == 1)
|
||||
{
|
||||
$formatted = egw_time::createFromFormat(
|
||||
egw_time::$user_dateformat . ' ' .egw_time::$user_timeformat,
|
||||
'!'.egw_time::$user_dateformat . '*' .egw_time::$user_timeformat,
|
||||
$record[$name]
|
||||
);
|
||||
|
||||
if(!$formatted && $errors = egw_time::getLastErrors())
|
||||
{
|
||||
foreach($errors['errors'] as $msg)
|
||||
// Try again, more options
|
||||
try {
|
||||
$formatted = new egw_time($record[$name]);
|
||||
} catch (Exception $e) {
|
||||
$warnings[] = $name.': ' . $e->getMessage();
|
||||
continue;
|
||||
}
|
||||
$errors = egw_time::getLastErrors();
|
||||
foreach($errors['errors'] as $char => $msg)
|
||||
{
|
||||
$warnings[] = $name . ': ' . $msg;
|
||||
$warnings[] = "$name: [$char] $msg";
|
||||
}
|
||||
}
|
||||
if($errors = egw_time::getLastErrors() && $errors['error_count'] == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user