Changeset:
        e5cec8ee77b5
        
https://sourceforge.net/p/mrbs/hg-code/ci/e5cec8ee77b5be50170c8c219d91c7b00318f0eb
Author:
        Campbell Morrison <[email protected]>
Date:
        Wed Jan 18 10:04:26 2017 +0000
Log message:

Made sure that the default duration for new bookings doesn't exceed the maximum 
duration

diffstat:

 web/edit_entry.php |  16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 616210bd53b6 -r e5cec8ee77b5 web/edit_entry.php
--- a/web/edit_entry.php        Tue Jan 17 10:46:36 2017 +0000
+++ b/web/edit_entry.php        Wed Jan 18 10:04:26 2017 +0000
@@ -942,11 +942,21 @@
   }
   else
   {
-    if (!isset($default_duration))
+    // Set the duration
+    if ($enable_periods)
     {
-      $default_duration = SECONDS_PER_HOUR;
+      $duration = 60;  // one period
     }
-    $duration    = ($enable_periods ? 60 : $default_duration);
+    else
+    {
+      $duration = (isset($default_duration)) ? $default_duration : 
SECONDS_PER_HOUR;
+    }
+    
+    // Make sure the duration doesn't exceed the maximum
+    if (!$is_admin && $max_duration_enabled)
+    {
+      $duration = min($duration, (($enable_periods) ? $max_duration_periods : 
$max_duration_secs));
+    }
     
     // If the duration is not an integral number of slots, then make
     // it so.   And make the duration at least one slot long.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to