diff --git a/infolog/inc/class.infolog_bo.inc.php b/infolog/inc/class.infolog_bo.inc.php index d6d40c24d1..42b5b3d4b6 100644 --- a/infolog/inc/class.infolog_bo.inc.php +++ b/infolog/inc/class.infolog_bo.inc.php @@ -70,7 +70,13 @@ class infolog_bo * * @var array */ - var $sub_excludefields = array('info_des','info_id', 'info_uid', 'info_etag', 'caldav_name', 'info_created', 'info_creator', 'info_datemodified', 'info_modifier'); + var $sub_excludefields = array('info_id', 'info_uid', 'info_etag', 'caldav_name', 'info_created', 'info_creator', 'info_datemodified', 'info_modifier'); + /** + * Additional fields to $sub_excludefields to exclude, if no config stored + * + * @var array + */ + var $default_sub_excludefields = array('info_des'); /** * implicit ACL rights of the responsible user: read or edit * @@ -244,9 +250,12 @@ class infolog_bo } if (is_array($config_data['sub_excludefields']) && $config_data['sub_excludefields']) { - if (($k = array_search('info_des',$this->sub_excludefields))) unset($this->sub_excludefields[$k]); $this->sub_excludefields = array_merge($this->sub_excludefields,$config_data['sub_excludefields']); } + else + { + $this->sub_excludefields = array_merge($this->sub_excludefields,$this->default_sub_excludefields); + } if ($config_data['implicit_rights'] == 'edit') { $this->implicit_rights = 'edit'; diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php index daa319a07d..78e3405e85 100644 --- a/infolog/inc/class.infolog_ui.inc.php +++ b/infolog/inc/class.infolog_ui.inc.php @@ -2172,15 +2172,17 @@ class infolog_ui foreach(array('copy_excludefields','sub_excludefields') as $name) { $efs = array_keys($name == 'sub_excludefields' ? $sub_excludefields : $excludefields); - $this->bo->$name = array_diff($this->bo->$name, $efs); // restore default from bo + $this->bo->$name = array_unique(array_diff($this->bo->$name, $efs, // restore default from bo + $name == 'sub_excludefields' ? $this->bo->default_sub_excludefields : array())); + if ($_POST[$name]) { - if ($name == 'sub_excludefields') // remove default info_des, to be able to unselect it! - { - $this->bo->sub_excludefields = array_diff($this->bo->sub_excludefields,array('info_des')); - } $this->bo->$name = array_merge($this->bo->$name, array_intersect((array)$_POST[$name], $efs)); } + elseif ($name == 'sub_excludefields' && !in_array('explicit-set',$this->bo->sub_excludefields)) + { + $this->bo->sub_excludefields[] = 'explicit-set'; // otherwise we can NOT unset default info_des + } } config::save_value('copy_excludefields',$this->bo->copy_excludefields,'infolog'); config::save_value('sub_excludefields',$this->bo->sub_excludefields,'infolog');