From 438c308ad02b0fd5242f85b3a04d565ce75883f1 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 13 Aug 2014 17:32:04 +0000 Subject: [PATCH] Fix bugs in import - typo prevented conditions from being evaluated - Groups in the form Group were not parsed --- .../inc/class.importexport_basic_import_csv.inc.php | 4 ++-- .../inc/class.importexport_helper_functions.inc.php | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/importexport/inc/class.importexport_basic_import_csv.inc.php b/importexport/inc/class.importexport_basic_import_csv.inc.php index 28f7943556..5fae9d9aa5 100644 --- a/importexport/inc/class.importexport_basic_import_csv.inc.php +++ b/importexport/inc/class.importexport_basic_import_csv.inc.php @@ -224,8 +224,8 @@ abstract class importexport_basic_import_csv implements importexport_iface_impor */ protected function import_record(importexport_iface_egw_record &$record, &$import_csv) { - if ( $this->_definition->plugin_options['conditions'] ) { - foreach ( $this->_definition->plugin_options['conditions'] as $condition ) { + if ( $this->definition->plugin_options['conditions'] ) { + foreach ( $this->definition->plugin_options['conditions'] as $condition ) { $result = false; switch ( $condition['type'] ) { // exists diff --git a/importexport/inc/class.importexport_helper_functions.inc.php b/importexport/inc/class.importexport_helper_functions.inc.php index 9ec38ce737..3ed3a1eebe 100755 --- a/importexport/inc/class.importexport_helper_functions.inc.php +++ b/importexport/inc/class.importexport_helper_functions.inc.php @@ -155,12 +155,19 @@ class importexport_helper_functions { $skip = true; // Skip the next one, it's the first name continue ; } + + // Deal with groups listed as Group, remove the Group + if(substr(trim($account_lid),-strlen(lang('Group'))) == lang('Group')) + { + $account_lid = trim(substr(trim($account_lid), 0, -strlen(lang('Group')))); + } + if ( $account_id = $GLOBALS['egw']->accounts->name2id( $account_lid )) { $account_ids[] = $account_id; unset($account_lids[$key]); continue; } - if ( $account_id = $GLOBALS['egw']->accounts->name2id( $account_lid, 'account_fullname' )) { + if ( $account_id = $GLOBALS['egw']->accounts->name2id( trim($account_lid), 'account_fullname' )) { $account_ids[] = $account_id; unset($account_lids[$key]); continue; @@ -174,7 +181,7 @@ class importexport_helper_functions { continue; } // Group, - remove the Group part - if($account_lid == 'Group') + if($account_lid == lang('Group')) { unset($account_lids[$key]); continue; @@ -494,7 +501,7 @@ class importexport_helper_functions { public static function load_defaults($appname) { // Check for new definitions to import from $appname/setup/*.xml $appdir = EGW_INCLUDE_ROOT. "/$appname/setup"; - if(!is_dir($appdir)) continue; + if(!is_dir($appdir)) return; $d = dir($appdir); // step through each file in app's setup