Revision: 1236
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1236&view=rev
Author:   cimorrison
Date:     2009-11-02 14:44:47 +0000 (Mon, 02 Nov 2009)

Log Message:
-----------
Fixed a bug which meant that for weekly and n-weekly bookings the first day of 
the period was booked when it should not have been because one or more of the 
repeat days had been checked - but not the day of the week of the start of the 
period.  For example if you request a weekly repeat from 1-30 November 2009 for 
Thursdays, then the 1 Nov was also being booked when it should not have been 
because it's a Sunday.   (Problem reported by Randy Allen on the general 
mailing list).

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

Modified: mrbs/trunk/web/mrbs_sql.inc
===================================================================
--- mrbs/trunk/web/mrbs_sql.inc 2009-11-01 20:13:02 UTC (rev 1235)
+++ mrbs/trunk/web/mrbs_sql.inc 2009-11-02 14:44:47 UTC (rev 1236)
@@ -361,7 +361,7 @@
   $start_day = date('w', mktime($hour, $min, $sec, $month, $day, $year));
   $cur_day = $start_day;
 
-  $entrys = "";
+  $entrys = array();
   for ($i = 0; $i < $max_ittr; $i++)
   {
     $time = mktime($hour, $min, $sec, $month, $day, $year);
@@ -433,6 +433,20 @@
         return;
     }
   }
+  
+  // For weekly and n-weekly repeats, the first entry that we've
+  // got in the array is not necessarily valid.   In fact it will
+  // only be valid if there are no repeat days defined, or else 
+  // if the first entry falls on a repeat day.  (In MRBS, if you
+  // don't specify a repeat day or days, then the repeat day is
+  // assumed to be the day of the start of the series.)
+  if (($rep_type == 2) || ($rep_type == 6))
+  {
+    if ((strpos($rep_opt, '1') !== FALSE) && !$rep_opt[$start_day])
+    {
+      array_shift($entrys);  // remove the first entry
+    }
+  }
 
   return $entrys;
 }


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

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to