Fix bugs in import

- typo prevented conditions from being evaluated
- Groups in the form <name> Group were not parsed
This commit is contained in:
Nathan Gray 2014-08-13 17:32:04 +00:00
parent bcedbb950e
commit 438c308ad0
2 changed files with 12 additions and 5 deletions

View File

@ -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

View File

@ -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 <name> 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, <name> - 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