From 0d9f55b59e81db587ac515d6ac8ffbda54343d30 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 21 Mar 2011 23:06:32 +0000 Subject: [PATCH] Fix for import / update search for existing record. If new record key (ex ID) was not set, search matched all --- timesheet/inc/class.timesheet_import_csv.inc.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/timesheet/inc/class.timesheet_import_csv.inc.php b/timesheet/inc/class.timesheet_import_csv.inc.php index 7c6989da6a..30fb770155 100644 --- a/timesheet/inc/class.timesheet_import_csv.inc.php +++ b/timesheet/inc/class.timesheet_import_csv.inc.php @@ -219,12 +219,15 @@ class timesheet_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->search(array($condition['string'] => $record[$condition['string']])); + if($record[$condition['string']]) { + $results = $this->bo->search(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 $result ) {