Need to allow for removing all attendees when using the ajax interface
authorMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 10 Mar 2010 20:15:28 +0000 (15:15 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Wed, 10 Mar 2010 20:15:28 +0000 (15:15 -0500)
kronolith/lib/Event.php

index 8f64c11..69d9402 100644 (file)
@@ -1618,14 +1618,24 @@ abstract class Kronolith_Event
         $this->status = Horde_Util::getFormData('status', $this->status);
 
         // Attendees.
+        $attendees = Horde_Util::getFormData('attendees');
         if (isset($_SESSION['kronolith']['attendees']) && is_array($_SESSION['kronolith']['attendees'])) {
             $this->attendees = $_SESSION['kronolith']['attendees'];
-        }
-        if ($attendees = Horde_Util::getFormData('attendees')) {
-            $attendees = Kronolith::parseAttendees(trim($attendees));
             if ($attendees) {
-                $this->attendees = $attendees;
+                if ($attendees = Kronolith::parseAttendees(trim($attendees))) {
+                    $this->attendees = $attendees;
+                }
             }
+        } else {
+            if ($attendees) {
+                if ($attendees = Kronolith::parseAttendees(trim($attendees))) {
+                    $this->attendees = $attendees;
+                }
+            } else {
+                $attendees = array();
+            }
+
+            $this->attendees = $attendees;
         }
 
         // Resources