From: Jan Schneider Date: Wed, 25 Feb 2009 17:42:39 +0000 (+0100) Subject: MFB: If updating a calendar event fails, try to import it instead (Bug #7589). X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=a5c8a2bfb38d3cc178709a8150e705db81f7cdbf;p=horde.git MFB: If updating a calendar event fails, try to import it instead (Bug #7589). --- diff --git a/imp/docs/CHANGES b/imp/docs/CHANGES index 8e4a21615..06f22dbd5 100644 --- a/imp/docs/CHANGES +++ b/imp/docs/CHANGES @@ -57,6 +57,7 @@ v5.0-git v4.3.4-cvs ---------- +[jan] If updating a calendar event fails, try to import it instead (Bug #7589). [mms] Fix [un]escaping of various URLs on message screen caused by security fixes in v4.3.3 (Bug #7926). [mms] Add hook to allow hiding of IMAP folders (Request #7353, Gunnar diff --git a/imp/lib/Mime/Viewer/itip.php b/imp/lib/Mime/Viewer/itip.php index 93f57ff6e..46518d4f7 100644 --- a/imp/lib/Mime/Viewer/itip.php +++ b/imp/lib/Mime/Viewer/itip.php @@ -140,30 +140,30 @@ class IMP_Horde_Mime_Viewer_itip extends Horde_Mime_Viewer_Driver // Check if this is an update. if ($registry->hasMethod('calendar/export') && !is_a($registry->call('calendar/export', array($guid, 'text/calendar')), 'PEAR_Error')) { - // Update in Kronolith. + // Try to update in calendar. if ($registry->hasMethod('calendar/replace')) { - $handled = true; $result = $registry->call('calendar/replace', array('uid' => $guid, 'content' => $components[$key], 'contentType' => $this->mime_part->getType())); if (is_a($result, 'PEAR_Error')) { - $msgs[] = array('error', _("There was an error updating the event:") . ' ' . $result->getMessage()); + // Could be a missing permission. + $msgs[] = array('warning', _("There was an error updating the event:") . ' ' . $result->getMessage() . '. ' . _("Trying to import the event instead.")); } else { + $handled = true; $url = Horde::url($registry->link('calendar/show', array('uid' => $guid))); $msgs[] = array('success', _("The event was updated in your calendar.") . ' ' . Horde::link($url, _("View event"), null, '_blank') . Horde::img('mime/icalendar.png', _("View event"), null, $registry->getImageDir('horde')) . ''); } } - } else { - // Import into Kronolith. - if ($registry->hasMethod('calendar/import')) { - $handled = true; - $guid = $registry->call('calendar/import', array('content' => $components[$key], 'contentType' => $this->mime_part->getType())); - if (is_a($guid, 'PEAR_Error')) { - $msgs[] = array('error', _("There was an error importing the event:") . ' ' . $guid->getMessage()); - } else { - $url = Horde::url($registry->link('calendar/show', array('uid' => $guid))); - $msgs[] = array('success', _("The event was added to your calendar.") . - ' ' . Horde::link($url, _("View event"), null, '_blank') . Horde::img('mime/icalendar.png', _("View event"), null, $registry->getImageDir('horde')) . ''); - } + } + if (!$handled && $registry->hasMethod('calendar/import')) { + // Import into calendar. + $handled = true; + $guid = $registry->call('calendar/import', array('content' => $components[$key], 'contentType' => $this->mime_part->getType())); + if (is_a($guid, 'PEAR_Error')) { + $msgs[] = array('error', _("There was an error importing the event:") . ' ' . $guid->getMessage()); + } else { + $url = Horde::url($registry->link('calendar/show', array('uid' => $guid))); + $msgs[] = array('success', _("The event was added to your calendar.") . + ' ' . Horde::link($url, _("View event"), null, '_blank') . Horde::img('mime/icalendar.png', _("View event"), null, $registry->getImageDir('horde')) . ''); } } if (!$handled) {