Fix saving copies if using different drivers for original and new calendar, or
authorJan Schneider <jan@horde.org>
Tue, 15 Jun 2010 20:08:35 +0000 (22:08 +0200)
committerJan Schneider <jan@horde.org>
Tue, 15 Jun 2010 20:08:35 +0000 (22:08 +0200)
if not having edit pemissions on the original calendar.

kronolith/lib/Ajax/Application.php

index 9951543..33b48a2 100644 (file)
@@ -139,15 +139,20 @@ class Kronolith_Ajax_Application extends Horde_Ajax_Application_Base
             }
         }
 
-        try {
-            $event = $kronolith_driver->getEvent($this->_vars->event);
-        } catch (Horde_Exception_NotFound $e) {
-            $GLOBALS['notification']->push(_("The requested event was not found."), 'horde.error');
-            return $result;
-        } catch (Exception $e) {
-            $GLOBALS['notification']->push($e);
-            return $result;
+        if ($this->_vars->as_new) {
+            $event = $kronolith_driver->getEvent();
+        } else {
+            try {
+                $event = $kronolith_driver->getEvent($this->_vars->event);
+            } catch (Horde_Exception_NotFound $e) {
+                $GLOBALS['notification']->push(_("The requested event was not found."), 'horde.error');
+                return $result;
+            } catch (Exception $e) {
+                $GLOBALS['notification']->push($e);
+                return $result;
+            }
         }
+
         if (!$event->hasPermission(Horde_Perms::EDIT)) {
             $GLOBALS['notification']->push(_("You do not have permission to edit this event."), 'horde.warning');
             return $result;