mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 14:41:29 +01:00
* REST Api: allow to create new fields with PATCH for application/json content-type and error on not existing custom fields
This commit is contained in:
parent
543fb4d342
commit
94670fcf83
@ -236,10 +236,10 @@ class JsBase
|
||||
$contact['#'.$name] = null;
|
||||
}
|
||||
}
|
||||
// report not existing cfs to log
|
||||
// error not existing cfs
|
||||
if (($not_existing=array_diff(array_keys($cfs), array_keys($definitions))))
|
||||
{
|
||||
error_log(__METHOD__."() not existing/ignored custom fields: ".implode(', ', $not_existing));
|
||||
throw new JsParseException("Trying to update not existing custom field(s): ".implode(', ', $not_existing));
|
||||
}
|
||||
return $contact;
|
||||
}
|
||||
|
@ -110,8 +110,8 @@ class JsCalendar extends JsBase
|
||||
return strpos($key, '/') !== false;
|
||||
}))
|
||||
{
|
||||
// apply patch on JsCard of contact
|
||||
$data = self::patch($data, $old ? self::getJsCalendar($old, false) : [], !$old);
|
||||
// apply patch on JsEvent
|
||||
$data = self::patch($data, $old ? self::getJsCalendar($old, false) : [], !$old || !$strict);
|
||||
}
|
||||
|
||||
if (!isset($data['uid'])) $data['uid'] = null; // to fail below, if it does not exist
|
||||
|
@ -104,7 +104,7 @@ class JsContact extends Api\CalDAV\JsBase
|
||||
}))
|
||||
{
|
||||
// apply patch on JsCard of contact
|
||||
$data = self::patch($data, $old ? self::getJsCard($old, false) : [], !$old);
|
||||
$data = self::patch($data, $old ? self::getJsCard($old, false) : [], !$old || !$strict);
|
||||
}
|
||||
|
||||
if (!isset($data['uid'])) $data['uid'] = null; // to fail below, if it does not exist
|
||||
@ -188,7 +188,7 @@ class JsContact extends Api\CalDAV\JsBase
|
||||
break;
|
||||
|
||||
case 'egroupware.org:customfields':
|
||||
$contact += self::parseCustomfields($value, $strict);
|
||||
$contact += self::parseCustomfields($value);
|
||||
break;
|
||||
|
||||
case 'egroupware.org:assistant':
|
||||
|
Loading…
Reference in New Issue
Block a user