Author: nathangray
New Revision: 31797
URL: http://www.egroupware.org/viewvc/egroupware?rev=31797&view=rev
Log:
Add site configuration setting for which fields to copy when copying an address. (egw.stylite.de bug #8168)
Modified:
trunk/addressbook/inc/class.addressbook_ui.inc.php
trunk/addressbook/inc/hook_config.inc.php
trunk/addressbook/templates/default/config.tpl
Modified: trunk/addressbook/inc/class.addressbook_ui.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/addressbook/inc/class.addressbook_ui.inc.php?rev=31797&r1=31796&r2=31797&view=diff
— trunk/addressbook/inc/class.addressbook_ui.inc.php (original)
+++ trunk/addressbook/inc/class.addressbook_ui.inc.php Wed Aug 25 18:47:25 2010
@@ -1379,11 +1379,18 @@
$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) -
{ -
unset($content[$key]); -
} -
$content['owner'] = $this->default_private ? $this->user.'p' : $this->default_addressbook;
-
$copy_fields = unserialize($this->config['copy_fields']); -
foreach($content as $key => $value) -
{ -
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['creator'] = $this->user; $content['created'] = $this->now_su; $content['msg'] = lang('Contact copied');
Modified: trunk/addressbook/inc/hook_config.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/addressbook/inc/hook_config.inc.php?rev=31797&r1=31796&r2=31797&view=diff
— trunk/addressbook/inc/hook_config.inc.php (original)
+++ trunk/addressbook/inc/hook_config.inc.php Wed Aug 25 18:47:25 2010
@@ -110,3 +110,52 @@
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 - );
+}
Modified: trunk/addressbook/templates/default/config.tpl
URL: http://www.egroupware.org/viewvc/egroupware/trunk/addressbook/templates/default/config.tpl?rev=31797&r1=31796&r2=31797&view=diff
— trunk/addressbook/templates/default/config.tpl (original)
+++ trunk/addressbook/templates/default/config.tpl Wed Aug 25 18:47:25 2010
@@ -54,6 +54,12 @@
-
{lang_Fields_to_copy_when_copying_an_address?} -
- {hook_copy_fields}
Sell apps to millions through the Intel® Atom™ Developer Program
Be part of this innovative community and reach millions of netbook users
worldwide. Take advantage of special opportunities to increase revenue and
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs