* REST API: fix PATCHing of custom-fields

This commit is contained in:
ralf 2024-02-21 17:27:49 +02:00
parent f5476ef133
commit 158f683e69
4 changed files with 14 additions and 5 deletions

View File

@ -200,7 +200,7 @@ class JsBase
foreach($definitions as $name => $definition)
{
$data = $cfs[$name];
$data = $cfs[$name] ?? null;
if (isset($data))
{
if (is_scalar($data) || is_array($data) && !isset($data['value']))
@ -357,9 +357,17 @@ class JsBase
$target = &$target[$part];
}
if (isset($value))
{
// objects need to be merged, to not unset all not given attributes
if (is_array($value) && !array_key_exists(0, $value))
{
$target = array_merge($target, $value);
}
else
{
$target = $value;
}
}
else
{
unset($parent[$part]);

View File

@ -179,7 +179,7 @@ class JsCalendar extends JsBase
break;
case 'egroupware.org:customfields':
$event += self::parseCustomfields($value, $strict);
$event = array_merge($event, self::parseCustomfields($value, $strict));
break;
case 'prodId':

View File

@ -188,7 +188,7 @@ class JsContact extends Api\CalDAV\JsBase
break;
case 'egroupware.org:customfields':
$contact += self::parseCustomfields($value);
$contact = array_merge($contact, self::parseCustomfields($value));
break;
case 'egroupware.org:assistant':

View File

@ -154,7 +154,7 @@ class JsTimesheet extends Api\CalDAV\JsBase
break;
case 'egroupware.org:customfields':
$timesheet += self::parseCustomfields($value);
$timesheet = array_merge($timesheet, self::parseCustomfields($value));
break;
case 'prodId':
@ -163,6 +163,7 @@ class JsTimesheet extends Api\CalDAV\JsBase
case 'modifier':
case self::AT_TYPE:
case 'id':
case 'etag':
break;
default: