Title: SF.net SVN: mrbs:[2444] mrbs/branches/flexible_day_end/web/edit_entry_handler.php
Revision
2444
Author
cimorrison
Date
2012-09-27 15:57:47 +0000 (Thu, 27 Sep 2012)

Log Message

Fixed bug causing the wrong length booking to be made when All Day is checked and the booking day spans midnight

Modified Paths

Diff

Modified: mrbs/branches/flexible_day_end/web/edit_entry_handler.php (2443 => 2444)


--- mrbs/branches/flexible_day_end/web/edit_entry_handler.php	2012-09-27 15:24:40 UTC (rev 2443)
+++ mrbs/branches/flexible_day_end/web/edit_entry_handler.php	2012-09-27 15:57:47 UTC (rev 2444)
@@ -197,6 +197,24 @@
   }
 }
 
+// When All Day is checked, $start_seconds and $end_seconds are disabled and so won't
+// get passed through by the form.   We therefore need to set them.
+if (!empty($all_day))
+{
+  if ($enable_periods)
+  {
+    $start_seconds = 12 * 60 * 60;
+    // This is actually the start of the last period, which is what the form would
+    // have returned.   It will get corrected in a moment.
+    $end_seconds = $start_seconds + ((count($periods) - 1) * 60);
+  }
+  else
+  {
+    $start_seconds = (($morningstarts * 60) + $morningstarts_minutes) * 60;
+    $end_seconds = (($eveningends * 60) + $eveningends_minutes) *60;
+    $end_seconds += $resolution;  // We want the end of the last slot, not the beginning
+  }
+}
 
 // If we're operating on a booking day that stretches past midnight, it's more convenient
 // for the sections past midnight to be shown as being on the day before.  That way the
@@ -425,25 +443,6 @@
   $resolution = 60;
 }
 
-// When All Day is checked, $start_seconds and $end_seconds are disabled and so won't
-// get passed through by the form.   We therefore need to set them.
-if (!empty($all_day))
-{
-  if ($enable_periods)
-  {
-    $start_seconds = 12 * 60 * 60;
-    // This is actually the start of the last period, which is what the form would
-    // have returned.   It will get corrected in a moment.
-    $end_seconds = $start_seconds + ((count($periods) - 1) * 60);
-  }
-  else
-  {
-    $start_seconds = (($morningstarts * 60) + $morningstarts_minutes) * 60;
-    $end_seconds = (($eveningends * 60) + $eveningends_minutes) *60;
-    $end_seconds += $resolution;  // We want the end of the last slot, not the beginning
-  }
-}
-
 // Now work out the start and times
 $starttime = mktime(0, 0, $start_seconds, $start_month, $start_day, $start_year);
 $endtime   = mktime(0, 0, $end_seconds, $end_month, $end_day, $end_year);
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to