Need to move this comparison after the loop.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sat, 12 Sep 2009 16:20:54 +0000 (12:20 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 29 Sep 2009 20:53:55 +0000 (16:53 -0400)
If we are editing an event that was already accepted, we might hit max_reservations
before we get to the event we are editing.

kronolith/lib/Resource/Single.php

index f686b4a..55f2304 100644 (file)
@@ -46,17 +46,13 @@ class Kronolith_Resource_Single extends Kronolith_Resource_Base
                      if (!($e->start->compareDateTime($event->end) >= 1 ||
                          $e->end->compareDateTime($event->start) <= -1)) {
 
-                         /* Conflict, but check to see if we are allowed mulitiple */
-                         if (++$conflicts >= $this->get('max_reservations')) {
-                            return false;
-                         }
-
+                         $conflicts++;
                      }
                 }
             }
         }
 
-        return true;
+        return ($conflicts < $this->get('max_reservations'));
     }
 
     /**