Fix wrong contact retrieval condition in Event::store

This commit is contained in:
Hypolite Petovan 2018-03-17 10:05:17 -04:00
parent bc12ba68cd
commit 254974826f

View file

@ -255,12 +255,14 @@ class Event extends BaseObject
} }
$private = intval(defaults($arr, 'private', 0)); $private = intval(defaults($arr, 'private', 0));
$condition = ['uid' => $event['uid']]; $conditions = ['uid' => $event['uid']];
if ($event['cid']) { if ($event['cid']) {
$condition['id'] = $event['cid']; $conditions['id'] = $event['cid'];
} else {
$conditions['self'] = true;
} }
$contact = dba::selectFirst('contact', [], ['id' => $event['cid'], 'uid' => $event['uid']]); $contact = dba::selectFirst('contact', [], $conditions);
// Existing event being modified. // Existing event being modified.
if ($event['id']) { if ($event['id']) {