From 766391754c115e4f27446750bc044182edb01b86 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 21 Mar 2011 23:02:22 +0000 Subject: [PATCH] Fix for import / update search for existing record. If new record key (ex ID) was not set, search matched all --- .../class.infolog_import_infologs_csv.inc.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/infolog/inc/class.infolog_import_infologs_csv.inc.php b/infolog/inc/class.infolog_import_infologs_csv.inc.php index 5dbb03d8b1..8e2b4a933e 100644 --- a/infolog/inc/class.infolog_import_infologs_csv.inc.php +++ b/infolog/inc/class.infolog_import_infologs_csv.inc.php @@ -184,18 +184,21 @@ class infolog_import_infologs_csv implements importexport_iface_import_plugin { if ( $_definition->plugin_options['conditions'] ) { foreach ( $_definition->plugin_options['conditions'] as $condition ) { + $results = array(); switch ( $condition['type'] ) { // exists case 'exists' : - $results = $this->boinfolog->search( - //array( $condition['string'] => $record[$condition['string']],), - '', - $_definition->plugin_options['update_cats'] == 'add' ? false : true, - '', '', '', false, 'AND', false, - array( $condition['string'] => $record[$condition['string']],) - ); + if($record[$condition['string']]) { + $results = $this->boinfolog->search( + //array( $condition['string'] => $record[$condition['string']],), + '', + $_definition->plugin_options['update_cats'] == 'add' ? false : true, + '', '', '', false, 'AND', false, + array( $condition['string'] => $record[$condition['string']],) + ); + } - if ( is_array( $results ) && count( array_keys( $results ) >= 1 ) ) { + if ( is_array( $results ) && count( array_keys( $results )) >= 1) { // apply action to all records matching this exists condition $action = $condition['true']; foreach ( (array)$results as $contact ) {