mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
* Addressbook/Active Directory: got prefix, middle name and suffix working for AD account, file as got disabled (as well as not supported history tab)
This commit is contained in:
parent
92e0ee86a5
commit
3060d95322
@ -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');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user