forked from extern/egroupware
fix parsing with no street data and of custom fields
This commit is contained in:
parent
7f7fc2739c
commit
b90dcede90
@ -173,7 +173,7 @@ class JsContact
|
||||
break;
|
||||
|
||||
case 'egroupware.org:customfields':
|
||||
$contact += self::parseCustomfields($value);
|
||||
$contact += self::parseCustomfields($value, $strict);
|
||||
break;
|
||||
|
||||
case 'egroupware.org:assistant':
|
||||
@ -433,8 +433,12 @@ class JsContact
|
||||
foreach($definitions as $name => $definition)
|
||||
{
|
||||
$data = $cfs[$name];
|
||||
if (isset($data[$name]))
|
||||
if (isset($data))
|
||||
{
|
||||
if (is_scalar($data))
|
||||
{
|
||||
$data = ['value' => $data];
|
||||
}
|
||||
if (!is_array($data) || !array_key_exists('value', $data))
|
||||
{
|
||||
throw new \InvalidArgumentException("Invalid customfield object $name: ".json_encode($data, self::JSON_OPTIONS_ERROR));
|
||||
@ -614,7 +618,10 @@ class JsContact
|
||||
$prefix = $type === 'work' ? 'adr_one_' : 'adr_two_';
|
||||
|
||||
$contact = [$prefix.'street' => null, $prefix.'street2' => null];
|
||||
if (!empty($address['street']))
|
||||
{
|
||||
list($contact[$prefix.'street'], $contact[$prefix.'street2']) = self::parseStreetComponents($address['street'], $stict);
|
||||
}
|
||||
foreach(self::$jsAddress2attr+self::$jsAddress2workAttr as $js => $attr)
|
||||
{
|
||||
if (isset($address[$js]) && !is_string($address[$js]))
|
||||
|
Loading…
Reference in New Issue
Block a user