Title: SF.net SVN: mrbs:[2453] mrbs/branches/flexible_day_end/web/edit_entry_handler.php
Revision
2453
Author
cimorrison
Date
2012-10-02 16:51:17 +0000 (Tue, 02 Oct 2012)

Log Message

Fixed bug with creating bookings spanning midnight when multiday bookings are not allowed

Modified Paths

Diff

Modified: mrbs/branches/flexible_day_end/web/edit_entry_handler.php (2452 => 2453)


--- mrbs/branches/flexible_day_end/web/edit_entry_handler.php	2012-10-02 15:29:25 UTC (rev 2452)
+++ mrbs/branches/flexible_day_end/web/edit_entry_handler.php	2012-10-02 16:51:17 UTC (rev 2453)
@@ -5,6 +5,13 @@
 require_once "mrbs_sql.inc";
 require_once "functions_ical.inc";
 
+// Check the user is authorised for this page
+checkAuthorised();
+
+// Also need to know whether they have admin rights
+$user = getUserName();
+$is_admin = (authGetUserLevel($user) >= 2);
+
 // NOTE:  the code on this page assumes that array form variables are passed
 // as an array of values, rather than an array indexed by value.   This is
 // particularly important for checkbox arrays whicgh should be formed like this:
@@ -121,6 +128,15 @@
   $room = get_default_room($area);
 }
 
+// If they're not an admin and multi-day bookings are not allowed, then
+// set the end date to the start date
+if (!$is_admin && $auth['only_admin_can_book_multiday'])
+{
+  $end_day = $start_day;
+  $end_month = $start_month;
+  $end_year = $start_year;
+}
+
 // If this is an Ajax request and we're being asked to commit the booking, then
 // we'll only have been supplied with parameters that need to be changed.  Fill in
 // the rest from the existing boking information.
@@ -323,22 +339,6 @@
   $isprivate = ($private) ? TRUE : FALSE;
 }
 
-// Check the user is authorised for this page
-checkAuthorised();
-
-// Also need to know whether they have admin rights
-$user = getUserName();
-$is_admin = (authGetUserLevel($user) >= 2);
-
-// If they're not an admin and multi-day bookings are not allowed, then
-// set the end date to the start date
-if (!$is_admin && $auth['only_admin_can_book_multiday'])
-{
-  $end_day = $day;
-  $end_month = $month;
-  $end_year = $year;
-}
-
 // Check to see whether this is a repeat booking and if so, whether the user
 // is allowed to make/edit repeat bookings.   (The edit_entry form should
 // prevent you ever getting here, but this check is here as a safeguard in 
------------------------------------------------------------------------------
Don't let slow site performance ruin your business. Deploy New Relic APM
Deploy New Relic app performance management and know exactly
what is happening inside your Ruby, Python, PHP, Java, and .NET app
Try New Relic at no cost today and get our sweet Data Nerd shirt too!
http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to