Revision: 1854
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1854&view=rev
Author:   cimorrison
Date:     2011-07-27 13:14:25 +0000 (Wed, 27 Jul 2011)

Log Message:
-----------
Allowed entries to be deleted even if they are longer than the max_duration or 
beyond the max_book_ahead date.   Following suggestion from Marco Tedaldi

Modified Paths:
--------------
    mrbs/trunk/web/areadefaults.inc.php
    mrbs/trunk/web/mrbs_sql.inc

Modified: mrbs/trunk/web/areadefaults.inc.php
===================================================================
--- mrbs/trunk/web/areadefaults.inc.php 2011-07-22 21:33:38 UTC (rev 1853)
+++ mrbs/trunk/web/areadefaults.inc.php 2011-07-27 13:14:25 UTC (rev 1854)
@@ -101,7 +101,10 @@
 // minimum advance booking time allows you to set a policy saying that users 
must book
 // at least so far in advance.  The maximum allows you to set a policy saying 
that they cannot
 // book more than so far in advance.  How the times are determined depends on 
whether Periods
-// or Times are being used.   These settings also apply to the deletion of 
bookings.
+// or Times are being used.   The min_book_ahead settings also apply to the 
deletion of bookings
+// (to prevent users deleting bookings that have taken place and trying to 
avoid being charged; if
+// it's a booking in the future past the max_book_ahead time then presumaly 
nobody minds if the
+// booking is deleted)
 
 // DEFAULT VALUES FOR NEW AREAS
 $min_book_ahead_enabled = FALSE;    // set to TRUE to enforce a minimum 
advance booking time

Modified: mrbs/trunk/web/mrbs_sql.inc
===================================================================
--- mrbs/trunk/web/mrbs_sql.inc 2011-07-22 21:33:38 UTC (rev 1853)
+++ mrbs/trunk/web/mrbs_sql.inc 2011-07-27 13:14:25 UTC (rev 1854)
@@ -136,8 +136,9 @@
     }
   }
   
-  // Check max_book_ahead
-  if ($max_book_ahead_enabled)
+  // Check max_book_ahead (but not if we're deleting a booking because
+  // nobody's going to mind if a booking beyond the max_book_ahead date is 
deleted)
+  if ($max_book_ahead_enabled && !$delete)
   {
     if ($enable_periods)
     {
@@ -151,8 +152,8 @@
     }
   }
   
-  // Check max_duration
-  if ($max_duration_enabled)
+  // Check max_duration (but not if we're deleting a booking)
+  if ($max_duration_enabled && !$delete)
   {
     if ($enable_periods)
     {
@@ -216,7 +217,7 @@
   
   $is_book_admin = auth_book_admin($user, $room_id);
 
-  $sql = "SELECT start_time, create_by, id, entry_type FROM $tbl_entry WHERE ";
+  $sql = "SELECT start_time, end_time, create_by, id, entry_type FROM 
$tbl_entry WHERE ";
    
   if ($series)
   {
@@ -246,7 +247,11 @@
     // check that the booking policies allow us to delete this entry
     if (!$is_book_admin)
     {
-      $tmp = mrbsCheckPolicy($row['start_time'], TRUE);
+      // We supply the duration as a parameter to mrbsCheckPolicy, even though
+      // it's not normally needed - but it may be in the future
+      $tmp = mrbsCheckPolicy($row['start_time'], 
+                             $row['end_time'] - $row['start_time'],
+                             TRUE);
       if (!empty($tmp))
       {
         continue;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to