Bugfix: Contacts management failed

It had a strange array type structure and buggy
This commit is contained in:
djmaze 2020-10-20 15:37:06 +02:00
parent 0e3275599e
commit 3a315bc543
7 changed files with 44 additions and 40 deletions

View file

@ -144,12 +144,15 @@ trait Contacts
{
foreach ($aProperties as $aItem)
{
if ($aItem && isset($aItem[0], $aItem[1]) && \is_numeric($aItem[0]))
if ($aItem && isset($aItem['type'], $aItem['value'])
&& \is_numeric($aItem['type']) && (int) $aItem['type']
&& \RainLoop\Providers\AddressBook\Enumerations\PropertyType::FULLNAME != $aItem['type']
&& \strlen(\trim($aItem['value'])))
{
$oProp = new \RainLoop\Providers\AddressBook\Classes\Property();
$oProp->Type = (int) $aItem[0];
$oProp->Value = $aItem[1];
$oProp->TypeStr = empty($aItem[2]) ? '': $aItem[2];
$oProp->Type = (int) $aItem['type'];
$oProp->Value = \trim($aItem['value']);
$oProp->TypeStr = $aItem['typeStr'] ?? '';
$oContact->Properties[] = $oProp;
}

View file

@ -645,6 +645,7 @@ class Contact implements \JsonSerializable
}
return array(
'@Object' => 'Object/Contact',
'id' => $this->IdContact,
'display' => \MailSo\Base\Utils::Utf8Clear($this->Display),
'readOnly' => $this->ReadOnly,
'IdPropertyFromSearch' => $this->IdPropertyFromSearch,

View file

@ -159,6 +159,6 @@ class Property implements \JsonSerializable
'type' => $this->Type,
'typeStr' => $this->TypeStr,
'value' => \MailSo\Base\Utils::Utf8Clear($this->Value)
));
);
}
}