$default_view, 'year' => $year, 'month' => $month, 'day' => $day, 'area' => $area, 'room' => $room); $returl .= 'index.php?' . http_build_query($vars, '', '&'); } if ($info = get_booking_info($id, FALSE, TRUE)) { // check that the user is allowed to delete this entry if (isset($action) && ($action == "reject")) { $authorised = is_book_admin($info['room_id']); } else { $authorised = getWritable($info['create_by'], $info['room_id']); } if ($authorised) { $day = (int) date('d', $info['start_time']); $month = (int) date('m', $info['start_time']); $year = (int) date('Y', $info['start_time']); $area = get_area($info["room_id"]); if (empty($area)) { throw new \Exception("Room " . $info['room_id'] . " does not exist"); } // Get the settings for this area (they will be needed for policy checking) get_area_settings($area); $notify_by_email = $mail_settings['on_delete'] && need_to_send_mail(); if ($notify_by_email) { // Gather all fields values for use in emails. $mail_previous = get_booking_info($id, FALSE); // If this is an individual entry of a series then force the entry_type // to be a changed entry, so that when we create the iCalendar object we know that // we only want to delete the individual entry if (!$series && ($mail_previous['repeat_rule']->getType() != RepeatRule::NONE)) { $mail_previous['entry_type'] = ENTRY_RPT_CHANGED; } } $start_times = mrbsDelEntry($id, $series, true); // [At the moment MRBS does not inform the user if it was not able to delete // an entry, or, for a series, some entries in a series. This could happen for // example if a booking policy is in force that prevents the deletion of entries // in the past. It would be better to inform the user that the operation has // been unsuccessful or only partially successful] if (($start_times !== FALSE) && (count($start_times) > 0)) { // Send a mail to the Administrator if ($notify_by_email) { // Now that we've finished with mrbsDelEntry, change the id so that it's // the repeat_id if we're looking at a series. (This is a complete hack, // but brings us back into line with the rest of MRBS until the anomaly // of del_entry is fixed) if ($series) { $mail_previous['id'] = $mail_previous['repeat_id']; } notify_by_email($mail_previous, [], $series, $action, $start_times, $note); } } location_header($returl); } } // If you got this far then we got an access denied. showAccessDenied($view, $view_all, $year, $month, $day, $area);