// Remove an event from the calendar and its related items
if ($mode === 'drop' && $event_id) {
- $del = 0;
-
$ev = Event::getListById(local_user(), $event_id);
// Delete only real events (no birthdays)
if (DBA::isResult($ev) && $ev[0]['type'] == 'event') {
- $del = Item::deleteForUser(['id' => $ev[0]['itemid']], local_user());
+ Item::deleteForUser(['id' => $ev[0]['itemid']], local_user());
}
- if ($del == 0) {
+ if (Item::exists(['id' => $ev[0]['itemid']])) {
notice(L10n::t('Failed to remove event') . EOL);
} else {
info(L10n::t('Event removed') . EOL);