From 31fd9eddc69288d58635a359206695d2be673da6 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 21 Mar 2011 23:05:26 +0000 Subject: [PATCH] Fix for import / update search for existing record. If new record key (ex ID) was not set, search matched all --- resources/inc/class.resources_import_csv.inc.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/resources/inc/class.resources_import_csv.inc.php b/resources/inc/class.resources_import_csv.inc.php index 7723820b69..a85d4752db 100644 --- a/resources/inc/class.resources_import_csv.inc.php +++ b/resources/inc/class.resources_import_csv.inc.php @@ -144,15 +144,18 @@ class resources_import_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->bo->so->search( - array( $condition['string'] => $record[$condition['string']]), - False - ); + if($record[$condition['string']]) { + $results = $this->bo->so->search( + array( $condition['string'] => $record[$condition['string']]), + False + ); + } - if ( is_array( $results ) && count( array_keys( $results ) >= 1 ) ) { + if ( is_array( $results ) && count( array_keys( $results )) >= 1) { // apply action to all contacts matching this exists condition $action = $condition['true']; foreach ( (array)$results as $resource ) {