From 4ab9c5ed1faab320c88995d041f3a92082c73ac8 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 23 Jan 2012 15:15:29 +0000 Subject: [PATCH] - Fix handling of multiple delegated users - Give error if foreign custom field can't be found --- .../inc/class.infolog_import_infologs_csv.inc.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/infolog/inc/class.infolog_import_infologs_csv.inc.php b/infolog/inc/class.infolog_import_infologs_csv.inc.php index 1fd722cb10..3568d253ef 100644 --- a/infolog/inc/class.infolog_import_infologs_csv.inc.php +++ b/infolog/inc/class.infolog_import_infologs_csv.inc.php @@ -198,6 +198,10 @@ class infolog_import_infologs_csv implements importexport_iface_import_plugin { $record['info_owner'] = $_definition->plugin_options['record_owner']; } if (!isset($record['info_owner'])) $record['info_owner'] = $GLOBALS['egw_info']['user']['account_id']; + + // Responsible has to be an array + $record['info_responsible'] = $record['info_responsible'] ? explode(',',$record['info_responsible']) : 0; + // Special values if ($record['addressbook'] && !is_numeric($record['addressbook'])) { @@ -511,18 +515,26 @@ class infolog_import_infologs_csv implements importexport_iface_import_plugin { if($app && $custom_field && $value) { $cfs = config::get_customfields($app); + // Error if no custom fields, probably something wrong in definition if(!$cfs[$custom_field]) { // Check for users specifing label instead of name foreach($cfs as $name => $settings) { - if($settings['label'] == $custom_field) + if(strtolower($settings['label']) == strtolower($custom_field)) { $custom_field = $name; break; } } } + + // Couldn't find field, give an error - something's wrong + if(!$cfs[$custom_field] && !$cfs[substr($custom_field,1)]) { + $this->errors[$record_num] .= lang('No custom field "%1" for %2.', + $custom_field, lang($app)); + return false; + } if($custom_field[0] != '#') $custom_field = '#' . $custom_field; // Search