PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/admin/event_load.php

https://github.com/sportsynergy/clubpro
PHP | 560 lines | 372 code | 89 blank | 99 comment | 87 complexity | 57671501f6a6c1643aa2a9b28f6c1a94 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-3.0
  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. /* ====================================================================
  4. * GNU Lesser General Public License
  5. * Version 2.1, February 1999
  6. *
  7. * <one line to give the library's name and a brief idea of what it does.>
  8. *
  9. * Copyright (C) 2001~2012 Adam Preston
  10. *
  11. *
  12. * This library is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU Lesser General Public
  14. * License as published by the Free Software Foundation; either
  15. * version 2.1 of the License, or (at your option) any later version.
  16. *
  17. * This library is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. * Lesser General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Lesser General Public
  23. * License along with this library; if not, write to the Free Software
  24. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  25. * $Id:$
  26. */
  27. /**
  28. * Class and Function List:
  29. * Function list:
  30. * - validate_form()
  31. * - add_events()
  32. * - getReservationWindow()
  33. * - makeReoccurringReservations()
  34. * - cancelReservation()
  35. * Classes list:
  36. */
  37. include ("../application.php");
  38. $DOC_TITLE = "Add Events";
  39. require_priv("2");
  40. //Set the http variables
  41. $courtid = $_REQUEST["courtid"];
  42. $time = $_REQUEST["time"];
  43. if (match_referer() && isset($_POST['submitme'])) {
  44. $frm = $_POST;
  45. $errormsg = validate_form($frm, $errors);
  46. $wwwroot = $_SESSION["CFG"]["wwwroot"];
  47. $backtopage = "$wwwroot/admin/event_load.php?courtid=$courtid&time=$time";
  48. if ($errormsg) {
  49. include ($_SESSION["CFG"]["templatedir"] . "/header_yui.php");
  50. include ($_SESSION["CFG"]["includedir"] . "/errorpage.php");
  51. include ($_SESSION["CFG"]["templatedir"] . "/footer_yui.php");
  52. die;
  53. } else {
  54. add_events($frm);
  55. $wwwroot = $_SESSION["CFG"]["wwwroot"];
  56. header("Location: $wwwroot/clubs/" . get_sitecode() . "/index.php?daysahead=$time");
  57. die;
  58. }
  59. }
  60. //Load up the window for which the events can be loaded.
  61. $reservationWindowArray = getReservationWindow($courtid, $time);
  62. include ($_SESSION["CFG"]["templatedir"] . "/header_yui.php");
  63. include ($_SESSION["CFG"]["templatedir"] . "/event_load_form.php");
  64. include ($_SESSION["CFG"]["templatedir"] . "/footer_yui.php");
  65. /******************************************************************************
  66. * FUNCTIONS
  67. *****************************************************************************/
  68. function validate_form(&$frm, &$errors) {
  69. /* validate the signup form, and return the error messages in a string. if
  70. * the string is empty, then there are no errors */
  71. $errors = new Object;
  72. $msg = "";
  73. //Make sure that they selected everything
  74. if (empty($frm["eventid"])) {
  75. $msg.= "You did not specify an event name.";
  76. } elseif (empty($frm["starttime"])) {
  77. $msg.= "You did not specify a start time.";
  78. } elseif ($frm["endtime"] == "") {
  79. $msg.= "You did not specify an end time.";
  80. }
  81. //Validate that the start is before end
  82. elseif ($frm["starttime"] > $frm["endtime"]) {
  83. $msg.= "The start time needs to occur before the end time.";
  84. }
  85. //If Duration is set, the duration should be set too.
  86. elseif (empty($frm["repeat"]) && !empty($frm["reoccurringduration"])) {
  87. $msg.= "You did not specify how often you would like this reservation to occur. Set something in the Repeat field.";
  88. }
  89. //If Duration is set, the duration should be set too.
  90. elseif (!empty($frm["repeat"]) && $frm["repeat"] != "norepeat" && empty($frm["reoccurringduration"])) {
  91. $msg.= "You did not specify how far in the future you would like this to go. Set something in the Duration field.";
  92. }
  93. // The times can't be the same, otherwise its not a block entry
  94. elseif ($frm["starttime"] == $frm["endtime"]) {
  95. $msg.= "Please specify a valid window, your start time and end time are both the same.";
  96. }
  97. return $msg;
  98. }
  99. /**
  100. * This function adds events.
  101. *
  102. * In cases where an existing reservation has been made, the event will not.
  103. *
  104. * A Reoccuring Block Event is a group of reoccurring events. A reoccuring event
  105. * can reoccur every hour for a day, or can reoccur every week for a month. The event
  106. * interval is how frequently the event occurs. From the event _log form this is defaulted
  107. * as the court duration.
  108. */
  109. function add_events(&$frm) {
  110. $initialStartTime = $frm['starttime'];
  111. $initialEndTime = $frm['endtime'];
  112. $courtId = $frm['courtid'];
  113. $eventId = $frm['eventid'];
  114. $courtduration = $frm['courtduration'];
  115. $cancelConflicts = empty($frm['cancelconflicts']) ? false : true;
  116. $locked = empty($frm['lock']) ? "n" : "y";
  117. if (isDebugEnabled(2)) logMessage("event_load.add_events: \n\tinitialStartTime: $initialStartTime \n\tinitialEndTime: $initialEndTime \n\tcourtId: $courtId \n\teventId: $eventId \n\tcourtduration: $courtduration \n\tcancelConflicts: $cancelConflicts ");
  118. //If this is not a reoccuring reservation. This can be specificaly noted or this can be left blank.
  119. if ($frm['repeat'] == "norepeat" || empty($frm['repeat'])) {
  120. if (isDebugEnabled(2)) logMessage("event_load.add_events: This is not a reoccuring block event.");
  121. // When this field comes back empty there
  122. // was only one reservation slot to be made, to see how this is
  123. // done see the notes in event_load_form.php above this hidden
  124. // form field declaration.
  125. makeReoccurringReservations($initialStartTime, $initialEndTime, $courtId, $eventId, $courtduration, $cancelConflicts, null, $locked);
  126. }
  127. // This is a reoccuring reservation
  128. else {
  129. if (isDebugEnabled(2)) logMessage("event_load.add_events: This is a reoccuring block " . $frm['repeat'] . " event for a " . $frm['reoccurringduration'] . ".");
  130. if ($frm['repeat'] == "daily") {
  131. //Add as block event
  132. $reoccuringQuery = "INSERT INTO tblReoccurringBlockEvent (
  133. creator
  134. ) VALUES (
  135. " . get_userid() . "
  136. )";
  137. $reservationResult = db_query($reoccuringQuery);
  138. $blockId = db_insert_id();
  139. $initialHourstart = 0;
  140. if (isDebugEnabled(2)) logMessage("\t-> Setting Block Event Id: $blockId");
  141. //Set the occurance interval
  142. if ($frm['reoccurringduration'] == "week") $numdays = 7;
  143. if ($frm['reoccurringduration'] == "month") $numdays = 30;
  144. if ($frm['reoccurringduration'] == "year") $numdays = 365;
  145. if ($frm['reoccurringduration'] == "twodays") $numdays = 2;
  146. if ($frm['reoccurringduration'] == "threedays") $numdays = 3;
  147. if ($frm['reoccurringduration'] == "fourdays") $numdays = 4;
  148. if ($frm['reoccurringduration'] == "fivedays") $numdays = 5;
  149. if ($frm['reoccurringduration'] == "sixdays") $numdays = 6;
  150. for ($i = 0; $i < $numdays; $i++) {
  151. $startTime = gmmktime(gmdate("H", $initialStartTime) , gmdate("i", $initialStartTime) , gmdate("s", $initialStartTime) , gmdate("n", $initialStartTime) , gmdate("j", $initialStartTime) + $i, gmdate("Y", $initialStartTime));
  152. $endTime = gmmktime(gmdate("H", $initialEndTime) , gmdate("i", $initialEndTime) , gmdate("s", $initialEndTime) , gmdate("n", $initialEndTime) , gmdate("j", $initialEndTime) + $i, gmdate("Y", $initialEndTime));
  153. // Set the event interval. This will be the duration for the court for that day
  154. $dayOfWeek = gmdate("w", $startTime);
  155. $courtHourQuery = "SELECT * from tblCourtHours WHERE dayid = $dayOfWeek AND courtid = $courtId";
  156. $courtHourResult = db_query($courtHourQuery);
  157. $courtHourArray = mysqli_fetch_array($courtHourResult);
  158. $eventinterval = 3600 * $courtHourArray["duration"];
  159. //Adjust the start and endtimes. If this is the second reservation then compare the hourstarts
  160. //to see if an adjustment needs to be made. For example, if the hourstart of the first day is 15
  161. //and the second day is 30, then 15* 60 should be added to both start and end times. If the hourstart
  162. // of the fist day is 30 and the hourstart of the second day is 0, then 30 should be subtracted from
  163. //both start and enttimes.
  164. if ($i > 0) {
  165. $hourstart = $initialHourstart - $courtHourArray["hourstart"];
  166. $startTime-= ($hourstart * 60);
  167. $endTime-= ($hourstart * 60);
  168. } else {
  169. $initialHourstart = $courtHourArray["hourstart"];
  170. }
  171. makeReoccurringReservations($startTime, $endTime, $courtId, $eventId, $eventinterval, $cancelConflicts, $blockId, $locked);
  172. }
  173. }
  174. //Add the weekly event
  175. elseif ($frm['repeat'] == "weekly") {
  176. //Add as block event
  177. $reoccuringQuery = "INSERT INTO tblReoccurringBlockEvent (
  178. creator
  179. ) VALUES (
  180. " . get_userid() . "
  181. )";
  182. $reservationResult = db_query($reoccuringQuery);
  183. $blockId = db_insert_id();
  184. $initialHourstart = 0;
  185. if (isDebugEnabled(2)) logMessage("\t-> Setting Block Event Id: $blockId");
  186. //Set the occurance interval
  187. if ($frm['reoccurringduration'] == "week") $numdays = 7;
  188. if ($frm['reoccurringduration'] == "month") $numdays = 30;
  189. if ($frm['reoccurringduration'] == "year") $numdays = 365;
  190. for ($i = 0; $i < $numdays; $i+= 7) {
  191. $startTime = gmmktime(gmdate("H", $initialStartTime) , gmdate("i", $initialStartTime) , gmdate("s", $initialStartTime) , gmdate("n", $initialStartTime) , gmdate("j", $initialStartTime) + $i, gmdate("Y", $initialStartTime));
  192. $endTime = gmmktime(gmdate("H", $initialEndTime) , gmdate("i", $initialEndTime) , gmdate("s", $initialEndTime) , gmdate("n", $initialEndTime) , gmdate("j", $initialEndTime) + $i, gmdate("Y", $initialEndTime));
  193. // Set the event interval. This will be the duration for the court for that day
  194. $dayOfWeek = gmdate("w", $startTime);
  195. $courtHourQuery = "SELECT * from tblCourtHours WHERE dayid = $dayOfWeek AND courtid = $courtId";
  196. $courtHourResult = db_query($courtHourQuery);
  197. $courtHourArray = mysqli_fetch_array($courtHourResult);
  198. $eventinterval = 3600 * $courtHourArray["duration"];
  199. //Adjust the start and endtimes. If this is the second reservation then compare the hourstarts
  200. //to see if an adjustment needs to be made. For example, if the hourstart of the first day is 15
  201. //and the second day is 30, then 15* 60 should be added to both start and end times. If the hourstart
  202. // of the fist day is 30 and the hourstart of the second day is 0, then 30 should be subtracted from
  203. //both start and enttimes.
  204. if ($i > 0) {
  205. $hourstart = $initialHourstart - $courtHourArray["hourstart"];
  206. $startTime-= ($hourstart * 60);
  207. $endTime-= ($hourstart * 60);
  208. } else {
  209. $initialHourstart = $courtHourArray["hourstart"];
  210. }
  211. makeReoccurringReservations($startTime, $endTime, $courtId, $eventId, $eventinterval, $cancelConflicts, $blockId, $locked);
  212. }
  213. }
  214. //Add the weekly event
  215. elseif ($frm['repeat'] == "biweekly") {
  216. //Add as block event
  217. $reoccuringQuery = "INSERT INTO tblReoccurringBlockEvent (
  218. creator
  219. ) VALUES (
  220. " . get_userid() . "
  221. )";
  222. $reservationResult = db_query($reoccuringQuery);
  223. $blockId = db_insert_id();
  224. $initialHourstart = 0;
  225. if (isDebugEnabled(2)) logMessage("\t-> Setting Block Event Id: $blockId");
  226. //Set the occurance interval
  227. if ($frm['reoccurringduration'] == "week") $numdays = 7;
  228. if ($frm['reoccurringduration'] == "month") $numdays = 28;
  229. if ($frm['reoccurringduration'] == "year") $numdays = 365;
  230. for ($i = 0; $i < $numdays; $i+= 14) {
  231. $startTime = gmmktime(gmdate("H", $initialStartTime) , gmdate("i", $initialStartTime) , gmdate("s", $initialStartTime) , gmdate("n", $initialStartTime) , gmdate("j", $initialStartTime) + $i, gmdate("Y", $initialStartTime));
  232. $endTime = gmmktime(gmdate("H", $initialEndTime) , gmdate("i", $initialEndTime) , gmdate("s", $initialEndTime) , gmdate("n", $initialEndTime) , gmdate("j", $initialEndTime) + $i, gmdate("Y", $initialEndTime));
  233. // Set the event interval. This will be the duration for the court for that day
  234. $dayOfWeek = gmdate("w", $startTime);
  235. $courtHourQuery = "SELECT * from tblCourtHours WHERE dayid = $dayOfWeek AND courtid = $courtId";
  236. $courtHourResult = db_query($courtHourQuery);
  237. $courtHourArray = mysqli_fetch_array($courtHourResult);
  238. $eventinterval = 3600 * $courtHourArray["duration"];
  239. //Adjust the start and endtimes. If this is the second reservation then compare the hourstarts
  240. //to see if an adjustment needs to be made. For example, if the hourstart of the first day is 15
  241. //and the second day is 30, then 15* 60 should be added to both start and end times. If the hourstart
  242. // of the fist day is 30 and the hourstart of the second day is 0, then 30 should be subtracted from
  243. //both start and enttimes.
  244. if ($i > 0) {
  245. $hourstart = $initialHourstart - $courtHourArray["hourstart"];
  246. $startTime-= ($hourstart * 60);
  247. $endTime-= ($hourstart * 60);
  248. } else {
  249. $initialHourstart = $courtHourArray["hourstart"];
  250. }
  251. makeReoccurringReservations($startTime, $endTime, $courtId, $eventId, $eventinterval, $cancelConflicts, $blockId, $locked);
  252. }
  253. }
  254. //Add the monthly event
  255. elseif ($frm['repeat'] == "monthly") {
  256. //Add as block event
  257. $reoccuringQuery = "INSERT INTO tblReoccurringBlockEvent (
  258. creator
  259. ) VALUES (
  260. " . get_userid() . "
  261. )";
  262. $reservationResult = db_query($reoccuringQuery);
  263. $blockId = db_insert_id();
  264. $initialHourstart = 0;
  265. if (isDebugEnabled(2)) logMessage("\t-> Setting Block Event Id: $blockId");
  266. //Set the occurance interval
  267. if ($frm['reoccurringduration'] == "week") $numdays = 1;
  268. if ($frm['reoccurringduration'] == "month") $numdays = 1;
  269. if ($frm['reoccurringduration'] == "year") $numdays = 12;
  270. for ($i = 0; $i < $numdays; $i++) {
  271. $startTime = gmmktime(gmdate("H", $initialStartTime) , gmdate("i", $initialStartTime) , gmdate("s", $initialStartTime) , gmdate("n", $initialStartTime) + $i, gmdate("j", $initialStartTime) + $i, gmdate("Y", $initialStartTime));
  272. $endTime = gmmktime(gmdate("H", $initialEndTime) , gmdate("i", $initialEndTime) , gmdate("s", $initialEndTime) , gmdate("n", $initialEndTime) + $i, gmdate("j", $initialEndTime) + $i, gmdate("Y", $initialEndTime));
  273. // Set the event interval. This will be the duration for the court for that day
  274. $dayOfWeek = gmdate("w", $startTime);
  275. $courtHourQuery = "SELECT * from tblCourtHours WHERE dayid = $dayOfWeek AND courtid = $courtId";
  276. $courtHourResult = db_query($courtHourQuery);
  277. $courtHourArray = mysqli_fetch_array($courtHourResult);
  278. //Adjust the start and endtimes. If this is the second reservation then compare the hourstarts
  279. //to see if an adjustment needs to be made. For example, if the hourstart of the first day is 15
  280. //and the second day is 30, then 15* 60 should be added to both start and end times. If the hourstart
  281. // of the fist day is 30 and the hourstart of the second day is 0, then 30 should be subtracted from
  282. //both start and enttimes.
  283. if ($i > 0) {
  284. $hourstart = $initialHourstart - $courtHourArray["hourstart"];
  285. $startTime-= ($hourstart * 60);
  286. $endTime-= ($hourstart * 60);
  287. } else {
  288. $initialHourstart = $courtHourArray["hourstart"];
  289. }
  290. makeReoccurringReservations($startTime, $endTime, $courtId, $eventId, $eventinterval, $cancelConflicts, $blockId, $locked);
  291. }
  292. } else {
  293. if (isDebugEnabled(2)) logMessage("The Repeat HTTP Variable wasn't set correctly");
  294. }
  295. }
  296. }
  297. /**
  298. * This returns the window for which the reservation can be booked.
  299. * There are Two calls to the database here. The first is to get
  300. * more information about the court, such as the hour start and duration.
  301. * The second call is for getting information on the club hours.
  302. *
  303. * This function will return an array of start times for which the
  304. * event reservations can be made fot the current day.
  305. */
  306. function getReservationWindow($courtid, $time) {
  307. $current_time = $_SESSION["current_time"];
  308. if (isDebugEnabled(2)) logMessage("event_load.getReservationWindow:ntId: courtid $courtid and time: $time and current time is: " . $current_time);
  309. //The Day of the week for the time
  310. $currDOW = gmdate("w", $time);
  311. //Get the Open and close time for the club
  312. $hoursquery = "SELECT hours.opentime, hours.closetime, hours.duration, hours.hourstart from tblCourtHours hours WHERE courtid='$courtid' AND dayid ='$currDOW' ";
  313. $hoursresult = db_query($hoursquery);
  314. $hoursarray = db_fetch_array($hoursresult);
  315. $otimearray = explode(":", $hoursarray[0]);
  316. $ctimearray = explode(":", $hoursarray[1]);
  317. $openHour = $otimearray[0];
  318. $closeHour = $ctimearray[0];
  319. $hourStart = $hoursarray['hourstart'];
  320. $duration = $hoursarray['duration'] * 3600;
  321. //Build out dates
  322. $thisMonth = gmdate("n", $time);
  323. $thisDate = gmdate("j", $time);
  324. $thisYear = gmdate("Y", $time);
  325. $courtOpenTime = gmmktime($openHour, $hourStart, 0, $thisMonth, $thisDate, $thisYear);
  326. $courtCloseTime = gmmktime($closeHour, $hourStart, 0, $thisMonth, $thisDate, $thisYear);
  327. $timeListArray = array();
  328. for ($i = $courtOpenTime; $i < $courtCloseTime; $i = $i + $duration) {
  329. //Only add those slots that occur after the current time
  330. if ($current_time < $i) {
  331. array_push($timeListArray, $i);
  332. }
  333. }
  334. return $timeListArray;
  335. }
  336. /**
  337. * Make a block reservation. The eventinterval is how often the event will reoccur.
  338. *
  339. *
  340. */
  341. function makeReoccurringReservations($startTime, $endTime, $courtId, $eventId, $eventinterval, $cancelConflicts, $blockId, $locked) {
  342. if (isDebugEnabled(2)) logMessage("event_load.makeReoccurringReservations: \n\tstartTime: $startTime \n\tendTime: $endTime \n\tcourtId: $courtId \n\teventId: $eventId \n\teventinterval: $eventinterval \n\tcancelConflicts: $cancelConflicts \n\tblockId: $blockId");
  343. $resrvationQuery = "SELECT reservation.time
  344. FROM tblReservations reservation
  345. WHERE reservation.time >= $startTime
  346. AND reservation.time <= $endTime
  347. AND reservation.courtid = $courtId
  348. AND reservation.enddate IS NULL";
  349. $reservationResult = db_query($resrvationQuery);
  350. //Put results in an array
  351. $confirmedReservationArray = array();
  352. while ($confirmedReservation = db_fetch_array($reservationResult)) {
  353. array_push($confirmedReservationArray, $confirmedReservation[0]);
  354. }
  355. //Go through the window specified
  356. for ($i = $startTime; $i <= $endTime; $i = $i + $eventinterval) {
  357. //This function will not overwrite existing reservations
  358. if (!in_array($i, $confirmedReservationArray)) {
  359. if (isDebugEnabled(2)) logMessage("\t-> adding event reservation for court $courtId on $i");
  360. $resquery = "INSERT INTO tblReservations (
  361. courtid, eventid, time, creator, lastmodifier, locked
  362. ) VALUES (
  363. '$courtId'
  364. ,'$eventId'
  365. ,'$i'
  366. , " . get_userid() . "
  367. , " . get_userid() . "
  368. , '$locked')";
  369. $resresult = db_query($resquery);
  370. } else {
  371. //If they choose to cancel conflicts, then do so (and send out an email)
  372. if ($cancelConflicts) {
  373. cancelReservation($i, $courtId);
  374. if (isDebugEnabled(2)) logMessage("\t-> adding event reservation for court $courtId on $i");
  375. $resquery = "INSERT INTO tblReservations (
  376. courtid, eventid, time, creator, lastmodifier, locked
  377. ) VALUES (
  378. '$courtId'
  379. ,'$eventId'
  380. ,'$i'
  381. , " . get_userid() . "
  382. , " . get_userid() . "
  383. ,'$locked')";
  384. $resresult = db_query($resquery);
  385. }
  386. }
  387. //Only make one reservation when only one slot is available
  388. if (empty($eventinterval)) break;
  389. }
  390. //Add as reoccuring event
  391. $reoccuringQuery = "INSERT INTO tblReoccuringEvents (
  392. courtid, eventinterval, starttime, endtime
  393. ) VALUES (
  394. $courtId,
  395. $eventinterval,
  396. $startTime,
  397. $endTime)";
  398. $reservationResult = db_query($reoccuringQuery);
  399. $reoccuringEventId = db_insert_id();
  400. if (isDebugEnabled(2)) logMessage("\t-> adding tblReoccuringEvents $reoccuringEventId");
  401. if (isset($blockId)) {
  402. //Add a block event entry
  403. $reoccuringQuery = "INSERT INTO tblReoccurringBlockEventEntry (
  404. reoccuringblockeventid, reoccuringentryid
  405. ) VALUES (
  406. $blockId,
  407. $reoccuringEventId
  408. )";
  409. $reservationResult = db_query($reoccuringQuery);
  410. $reoccuringBlockEventId = db_insert_id();
  411. if (isDebugEnabled(2)) logMessage("\t-> adding tblReoccurringBlockEventEntry $reoccuringBlockEventId for block $blockId");
  412. }
  413. }
  414. /**
  415. * This will cancel the reservation and send out emails.
  416. *
  417. */
  418. function cancelReservation($time, $courtId) {
  419. if (isDebugEnabled(2)) logMessage("event_load.cancelReservation for $time, $courtid");
  420. //Get the type of reservation (singles, doubles, event)
  421. $reservationTypeQuery = "SELECT * from tblReservations where enddate IS NULL
  422. AND time = $time AND courtId = $courtId";
  423. $reservationResult = db_query($reservationTypeQuery);
  424. $reservationArray = mysqli_fetch_array($reservationResult);
  425. //End Date the Reservation
  426. $endDateRservationQuery = "UPDATE tblReservations SET enddate = NOW()
  427. WHERE time = $time
  428. AND courtid = $courtId
  429. AND enddate is NULL";
  430. $reservationResult = db_query($endDateRservationQuery);
  431. //Dont' send out emails for events
  432. if ($reservationArray['eventid'] > 0) {
  433. return;
  434. }
  435. //Send out the email
  436. if ($reservationArray['usertype'] == 0) {
  437. if (isDebugEnabled(2)) logMessage("\t-> Sending out emails for singles cancelation");
  438. cancel_singles($reservationArray['reservationid']);
  439. } else
  440. if ($reservationArray['usertype'] == 1) {
  441. if (isDebugEnabled(2)) logMessage("\t-> Sending out emails for doubles cancelation");
  442. cancel_doubles($reservationArray['reservationid']);
  443. }
  444. }
  445. ?>