Changeset:
        dbc0e7ea98f7
        
https://sourceforge.net/p/mrbs/hg-code/ci/dbc0e7ea98f772118424f77955f8fc5db9fe7133
Author:
        Campbell Morrison <[email protected]>
Date:
        Sat Nov 14 16:57:15 2015 +0000
Log message:

Fixed a problem with the end time not being selected on the booking form if the 
default duration is not an integral number of slots

diffstat:

 web/edit_entry.php |  10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diffs (20 lines):

diff -r 67bb72966a5a -r dbc0e7ea98f7 web/edit_entry.php
--- a/web/edit_entry.php        Fri Nov 13 18:48:49 2015 +0000
+++ b/web/edit_entry.php        Sat Nov 14 16:57:15 2015 +0000
@@ -943,6 +943,16 @@
       $default_duration = SECONDS_PER_HOUR;
     }
     $duration    = ($enable_periods ? 60 : $default_duration);
+    
+    // If the duration is not an integral number of slots, then make
+    // it so.   And make the duration at least one slot long.
+    if ($duration%$resolution != 0)
+    {
+      $duration = intval(round($duration/$resolution));
+      $duration = max(1, $duration);
+      $duration = $duration * $resolution;
+    }
+    
     $end_time = $start_time + $duration;
     // The end time can't be past the end of the booking day
     $pm7 = get_start_last_slot($month, $day, $year);

------------------------------------------------------------------------------
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to