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;
|
break;
|
||||||
|
|
||||||
case 'egroupware.org:customfields':
|
case 'egroupware.org:customfields':
|
||||||
$contact += self::parseCustomfields($value);
|
$contact += self::parseCustomfields($value, $strict);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'egroupware.org:assistant':
|
case 'egroupware.org:assistant':
|
||||||
@ -433,8 +433,12 @@ class JsContact
|
|||||||
foreach($definitions as $name => $definition)
|
foreach($definitions as $name => $definition)
|
||||||
{
|
{
|
||||||
$data = $cfs[$name];
|
$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))
|
if (!is_array($data) || !array_key_exists('value', $data))
|
||||||
{
|
{
|
||||||
throw new \InvalidArgumentException("Invalid customfield object $name: ".json_encode($data, self::JSON_OPTIONS_ERROR));
|
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_';
|
$prefix = $type === 'work' ? 'adr_one_' : 'adr_two_';
|
||||||
|
|
||||||
$contact = [$prefix.'street' => null, $prefix.'street2' => null];
|
$contact = [$prefix.'street' => null, $prefix.'street2' => null];
|
||||||
list($contact[$prefix.'street'], $contact[$prefix.'street2']) = self::parseStreetComponents($address['street'], $stict);
|
if (!empty($address['street']))
|
||||||
|
{
|
||||||
|
list($contact[$prefix.'street'], $contact[$prefix.'street2']) = self::parseStreetComponents($address['street'], $stict);
|
||||||
|
}
|
||||||
foreach(self::$jsAddress2attr+self::$jsAddress2workAttr as $js => $attr)
|
foreach(self::$jsAddress2attr+self::$jsAddress2workAttr as $js => $attr)
|
||||||
{
|
{
|
||||||
if (isset($address[$js]) && !is_string($address[$js]))
|
if (isset($address[$js]) && !is_string($address[$js]))
|
||||||
|
Loading…
Reference in New Issue
Block a user