From 657ce8683fc11d811650bf396680ca86b4dc2a50 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 30 Aug 2010 10:21:23 +0000 Subject: [PATCH] moved default fields for copying to addressbook_ui::$copy_fields AND using that default also if nothing is configured --- addressbook/inc/class.addressbook_ui.inc.php | 27 ++++++++++++++++++-- addressbook/inc/hook_config.inc.php | 17 ++---------- addressbook/lang/egw_de.lang | 1 + addressbook/lang/egw_en.lang | 1 + 4 files changed, 29 insertions(+), 17 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index d085ef73fc..5b69b06d65 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -44,6 +44,26 @@ class addressbook_ui extends addressbook_bo */ 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 * @@ -80,6 +100,10 @@ class addressbook_ui extends addressbook_bo { $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']), $content['id'])); // create a new contact with the content of the old - $copy_fields = unserialize($this->config['copy_fields']); 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]); } diff --git a/addressbook/inc/hook_config.inc.php b/addressbook/inc/hook_config.inc.php index 0dd9e3350d..231bd78542 100644 --- a/addressbook/inc/hook_config.inc.php +++ b/addressbook/inc/hook_config.inc.php @@ -140,22 +140,9 @@ function copy_fields($config) $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]', - $config['copy_fields'] ? $config['copy_fields'] : $default, + $config['copy_fields'] ? $config['copy_fields'] : addressbook_ui::$copy_fields, $fields,true,'',4 ); } diff --git a/addressbook/lang/egw_de.lang b/addressbook/lang/egw_de.lang index 7204a25cbe..0fc321008f 100644 --- a/addressbook/lang/egw_de.lang +++ b/addressbook/lang/egw_de.lang @@ -204,6 +204,7 @@ field %1 has been updated ! addressbook de Feld %1 wurde aktualisiert ! field name addressbook de Feldname 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 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 fieldseparator addressbook de Feldtrenner fieldseperator addressbook de Feldtrenner diff --git a/addressbook/lang/egw_en.lang b/addressbook/lang/egw_en.lang index 3bcc0f4677..47f9642d1e 100644 --- a/addressbook/lang/egw_en.lang +++ b/addressbook/lang/egw_en.lang @@ -204,6 +204,7 @@ field %1 has been updated ! addressbook en Field %1 has been updated ! field name addressbook en Field Name 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 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 fieldseparator addressbook en Fieldseparator fieldseperator addressbook en Fieldseperator