$type_session = 'with_session'; } unset($reg_statut_id); $reg_statut_id = isset($_GET['statut_id']) ? $_GET['statut_id'] : ''; if (isset($_GET['id'])) { $id = $_GET['id']; settype($id, 'integer'); } else { die; } $back = ''; if (isset($_SERVER['HTTP_REFERER'])) { $back = htmlspecialchars($_SERVER['HTTP_REFERER']); } if (isset($_GET['action_moderate'])) { moderate_entry_do($id, $_GET['moderate'], $_GET['description']); header('Location:' . $_GET['page'] . '.php'); } $sql = 'SELECT ' . TABLE_PREFIX . '_entry.name, ' . TABLE_PREFIX . '_entry.description, ' . TABLE_PREFIX . '_entry.beneficiaire, ' . TABLE_PREFIX . '_room.room_name, ' . TABLE_PREFIX . '_area.area_name, ' . TABLE_PREFIX . '_entry.type, ' . TABLE_PREFIX . '_entry.room_id, ' . TABLE_PREFIX . '_entry.repeat_id, ' . grr_sql_syntax_timestamp_to_unix('' . TABLE_PREFIX . '_entry.timestamp') . ', (' . TABLE_PREFIX . '_entry.end_time - ' . TABLE_PREFIX . '_entry.start_time), ' . TABLE_PREFIX . '_entry.start_time, ' . TABLE_PREFIX . '_entry.end_time, ' . TABLE_PREFIX . '_area.id,
$type_session = "with_session"; } unset($reg_statut_id); $reg_statut_id = isset($_GET["statut_id"]) ? $_GET["statut_id"] : ""; if (isset($_GET["id"])) { $id = $_GET["id"]; settype($id, "integer"); } else { die; } $back = ''; if (isset($_SERVER['HTTP_REFERER'])) { $back = htmlspecialchars($_SERVER['HTTP_REFERER']); } if (isset($_GET["action_moderate"])) { moderate_entry_do($id, $_GET["moderate"], $_GET["description"]); header("Location:" . $_GET['page'] . ".php"); } $sql = "SELECT " . TABLE_PREFIX . "_entry.name,\n" . TABLE_PREFIX . "_entry.description,\n" . TABLE_PREFIX . "_entry.beneficiaire,\n" . TABLE_PREFIX . "_room.room_name,\n" . TABLE_PREFIX . "_area.area_name,\n" . TABLE_PREFIX . "_entry.type,\n" . TABLE_PREFIX . "_entry.room_id,\n" . TABLE_PREFIX . "_entry.repeat_id,\n" . grr_sql_syntax_timestamp_to_unix("" . TABLE_PREFIX . "_entry.timestamp") . ",\n(" . TABLE_PREFIX . "_entry.end_time - " . TABLE_PREFIX . "_entry.start_time),\n" . TABLE_PREFIX . "_entry.start_time,\n" . TABLE_PREFIX . "_entry.end_time,\n" . TABLE_PREFIX . "_area.id,\n" . TABLE_PREFIX . "_entry.statut_entry,\n" . TABLE_PREFIX . "_room.delais_option_reservation,\n" . TABLE_PREFIX . "_entry.option_reservation, " . "" . TABLE_PREFIX . "_entry.moderate,\n" . TABLE_PREFIX . "_entry.beneficiaire_ext,\n" . TABLE_PREFIX . "_entry.create_by,\n" . TABLE_PREFIX . "_entry.jours,\n" . TABLE_PREFIX . "_room.active_ressource_empruntee,\n" . TABLE_PREFIX . "_entry.clef,\n" . TABLE_PREFIX . "_entry.courrier\nFROM " . TABLE_PREFIX . "_entry, " . TABLE_PREFIX . "_room, " . TABLE_PREFIX . "_area\nWHERE " . TABLE_PREFIX . "_entry.room_id = " . TABLE_PREFIX . "_room.id\nAND " . TABLE_PREFIX . "_room.area_id = " . TABLE_PREFIX . "_area.id\nAND " . TABLE_PREFIX . "_entry.id='" . $id . "'"; $sql_backup = "SELECT " . TABLE_PREFIX . "_entry_moderate.name,\n" . TABLE_PREFIX . "_entry_moderate.description,\n" . TABLE_PREFIX . "_entry_moderate.beneficiaire,\n" . TABLE_PREFIX . "_room.room_name,\n" . TABLE_PREFIX . "_area.area_name,\n" . TABLE_PREFIX . "_entry_moderate.type,\n" . TABLE_PREFIX . "_entry_moderate.room_id,\n" . TABLE_PREFIX . "_entry_moderate.repeat_id,\n" . grr_sql_syntax_timestamp_to_unix("" . TABLE_PREFIX . "_entry_moderate.timestamp") . ",\n(" . TABLE_PREFIX . "_entry_moderate.end_time - " . TABLE_PREFIX . "_entry_moderate.start_time),\n" . TABLE_PREFIX . "_entry_moderate.start_time,\n" . TABLE_PREFIX . "_entry_moderate.end_time,\n" . TABLE_PREFIX . "_area.id,\n" . TABLE_PREFIX . "_entry_moderate.statut_entry,\n" . TABLE_PREFIX . "_room.delais_option_reservation,\n" . TABLE_PREFIX . "_entry_moderate.option_reservation, " . "" . TABLE_PREFIX . "_entry_moderate.moderate,\n" . TABLE_PREFIX . "_entry_moderate.beneficiaire_ext,\n" . TABLE_PREFIX . "_entry_moderate.create_by\nFROM " . TABLE_PREFIX . "_entry_moderate, " . TABLE_PREFIX . "_room, " . TABLE_PREFIX . "_area\nWHERE " . TABLE_PREFIX . "_entry_moderate.room_id = " . TABLE_PREFIX . "_room.id\nAND " . TABLE_PREFIX . "_room.area_id = " . TABLE_PREFIX . "_area.id\nAND " . TABLE_PREFIX . "_entry_moderate.id='" . $id . "'"; $res = grr_sql_query($sql); if (!$res) { fatal_error(0, grr_sql_error()); } if (grr_sql_count($res) < 1) { $reservation_is_delete = 'y'; $was_del = TRUE; $res_backup = grr_sql_query($sql_backup); if (!$res_backup) { fatal_error(0, grr_sql_error()); }
/** mrbsCreateRepeatingEntrys() * * Creates a repeat entry in the data base + all the repeating entrys * * $starttime - Start time of entry * $endtime - End time of entry * $rep_type - The repeat type * $rep_enddate - When the repeating ends * $rep_opt - Any options associated with the entry * $room_id - Room ID * $beneficiaire - beneficiaire * $beneficiaire_ext - bénéficiaire extérieur * $name - Name * $type - Type (Internal/External) * $description - Description *$rep_jour_c - Le jour cycle d'une réservation, si aucun 0 * * Returns: * 0 - An error occured while inserting the entry * non-zero - The entry's ID */ function mrbsCreateRepeatingEntrys($starttime, $endtime, $rep_type, $rep_enddate, $rep_opt, $room_id, $creator, $beneficiaire, $beneficiaire_ext, $name, $type, $description, $rep_num_weeks, $option_reservation,$overload_data, $moderate, $rep_jour_c) { global $max_rep_entrys, $id_first_resa; $area = mrbsGetRoomArea($room_id); $reps = mrbsGetRepeatEntryList($starttime, $rep_enddate, $rep_type, $rep_opt, $max_rep_entrys, $rep_num_weeks, $rep_jour_c, $area); if(count($reps) > $max_rep_entrys) return 0; if(empty($reps)) { mrbsCreateSingleEntry($starttime, $endtime, 0, 0, $room_id, $creator, $beneficiaire, $beneficiaire_ext, $name, $type, $description, $option_reservation,$overload_data,$moderate, $rep_jour_c,"-"); $id_first_resa = grr_sql_insert_id("".TABLE_PREFIX."_entry", "id"); return; } $ent = mrbsCreateRepeatEntry($starttime, $endtime, $rep_type, $rep_enddate, $rep_opt, $room_id, $creator, $beneficiaire, $beneficiaire_ext, $name, $type, $description, $rep_num_weeks,$overload_data, $rep_jour_c); if($ent) { $diff = $endtime - $starttime; for($i = 0; $i < count($reps); $i++) { mrbsCreateSingleEntry($reps[$i], $reps[$i] + $diff, 1, $ent, $room_id, $creator, $beneficiaire, $beneficiaire_ext, $name, $type, $description, $option_reservation,$overload_data, $moderate, $rep_jour_c,"-"); $id_new_resa = grr_sql_insert_id("".TABLE_PREFIX."_entry", "id"); // s'il s'agit d'une modification d'une ressource déjà modérée et acceptée : on met à jour les infos dans la table ".TABLE_PREFIX."_entry_moderate if ($moderate==2) moderate_entry_do($id_new_resa,1,"","no"); // On récupère l'id de la première réservation de la série et qui sera utilisé pour l'enoi d'un mail if ($i == 0) $id_first_resa = $id_new_resa; } } return $ent; }