From 28557b6800f6ec78389cfc22b2e3cd799e54ae2b Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Tue, 15 Jun 2010 22:08:35 +0200 Subject: [PATCH] Fix saving copies if using different drivers for original and new calendar, or if not having edit pemissions on the original calendar. --- kronolith/lib/Ajax/Application.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/kronolith/lib/Ajax/Application.php b/kronolith/lib/Ajax/Application.php index 995154303..33b48a210 100644 --- a/kronolith/lib/Ajax/Application.php +++ b/kronolith/lib/Ajax/Application.php @@ -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; -- 2.11.0