Changeset:
        342f4bafa72b
        
https://sourceforge.net/p/mrbs/hg-code/ci/342f4bafa72bb73a3b4510db6ce79a078c27f02b
Author:
        Campbell Morrison <[email protected]>
Date:
        Mon Jan 18 20:54:54 2016 +0000
Log message:

Fixed bug causing a booking to be made even if the specified repeat results in 
no bookings (eg a weekly repeat for Thursdays starting and ending on the same 
day, which isn't a Thursday)

diffstat:

 web/mrbs_sql.inc |  24 ++++++++++--------------
 1 files changed, 10 insertions(+), 14 deletions(-)

diffs (46 lines):

diff -r c07bd1ce42c0 -r 342f4bafa72b web/mrbs_sql.inc
--- a/web/mrbs_sql.inc  Sun Jan 17 20:29:33 2016 +0000
+++ b/web/mrbs_sql.inc  Mon Jan 18 20:54:54 2016 +0000
@@ -989,17 +989,21 @@
                                  $rep_details,
                                  $max_rep_entrys);
 
-  // Don't make any bookings if we've been asked to book up
-  // more entries than we are allowed in a single repeat.
-  if (count($reps) > $max_rep_entrys)
+  // Don't make any bookings if 
+  // (a) we've been asked to book up more entries than we are
+  //     allowed in a single repeat, or
+  // (b) the repeat results in an empty set, or
+  // (c) we've got to skip past all the entries
+  if ((count($reps) > $max_rep_entrys) ||
+      (count($reps) == 0) ||
+      (count($reps) == count($data['skip_list'])))
   {
     $result['id'] = 0;
     return $result;;
   }
   
-  // If $reps is empty, then this is a single booking, so treat
-  // it differently
-  if (empty($reps))
+  // If this is just a single booking, treat it differently
+  if (count($reps) == 1)
   {
     $data['entry_type'] = ENTRY_SINGLE;
     $data['repeat_id'] = NULL;
@@ -1010,14 +1014,6 @@
     return $result;
   }
   
-  // This is a repeat booking.   If we've got to skip past all
-  // the entries, then don't make a booking!
-  if (count($reps) == count($data['skip_list']))
-  {
-    $result['id'] = 0;
-    return $result;;
-  }
-  
   // Maybe one should also consider adjusting the start_time for
   // the repeat if the first (or more) entries of the series are
   // to be skipped.    However I haven't done so here and it gives the

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to