Make sure there is an organizer defined
This commit is contained in:
parent
8416794d45
commit
5f445239c3
1 changed files with 20 additions and 0 deletions
|
@ -1149,6 +1149,26 @@ class calendar extends rcube_plugin
|
|||
}
|
||||
|
||||
$event['attachments'] = $attachments;
|
||||
|
||||
// check for organizer in attendees
|
||||
if ($event['attendees']) {
|
||||
$identity = $this->rc->user->get_identity();
|
||||
$organizer = $owner = false;
|
||||
foreach ($event['attendees'] as $i => $attendee) {
|
||||
if ($attendee['role'] == 'ORGANIZER')
|
||||
$organizer = true;
|
||||
if ($attendee['email'] == $identity['email'])
|
||||
$owner = $i;
|
||||
}
|
||||
|
||||
// set owner as organizer if yet missing
|
||||
if (!$organizer && $owner !== false) {
|
||||
$event['attendees'][$i]['role'] = 'ORGANIZER';
|
||||
}
|
||||
else if (!$organizer && $identity['email']) {
|
||||
$event['attendees'][] = array('role' => 'ORGANIZER', 'name' => $identity['name'], 'email' => $identity['email'], 'status' => 'ACCEPTED');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue