mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 10:53:39 +01:00
improve parsing if only a fullName is given to support the following:
- Becker, Ralf --> surname: Becker, personal: Ralf - Ralf Becker --> surname: Becker, personal: Ralf - Becker --> surname: Becker
This commit is contained in:
parent
10c35381d5
commit
712786c927
@ -124,9 +124,23 @@ class JsContact
|
||||
case 'fullName':
|
||||
$contact['n_fn'] = self::parseString($value);
|
||||
// if no separate name-components given, simply split first word off as n_given and rest as n_family
|
||||
if (!isset($data['name']))
|
||||
if (!isset($data['name']) && !empty($contact['n_fn']))
|
||||
{
|
||||
list($contact['n_given'], $contact['n_family']) = explode(' ', $contact['n_fn'], 2);
|
||||
if (preg_match('/^([^ ,]+)(,?) (.*)$/', $contact['n_fn'], $matches))
|
||||
{
|
||||
if (!empty($matches[2]))
|
||||
{
|
||||
list(, $contact['n_family'], , $contact['n_given']) = $matches;
|
||||
}
|
||||
else
|
||||
{
|
||||
list(, $contact['n_given'], , $contact['n_family']) = $matches;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$contact['n_family'] = $contact['n_fn'];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user