From ddf0354784645e48e74aa11076e2bd4e2597daf9 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Thu, 26 Jan 2012 15:38:27 +0000 Subject: [PATCH] Add warnings from conversion, check foreign key link during dry-run --- .../class.infolog_import_infologs_csv.inc.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/infolog/inc/class.infolog_import_infologs_csv.inc.php b/infolog/inc/class.infolog_import_infologs_csv.inc.php index 3568d253ef..149ba31963 100644 --- a/infolog/inc/class.infolog_import_infologs_csv.inc.php +++ b/infolog/inc/class.infolog_import_infologs_csv.inc.php @@ -172,7 +172,8 @@ class infolog_import_infologs_csv implements importexport_iface_import_plugin { $lookups['info_status'] = $this->boinfolog->status[$record['info_type']]; } - importexport_import_csv::convert($record, infolog_egw_record::$types, 'infolog', $lookups, $_definition->plugin_options['convert']); + $result = importexport_import_csv::convert($record, infolog_egw_record::$types, 'infolog', $lookups, $_definition->plugin_options['convert']); + if($result) $this->warnings[$import_csv->get_current_position()] = $result; // Set default status for type, if not specified if(!$record['info_status'] && $record['info_type']) @@ -298,6 +299,14 @@ class infolog_import_infologs_csv implements importexport_iface_import_plugin { case 'insert' : if ( $this->dry_run ) { //print_r($_data); + + // Check for link during dry run + if($_data['link_custom']) + { + list($app, $app_id) = explode(':', $_data['link_custom'],2); + $app_id = $this->link_by_cf($record_num, $app, $field, $app_id); + } + $this->results[$_action]++; break; } else { @@ -546,8 +555,10 @@ class infolog_import_infologs_csv implements importexport_iface_import_plugin { // Only one allowed if(count($result) != 1) { - $this->warnings[$record_num] .= lang('Unable to link to %3 by custom field "%1". %2 matches.', - $custom_field, count($result), lang($app)); + $this->warnings[$record_num] .= ($this->warnings[$record_num] ? "\n" : '') . + lang('Unable to link to %3 by custom field "%1". %2 matches.', + $custom_field, count($result), lang($app) + ); return false; } $app_id = key($result);