moved default fields for copying to addressbook_ui::$copy_fields AND using that default also if nothing is configured

This commit is contained in:
Ralf Becker 2010-08-30 10:21:23 +00:00
parent d6822d9564
commit 657ce8683f
4 changed files with 29 additions and 17 deletions

View File

@ -44,6 +44,26 @@ class addressbook_ui extends addressbook_bo
*/ */
protected $config; protected $config;
/**
* Fields to copy, default if nothing specified in config
*
* @var array
*/
static public $copy_fields = array(
'org_name',
'org_unit',
'adr_one_street',
'adr_one_street2',
'adr_one_locality',
'adr_one_region',
'adr_one_postalcode',
'adr_one_countryname',
'email',
'url',
'tel_work',
'cat_id'
);
/** /**
* Constructor * Constructor
* *
@ -80,6 +100,10 @@ class addressbook_ui extends addressbook_bo
{ {
$this->config['contact_export_limit'] = $this->config['export_limit']; $this->config['contact_export_limit'] = $this->config['export_limit'];
} }
if ($this->config['copy_fields'] && ($fields = unserialize($this->config['copy_fields'])))
{
self::$copy_fields = $fields;
}
} }
/** /**
@ -1379,10 +1403,9 @@ class addressbook_ui extends addressbook_bo
$GLOBALS['egw_info']['user']['account_firstname'],$GLOBALS['egw_info']['user']['account_lastname']), $GLOBALS['egw_info']['user']['account_firstname'],$GLOBALS['egw_info']['user']['account_lastname']),
$content['id'])); $content['id']));
// create a new contact with the content of the old // create a new contact with the content of the old
$copy_fields = unserialize($this->config['copy_fields']);
foreach($content as $key => $value) foreach($content as $key => $value)
{ {
if(!in_array($key, $copy_fields) || in_array($key, array('etag'))) if(!in_array($key, self::$copy_fields) || in_array($key, array('etag')))
{ {
unset($content[$key]); unset($content[$key]);
} }

View File

@ -140,22 +140,9 @@ function copy_fields($config)
$fields['#'.$name] = $data['label']; $fields['#'.$name] = $data['label'];
} }
} }
$default = array(
'org_name',
'org_unit',
'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]', return html::checkbox_multiselect('newsettings[copy_fields]',
$config['copy_fields'] ? $config['copy_fields'] : $default, $config['copy_fields'] ? $config['copy_fields'] : addressbook_ui::$copy_fields,
$fields,true,'',4 $fields,true,'',4
); );
} }

View File

@ -204,6 +204,7 @@ field %1 has been updated ! addressbook de Feld %1 wurde aktualisiert !
field name addressbook de Feldname field name addressbook de Feldname
fields for the csv export addressbook de Felder für den CSV Export fields for the csv export addressbook de Felder für den CSV Export
fields the user is allowed to edit himself admin de Felder, die der Benutzer selbst bearbeiten darf fields the user is allowed to edit himself admin de Felder, die der Benutzer selbst bearbeiten darf
fields to copy when copying an address? admin de Welche Felder sollen beim Kopieren berücksichtigt werden?
fields to show in address list addressbook de Felder, die in der Adressliste angezeigt werden sollen fields to show in address list addressbook de Felder, die in der Adressliste angezeigt werden sollen
fieldseparator addressbook de Feldtrenner fieldseparator addressbook de Feldtrenner
fieldseperator addressbook de Feldtrenner fieldseperator addressbook de Feldtrenner

View File

@ -204,6 +204,7 @@ field %1 has been updated ! addressbook en Field %1 has been updated !
field name addressbook en Field Name field name addressbook en Field Name
fields for the csv export addressbook en Fields for the CSV export fields for the csv export addressbook en Fields for the CSV export
fields the user is allowed to edit himself admin en Fields the user is allowed to edit himself fields the user is allowed to edit himself admin en Fields the user is allowed to edit himself
fields to copy when copying an address? admin en Fields to copy when copying an address?
fields to show in address list addressbook en Fields to show in address list fields to show in address list addressbook en Fields to show in address list
fieldseparator addressbook en Fieldseparator fieldseparator addressbook en Fieldseparator
fieldseperator addressbook en Fieldseperator fieldseperator addressbook en Fieldseperator