forked from extern/egroupware
* Import/Export - Better matching on accounts to handle prefixes & suffixes
This commit is contained in:
parent
8e0243294c
commit
1fb15206f8
@ -157,12 +157,20 @@ class importexport_helper_functions {
|
|||||||
|
|
||||||
// Handle users listed as Lastname, Firstname instead of login ID
|
// Handle users listed as Lastname, Firstname instead of login ID
|
||||||
// Do this first, in case their first name matches a username
|
// Do this first, in case their first name matches a username
|
||||||
if ( $account_lids[$key+1][0] == ' ' && $account_id = $GLOBALS['egw']->accounts->name2id( trim($account_lids[$key+1]).' ' .$account_lid, 'account_fullname')) {
|
if ( $account_lids[$key+1][0] == ' ')
|
||||||
$account_ids[] = $account_id;
|
{
|
||||||
|
$query = array('type' => 'accounts', 'query_type' => 'exact');
|
||||||
|
$given = $GLOBALS['egw']->accounts->search($query + array('query' => trim($account_lids[$key+1])));
|
||||||
|
$family = $GLOBALS['egw']->accounts->search($query + array('query' => trim($account_lid)));
|
||||||
|
$ids = array_intersect_key($family, $given);
|
||||||
|
if($ids)
|
||||||
|
{
|
||||||
|
$account_ids[] = key($ids);
|
||||||
unset($account_lids[$key]);
|
unset($account_lids[$key]);
|
||||||
$skip = true; // Skip the next one, it's the first name
|
$skip = true; // Skip the next one, it's the first name
|
||||||
continue ;
|
continue ;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Deal with groups listed as <name> Group, remove the Group
|
// Deal with groups listed as <name> Group, remove the Group
|
||||||
if(substr(trim($account_lid),-strlen(lang('Group'))) == lang('Group'))
|
if(substr(trim($account_lid),-strlen(lang('Group'))) == lang('Group'))
|
||||||
|
Loading…
Reference in New Issue
Block a user