From e7c07d48f6c2f99be5085765ba12fd5f607a27d8 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 30 Sep 2014 15:08:46 +0000 Subject: [PATCH] Add warning for unknown contact type and change it to 'n' (contact). --- .../inc/class.addressbook_import_contacts_csv.inc.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addressbook/inc/class.addressbook_import_contacts_csv.inc.php b/addressbook/inc/class.addressbook_import_contacts_csv.inc.php index 6e747c0b64..107a4f6e38 100644 --- a/addressbook/inc/class.addressbook_import_contacts_csv.inc.php +++ b/addressbook/inc/class.addressbook_import_contacts_csv.inc.php @@ -119,6 +119,13 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv { $record->owner = $GLOBALS['egw_info']['user']['account_id']; } + // Do not import into non-existing type, warn and change + if(!$record->tid || !$this->lookups['tid'][$record->tid]) + { + $this->warnings[$import_csv->get_current_position()] = lang('Unknown type %1, imported as %2',$record->tid,lang($this->lookups['tid']['n'])); + $record->tid = 'n'; + } + // Also handle categories in their own field $record_array = $record->get_record_array(); $more_categories = array();