fix: add contacts from mail

This commit is contained in:
Cornelius Weiß 2005-12-01 17:21:38 +00:00
parent ac8eb8bf72
commit 4ca328c05d
3 changed files with 29 additions and 14 deletions

View File

@ -327,4 +327,17 @@ class socontacts
}
return $need_full_no_count ? count($result) : $result;
}
/**
* gets all contact fields from database
*/
function get_contact_conlumns()
{
$fields = $this->somain->db_data_cols;
foreach ((array)$this->customfields as $cfield => $coptions)
{
$fields['#'.$cfield] = '#'.$cfield;
}
return $fields;
}
}

View File

@ -678,20 +678,14 @@
$fields['n_given'] = $names[0];
$fields['n_family'] = $names[1];
}
$fields['n_given'] = $fields['n_given'] ? $fields['n_given'] : ' ';
$fields['n_family'] = $fields['n_family'] ? $fields['n_family'] : ' ';
$fields['fn'] = $fields['n_given'] . ' ' . $fields['n_family'];
$fields['email'] = $add_email;
$fields['access'] = 'private';
$fields['tid'] = 'n';
$referer = urlencode($referer);
$fields['owner'] = $GLOBALS['egw_info']['user']['account_id'];
// _debug_array($fields);exit;
$this->bo->add_entry($fields);
$ab_id = $this->bo->get_lastid();
$GLOBALS['egw']->redirect_link('/index.php','menuaction=addressbook.uiaddressbook.view&ab_id=' . $ab_id . '&referer=' . $referer);
$GLOBALS['egw']->redirect_link('/index.php', array(
'menuaction' => 'addressbook.uicontacts.edit',
'presets[n_given]' => $fields['n_given'] ? $fields['n_given'] : ' ',
'presets[n_middle]' => $fields['n_middle'] ? $fields['n_middle'] : '',
'presets[n_family]' => $fields['n_family'] ? $fields['n_family'] : ' ',
'presets[email]' => $add_email,
));
}
function copy()

View File

@ -110,12 +110,20 @@ class uicontacts extends bocontacts
{
$content = array();
$contact_id = $_GET['contact_id'] ? $_GET['contact_id'] : 0;
$view = $_GET['view'];// == 1 ? true : false;
$view = $_GET['view'];
if ($contact_id)
{
$content = $this->read($contact_id);
}
else // look if we have presets for a new contact
{
foreach($this->get_contact_conlumns() as $field => $data)
{
if ($_GET['presets'][$field]) $content[$field] = $_GET['presets'][$field];
}
}
if($content && $_GET['makecp']) // copy the contact
{
$content['link_to']['to_id'] = 0;