diff --git a/addressbook/csv_import.php b/addressbook/csv_import.php index 1f889df24c..02ddfaa97c 100644 --- a/addressbook/csv_import.php +++ b/addressbook/csv_import.php @@ -63,14 +63,14 @@ // find in Addressbook, at least n_family AND (n_given OR org_name) have to match function addr_id($n_family,$n_given,$org_name) { - $addrs = $GLOBALS['egw']->contacts->read(0,0,array('id'),'',"n_family=$n_family,n_given=$n_given,org_name=$org_name"); + $addrs = $GLOBALS['egw']->contacts->search(array('n_family'=>$n_family,'n_given'=>$n_given,'org_name'=>$org_name)); if(!count($addrs)) { - $addrs = $GLOBALS['egw']->contacts->read(0,0,array('id'),'',"n_family=$n_family,n_given=$n_given"); + $addrs = $GLOBALS['egw']->contacts->search(array('n_family'=>$n_family,'n_given'=>$n_given)); } if(!count($addrs)) { - $addrs = $GLOBALS['egw']->contacts->read(0,0,array('id'),'',"n_family=$n_family,org_name=$org_name"); + $addrs = $GLOBALS['egw']->contacts->search(array('n_family'=>$n_family,'org_name'=>$org_name)); } if(count($addrs)) @@ -128,7 +128,7 @@ $GLOBALS['egw']->html->select('charset','', $GLOBALS['egw']->translation->get_installed_charsets()+ array('utf-8' => 'utf-8 (Unicode)'),True)); - $GLOBALS['egw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ','); + $GLOBALS['egw']->template->set_var('fieldsep',$_POST['fieldsep'] ? $_POST['fieldsep'] : ';'); $GLOBALS['egw']->template->set_var('submit',lang('Import')); $GLOBALS['egw']->template->set_var('csvfile',$csvfile); $GLOBALS['egw']->template->set_var('enctype','ENCTYPE="multipart/form-data"'); @@ -152,28 +152,16 @@ $GLOBALS['egw']->template->set_var('lang_debug',lang('Test Import (show importable records only in browser)')); $GLOBALS['egw']->template->parse('fheaderhandle','fheader'); - $addr_names = $GLOBALS['egw']->contacts->stock_contact_fields + array( - 'cat_id' => 'Categories: id\'s or names, comma separated list', - 'access' => 'Access: public, private', - 'owner' => 'Owner: user-id/-name, defaults to user', - 'address2' => 'address line 2', - 'address3' => 'address line 3', - 'ophone' => 'Other Phone' - ); - $config = CreateObject('phpgwapi.config','addressbook'); - $config->read_repository(); - while(list($name,$descr) = @each($config->config_data['custom_fields'])) - { - $addr_names[$name] = $descr; - } - unset($config); + $addr_names = $GLOBALS['egw']->contacts->contact_fields; + $addr_names['cat_id'] .= ': id or name, comma separated list'; + $addr_names['private'] .= ': 0 = public, 1 = private'; + $addr_names['owner'] .= ': id or account name of user or group, defaults to importing user'; + $addr_names['bday'] .= ': YYYY-mm-dd'; + unset($addr_names['jpegphoto']); // cant cvs import that - foreach($addr_names as $field => $name) + foreach($GLOBALS['egw']->contacts->customfields as $name => $data) { - if($dn = display_name($field)) - { - $addr_names[$field] = $dn; - } + $addr_names['#'.$name] = $data['label']; } $addr_name_options = "