From 786b64a4da0b20c71186385c380f59e4f4d477a1 Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 20 Jul 2016 11:29:32 -0600 Subject: [PATCH] Calendar CSV import fixes - Account for non-blocking flag when checking for conflicts - Fix import of recurrence with interval --- calendar/inc/class.calendar_egw_record.inc.php | 4 ++++ calendar/inc/class.calendar_import_csv.inc.php | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/calendar/inc/class.calendar_egw_record.inc.php b/calendar/inc/class.calendar_egw_record.inc.php index 1a6238e350..7bb20af6eb 100644 --- a/calendar/inc/class.calendar_egw_record.inc.php +++ b/calendar/inc/class.calendar_egw_record.inc.php @@ -66,6 +66,10 @@ class calendar_egw_record implements importexport_iface_egw_record $this->record[$_attribute_name] = $data; } + public function __unset($_attribute_name) { + unset($this->record[$_attribute_name]); + } + /** * converts this object to array. * @abstract We need such a function cause PHP5 diff --git a/calendar/inc/class.calendar_import_csv.inc.php b/calendar/inc/class.calendar_import_csv.inc.php index 85063052ae..b1e800a450 100644 --- a/calendar/inc/class.calendar_import_csv.inc.php +++ b/calendar/inc/class.calendar_import_csv.inc.php @@ -183,7 +183,7 @@ class calendar_import_csv extends importexport_basic_import_csv { { list($record->recur_type, $record->recur_interval) = explode('/',$record->recurrence,2); $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); } $record->tzid = calendar_timezones::id2tz($record->tz_id); @@ -297,7 +297,7 @@ class calendar_import_csv extends importexport_basic_import_csv { //print_r($_data); // User is interested in conflict checks, do so for dry run // 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); if($conflicts) @@ -318,7 +318,8 @@ class calendar_import_csv extends importexport_basic_import_csv { ); 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)) {