$area_name = $row[3]; } // If this is a modified entry then call // getPreviousEntryData to prepare entry comparison. if (isset($id)) { $mail_previous = getPreviousEntryData($id, 0); } $result = notifyAdminOnBooking(!isset($id), $new_id); } } } } # end foreach $rooms # Delete the original entry if (isset($id)) { mrbsDelEntry(getUserName(), $id, $edit_type == "series", 1); } sql_mutex_unlock("{$tbl_entry}"); $area = mrbsGetRoomArea($room_id); # Now its all done go back to the day view Header("Location: day.php?year={$year}&month={$month}&day={$day}&area={$area}"); exit; } # The room was not free. sql_mutex_unlock("{$tbl_entry}"); if (strlen($err)) { print_header($day, $month, $year, $area); echo "<H2>" . get_vocab("sched_conflict") . "</H2>"; if (!isset($hide_title)) { echo get_vocab("conflict") . ":"; echo "<UL>";
break; case "week": $returl = "week.php"; break; default: $returl = "day.php"; } $returl .= "?year={$year}&month={$month}&day={$day}&area={$area}"; } if (getAuthorised(1) && ($info = mrbsGetEntryInfo($id))) { $day = strftime("%d", $info["start_time"]); $month = strftime("%m", $info["start_time"]); $year = strftime("%Y", $info["start_time"]); $area = mrbsGetRoomArea($info["room_id"]); if (MAIL_ADMIN_ON_DELETE) { require_once "functions_mail.inc"; // Gather all fields values for use in emails. $mail_previous = getPreviousEntryData($id, $series); } sql_begin(); $result = mrbsDelEntry(getUserName(), $id, $series, 1); sql_commit(); if ($result) { // Send a mail to the Administrator MAIL_ADMIN_ON_DELETE ? $result = notifyAdminOnDelete($mail_previous) : ''; Header("Location: {$returl}"); exit; } } // If you got this far then we got an access denied. showAccessDenied($day, $month, $year, $area, "");
} } else { if ($send_mail_moderate) { $message_error = send_mail($new_id, 5, $dformat); } else { $message_error = send_mail($new_id, 1, $dformat); } } } } } if (isset($id) && $id != 0) { if ($rep_type != 0) { mrbsDelEntry(getUserName(), $id, 'series', 1); } else { mrbsDelEntry(getUserName(), $id, null, 1); } } grr_sql_mutex_unlock('' . TABLE_PREFIX . '_entry'); /* si tout s'est bien passé */ /** * Après la gestion de l'entry, je dispatch l'event pour les plugins */ $dataFromGet = filter_input_array(INPUT_GET); $dataFromGet['idLastInsert'] = $idPourEvent; $event = new EditEntryHandler($area_id, $dataFromGet, $id); $dispatcher->dispatch(EditEntryHandlerEvent::EDITENTRYHANDLER_AFTER_DB, $event); $area = mrbsGetRoomArea($room_id); $_SESSION['displ_msg'] = 'yes'; if ($message_error != '') { $_SESSION['session_message_error'] = $message_error;
$status |= STATUS_AWAITING_APPROVAL; } // Confirmation status if ($confirmation_enabled && !$confirmed) { $status |= STATUS_TENTATIVE; } $booking['status'] = $status; $bookings[] = $booking; } $just_check = $ajax && function_exists('json_encode') && !$commit; $this_id = isset($id) ? $id : NULL; $result = mrbsMakeBookings($bookings, $this_id, $just_check, $skip, $original_room_id, $need_to_send_mail, $edit_type); // If we weren't just checking and this was a succesful booking and // we were editing an existing booking, then delete the old booking if (!$just_check && $result['valid_booking'] && isset($id)) { mrbsDelEntry($user, $id, $edit_type == "series", 1); } // If this is an Ajax request, output the result and finish if ($ajax && function_exists('json_encode')) { // If this was a successful commit generate the new HTML if ($result['valid_booking'] && $commit) { // Generate the new HTML require_once "functions_table.inc"; if ($page == 'day') { $result['table_innerhtml'] = day_table_innerhtml($day, $month, $year, $room, $area, $timetohighlight); } else { $result['table_innerhtml'] = week_table_innerhtml($day, $month, $year, $room, $area, $timetohighlight); } } echo json_encode($result); exit;
//$notify_by_email = $mail_settings['on_delete'] && $need_to_send_mail; /*if ($notify_by_email) { require_once "functions_mail.inc"; // 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['rep_type'] != REP_NONE)) { $mail_previous['entry_type'] = ENTRY_RPT_CHANGED; } }*/ sqlsrv_begin_transaction($conn); $start_times = mrbsDelEntry('test', $id, $series, 1); sqlsrv_commit($conn); // [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'];
/** grrDelEntryInConflict() * * Efface les réservation qui sont en partie ou totalement dans le créneau $starttime<->$endtime * * $room_id - Which room are we checking * $starttime - The start of period * $endtime - The end of the period * $ignore - An entry ID to ignore, 0 to ignore no entries * $repignore - A repeat ID to ignore everything in the series, 0 to ignore no series * * Returns: * nothing - The area is free * something - An error occured, the return value is human readable * if $flag = 1, return the number of erased entries. */ function grrDelEntryInConflict($room_id, $starttime, $endtime, $ignore, $repignore, $flag) { global $vocab, $dformat; # Select any meetings which overlap ($starttime,$endtime) for this room: $sql = "SELECT id FROM ".TABLE_PREFIX."_entry WHERE start_time < '".$endtime."' AND end_time > '".$starttime."' AND room_id = '".$room_id."'"; if ($ignore > 0) $sql .= " AND id <> $ignore"; if ($repignore > 0) $sql .= " AND repeat_id <> $repignore"; $sql .= " ORDER BY start_time"; $res = grr_sql_query($sql); if(! $res) return grr_sql_error(); if (grr_sql_count($res) == 0) { grr_sql_free($res); return ""; } # Efface les résas concernées $err = ""; for ($i = 0; ($row = grr_sql_row($res, $i)); $i++) { if (getSettingValue("automatic_mail") == 'yes') $_SESSION['session_message_error'] = send_mail($row[0],3,$dformat); $result = mrbsDelEntry(getUserName(), $row[0], NULL , 1); } if ($flag == 1) return $result; }
$message_error = send_mail($new_id,5,$dformat); else $message_error = send_mail($new_id,1,$dformat); } } } // end foreach $rooms // Delete the original entry if(isset($id) and ($id!=0)) { if ($rep_type != 0) mrbsDelEntry(getUserName(), $id, "series", 1); else mrbsDelEntry(getUserName(), $id, NULL, 1); } grr_sql_mutex_unlock("".TABLE_PREFIX."_entry"); $area = mrbsGetRoomArea($room_id); # Now its all done go back to the day view $_SESSION['displ_msg'] = 'yes'; if ($message_error != "") $_SESSION['session_message_error'] = $message_error; Header("Location: ".$page.".php?year=$year&month=$month&day=$day&area=$area&room=$room_back"); exit; } # The room was not free.
// 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) { require_once "functions_mail.inc"; // Gather all fields values for use in emails. $mail_previous = mrbsGetBookingInfo($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['rep_type'] != REP_NONE) { $mail_previous['entry_type'] = ENTRY_RPT_CHANGED; } } sql_begin(); $start_times = mrbsDelEntry(getUserName(), $id, $series, 1); sql_commit(); // [At the moment MRBS does not inform the user if it was only able to // delete some members of a series but not all. 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 only // been partially successful] if ($start_times !== FALSE) { // 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'];