Allow to use account_id as unique key in csv import and added it to cvs

export.
This commit is contained in:
Ralf Becker 2009-11-27 13:35:43 +00:00
parent 57ce5a4c4c
commit e642601607
2 changed files with 8 additions and 1 deletions

View File

@ -158,6 +158,7 @@ switch($_POST['action'])
$addr_names['owner'] .= ': id or account name of user or group, defaults to importing user';
$addr_names['bday'] .= ': YYYY-mm-dd';
$addr_names['uid'] = lang('Unique ID (UID)');
$addr_names['account_id'] = lang('Account ID');
unset($addr_names['jpegphoto']); // cant cvs import that
$cfs=array();
foreach($bocontacts->customfields as $name => $data)
@ -195,6 +196,7 @@ switch($_POST['action'])
$GLOBALS['egw']->template->set_var('unique_id',html::select('unique_id',$unique_id,array(
'id' => $addr_names['id'],
'uid' => $addr_names['uid'],
'account_id' => $addr_names['account_id'],
)+$cfs)."\n".html::select('unique_id2',$unique_id2,array(
'*none*' => lang('No fallback'),
'id' => $addr_names['id'],
@ -423,6 +425,10 @@ switch($_POST['action'])
{
$existing = $bocontacts->read($values[$unique_id]);
}
elseif ($unique_id == 'account_id')
{
$existing = $bocontacts->read('account:'.$values[$unique_id]);
}
else
{
list($existing) = $bocontacts->search(array($unique_id => $values[$unique_id]),false);
@ -448,7 +454,7 @@ switch($_POST['action'])
$values = array_merge($existing,$values);
}
// convert user-names to user-id's
foreach(array('owner','modifier','creator') as $user)
foreach(array('owner','modifier','creator','account_id') as $user)
{
if (isset($values[$user]) && !is_numeric($values[$user]))
{

View File

@ -205,6 +205,7 @@ class addressbook_bo extends addressbook_so
'modified' => lang('last modified'),
'modifier' => lang('last modified by'),
'jpegphoto' => lang('photo'),
'account_id' => lang('Account ID'),
);
$this->business_contact_fields = array(
'org_name' => lang('Company'),