diff --git a/addressbook/inc/class.addressbook_ads.inc.php b/addressbook/inc/class.addressbook_ads.inc.php index f9ae7ec57c..9713a6d66f 100644 --- a/addressbook/inc/class.addressbook_ads.inc.php +++ b/addressbook/inc/class.addressbook_ads.inc.php @@ -115,6 +115,9 @@ class addressbook_ads extends addressbook_ldap 'n_fn' => 'displayname', // leave CN used in DN untouched 'accountexpires', 'useraccountcontrol', // needed to exclude deactivated or expired accounts )); + unset($this->schema2egw['user']['n_fileas']); + unset($this->schema2egw['inetorgperson']); + foreach($this->schema2egw as $schema => $attributes) { $this->all_attributes = array_merge($this->all_attributes,array_values($attributes)); @@ -195,7 +198,7 @@ class addressbook_ads extends addressbook_ldap // ignore deactivated or expired accounts if (!$this->accounts_ads->user_active($data)) return false; - $this->_inetorgperson2egw($contact, $data); + $this->_inetorgperson2egw($contact, $data, 'displayname'); } /** diff --git a/addressbook/inc/class.addressbook_ldap.inc.php b/addressbook/inc/class.addressbook_ldap.inc.php index fc87a9ba99..c304103007 100644 --- a/addressbook/inc/class.addressbook_ldap.inc.php +++ b/addressbook/inc/class.addressbook_ldap.inc.php @@ -1227,24 +1227,25 @@ class addressbook_ldap * @param array &$contact already copied fields according to the mapping * @param array $data eGW contact data */ - function _inetorgperson2egw(&$contact,$data) + function _inetorgperson2egw(&$contact, $data, $cn='cn') { if(empty($data['givenname'][0])) { - $parts = explode($data['sn'][0], $data['cn'][0]); + $parts = explode($data['sn'][0], $data[$cn][0]); $contact['n_prefix'] = trim($parts[0]); $contact['n_suffix'] = trim($parts[1]); } else { - $parts = preg_split('/'. preg_quote($data['givenname'][0],'/') .'.*'. preg_quote($data['sn'][0],'/') .'/', $data['cn'][0]); + $parts = preg_split('/'. preg_quote($data['givenname'][0],'/') .'.*'. preg_quote($data['sn'][0],'/') .'/', $data[$cn][0]); $contact['n_prefix'] = trim($parts[0]); $contact['n_suffix'] = trim($parts[1]); - if(preg_match('/'. preg_quote($data['givenname'][0],'/') .' (.*) '. preg_quote($data['sn'][0],'/') .'/',$data['cn'][0], $matches)) + if(preg_match('/'. preg_quote($data['givenname'][0],'/') .' (.*) '. preg_quote($data['sn'][0],'/') .'/',$data[$cn][0], $matches)) { $contact['n_middle'] = $matches[1]; } } + //error_log(__METHOD__."(, data=array($cn=>{$data[$cn][0]}, sn=>{$data['sn'][0]}, givenName=>{$data['givenname'][0]}), cn='$cn') returning with contact=array(n_prefix={$contact['n_prefix']}, n_middle={$contact['n_middle']}, n_suffix={$contact['n_suffix']}) ".function_backtrace()); } /** diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 939e8eb3be..b3c0fff72e 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -1868,13 +1868,14 @@ class addressbook_ui extends addressbook_bo { $readonlys[$field] = true; } + if ($readonlys['n_fileas']) $readonlys['fileas_type'] = true; // disable not needed tabs $readonlys['tabs']['cats'] = !($content['cat_tab'] = $this->config['cat_tab']); $readonlys['tabs']['custom'] = !$this->customfields || $this->get_backend($content['id'],$content['owner']) == $this->so_accounts; $readonlys['tabs']['custom_private'] = $readonlys['tabs']['custom'] || !$this->config['private_cf_tab']; $readonlys['tabs']['distribution_list'] = !$content['distrib_lists'];#false; - $readonlys['tabs']['history'] = $this->contact_repository == 'ldap' || !$content['id'] || - $this->account_repository == 'ldap' && $content['account_id']; + $readonlys['tabs']['history'] = $this->contact_repository != 'sql' || !$content['id'] || + $this->account_repository != 'sql' && $content['account_id']; $readonlys['button[delete]'] = !$content['id']; if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0; $readonlys['change_org'] = empty($content['org_name']) || $view; @@ -2157,8 +2158,8 @@ class addressbook_ui extends addressbook_bo $readonlys['tabs']['custom'] = !$this->customfields; $readonlys['tabs']['custom_private'] = !$this->customfields || !$this->config['private_cf_tab']; $readonlys['tabs']['distribution_list'] = !$content['distrib_lists'];#false; - $readonlys['tabs']['history'] = $this->contact_repository == 'ldap' || !$content['id'] || - $this->account_repository == 'ldap' && $content['account_id']; + $readonlys['tabs']['history'] = $this->contact_repository != 'sql' || !$content['id'] || + $this->account_repository != 'sql' && $content['account_id']; if ($this->config['private_cf_tab']) $content['no_private_cfs'] = 0; // last and next calendar date