Calendar CSV import fixes

- Account for non-blocking flag when checking for conflicts
- Fix import of recurrence with interval
This commit is contained in:
nathangray 2016-07-20 11:29:32 -06:00
parent 33dd2b0e63
commit 306722e521
2 changed files with 8 additions and 3 deletions

View File

@ -66,6 +66,10 @@ class calendar_egw_record implements importexport_iface_egw_record
$this->record[$_attribute_name] = $data; $this->record[$_attribute_name] = $data;
} }
public function __unset($_attribute_name) {
unset($this->record[$_attribute_name]);
}
/** /**
* converts this object to array. * converts this object to array.
* @abstract We need such a function cause PHP5 * @abstract We need such a function cause PHP5

View File

@ -183,7 +183,7 @@ class calendar_import_csv extends importexport_basic_import_csv {
{ {
list($record->recur_type, $record->recur_interval) = explode('/',$record->recurrence,2); list($record->recur_type, $record->recur_interval) = explode('/',$record->recurrence,2);
$record->recur_interval = trim($record->recur_interval); $record->recur_interval = trim($record->recur_interval);
$record->recur_type = array_search(strtolower(trim($record->recur_type)), array_map('strtolower',$lookups['recurrence'])); $record->recur_type = array_search(strtolower(trim($record->recur_type)), array_map('strtolower',$this->lookups['recurrence']));
unset($record->recurrence); unset($record->recurrence);
} }
$record->tzid = calendar_timezones::id2tz($record->tz_id); $record->tzid = calendar_timezones::id2tz($record->tz_id);
@ -297,7 +297,7 @@ class calendar_import_csv extends importexport_basic_import_csv {
//print_r($_data); //print_r($_data);
// User is interested in conflict checks, do so for dry run // User is interested in conflict checks, do so for dry run
// Otherwise, conflicts are just ignored and imported anyway // Otherwise, conflicts are just ignored and imported anyway
if($this->definition->plugin_options['skip_conflicts']) if($this->definition->plugin_options['skip_conflicts'] && !$_data['non_blocking'])
{ {
$conflicts = $this->bo->conflicts($_data); $conflicts = $this->bo->conflicts($_data);
if($conflicts) if($conflicts)
@ -318,7 +318,8 @@ class calendar_import_csv extends importexport_basic_import_csv {
); );
if(!$result) if(!$result)
{ {
$this->errors[$record_num] = lang('Unable to save'); $this->errors[$record_num] = lang('Unable to save') . "\n" .
implode("\n",$messages);
} }
else if (is_array($result)) else if (is_array($result))
{ {