// Execute if the form is valid (must pass with POST variables only).
if ($form->validate(new Horde_Variables($_POST))) {
- $result = $form->execute();
- if ($result instanceof PEAR_Error) {
- $notification->push($result, 'horde.error');
- } elseif ($result) {
+ try {
+ $result = $form->execute();
$notification->push(sprintf(_("The addressbook \"%s\" has been deleted."), $addressbook->get('name')), 'horde.success');
+ } catch (Turba_Exception $e) {
+ $notification->push($result, 'horde.error');
}
Horde::url('addressbooks/', true)->redirect();
// Execute if the form is valid.
if ($form->validate($vars)) {
$original_name = $addressbook->get('name');
- $result = $form->execute();
- if ($result instanceof PEAR_Error) {
- $notification->push($result, 'horde.error');
- } else {
+ try {
+ $result = $form->execute();
if ($addressbook->get('name') != $original_name) {
$notification->push(sprintf(_("The addressbook \"%s\" has been renamed to \"%s\"."), $original_name, $addressbook->get('name')), 'horde.success');
} else {
$notification->push(sprintf(_("The addressbook \"%s\" has been saved."), $original_name), 'horde.success');
}
+ } catch (Turba_Exception $e) {
+ $notification->push($result, 'horde.error');
}
Horde::url('addressbooks/', true)->redirect();
}
/* Execute() checks validation first. */
-$edited = $form->execute();
-if (!($edited instanceof PEAR_Error)) {
- $url = Horde_Util::getFormData('url');
- if (empty($url)) {
- $url = $contact->url('Contact', true);
- } else {
- $url = new Horde_Url($url, true);
- }
- $url->unique()->redirect();
+try {
+ $edited = $form->execute();
+} catch (Turba_Exception $e) {
}
+$url = Horde_Util::getFormData('url');
+if (empty($url)) {
+ $url = $contact->url('Contact', true);
+} else {
+ $url = new Horde_Url($url, true);
+}
+$url->unique()->redirect();
+
$title = sprintf(_("Edit \"%s\""), $contact->getValue('name'));
require $registry->get('templates', 'horde') . '/common-header.inc';
function execute()
{
$result = parent::execute();
- if ($result instanceof PEAR_Error) {
- return $result;
- }
$this->getInfo($this->_vars, $info);