forked from extern/egroupware
Add site configuration setting for which fields to copy when copying an address. (egw.stylite.de bug #8168)
This commit is contained in:
parent
2d616fe2bb
commit
989011fe69
@ -1379,11 +1379,18 @@ class addressbook_ui extends addressbook_bo
|
||||
$GLOBALS['egw_info']['user']['account_firstname'],$GLOBALS['egw_info']['user']['account_lastname']),
|
||||
$content['id']));
|
||||
// create a new contact with the content of the old
|
||||
foreach(array('id','modified','modifier','account_id','uid','cat_id','etag') as $key)
|
||||
$copy_fields = unserialize($this->config['copy_fields']);
|
||||
foreach($content as $key => $value)
|
||||
{
|
||||
unset($content[$key]);
|
||||
if(!in_array($key, $copy_fields) || in_array($key, array('etag')))
|
||||
{
|
||||
unset($content[$key]);
|
||||
}
|
||||
}
|
||||
if(!isset($content['owner']))
|
||||
{
|
||||
$this->default_private ? $this->user.'p' : $this->default_addressbook;
|
||||
}
|
||||
$content['owner'] = $this->default_private ? $this->user.'p' : $this->default_addressbook;
|
||||
$content['creator'] = $this->user;
|
||||
$content['created'] = $this->now_su;
|
||||
$content['msg'] = lang('Contact copied');
|
||||
|
@ -110,3 +110,52 @@ function org_fileds_to_update($config)
|
||||
return html::checkbox_multiselect('newsettings[org_fileds_to_update]',
|
||||
$config['org_fileds_to_update'] ? $config['org_fileds_to_update'] : $bocontacts->org_fields,$fields,true,'',4);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hook to get a multiselect box with all fieleds of fields used for copying for addressbook config
|
||||
*
|
||||
* @param array $config
|
||||
* @return string html
|
||||
*/
|
||||
function copy_fields($config)
|
||||
{
|
||||
$bocontacts = new addressbook_bo();
|
||||
$supported_fields = $bocontacts->get_fields('supported',null,0); // fields supported by the backend (ldap schemas!)
|
||||
// get the list of account fields
|
||||
$fields = array();
|
||||
foreach($bocontacts->contact_fields as $field => $label)
|
||||
{
|
||||
// some fields the user should never be allowed to copy or are coverted by an other attribute (n_fn for all n_*)
|
||||
if (!in_array($field,array('id','tid','created','creator','modified','modifier','n_prefix','n_given','n_middle','n_family','n_suffix', 'account_id', 'uid')))
|
||||
{
|
||||
$fields[$field] = $label;
|
||||
}
|
||||
}
|
||||
$fields['link_to'] = 'Links';
|
||||
|
||||
if ($config['account_repository'] != 'ldap') // no custom-fields in ldap
|
||||
{
|
||||
foreach(config::get_customfields('addressbook') as $name => $data)
|
||||
{
|
||||
$fields['#'.$name] = $data['label'];
|
||||
}
|
||||
}
|
||||
$default = array(
|
||||
'company',
|
||||
'department',
|
||||
'adr_one_street',
|
||||
'adr_one_street2',
|
||||
'adr_one_locality',
|
||||
'adr_one_region',
|
||||
'adr_one_postalcode',
|
||||
'adr_one_countryname',
|
||||
'email',
|
||||
'url',
|
||||
'tel_work',
|
||||
'cat_id'
|
||||
);
|
||||
return html::checkbox_multiselect('newsettings[copy_fields]',
|
||||
$config['copy_fields'] ? $config['copy_fields'] : $default,
|
||||
$fields,true,'',4
|
||||
);
|
||||
}
|
||||
|
@ -54,6 +54,12 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="row_on">
|
||||
<td> {lang_Fields_to_copy_when_copying_an_address?}</td>
|
||||
<td>
|
||||
{hook_copy_fields}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="row_off">
|
||||
<td> {lang_Use_an_extra_tab_for_private_custom_fields?}</td>
|
||||
<td>
|
||||
<select name="newsettings[private_cf_tab]">
|
||||
|
Loading…
Reference in New Issue
Block a user