$ticket = Whups::getCurrentTicket(); $page_output->addLinkTag($ticket->feedLink()); $details = $ticket->getDetails(); if (!Whups::hasPermission($details['queue'], 'queue', Horde_Perms::DELETE)) { $notification->push(_("Permission Denied"), 'horde.error'); Horde::url($prefs->getValue('whups_default_view') . '.php', true)->redirect(); } Whups::addTopbarSearch(); $vars = Horde_Variables::getDefaultVariables(); $vars->set('id', $id = $ticket->getId()); foreach ($details as $varname => $value) { $vars->add($varname, $value); } $title = sprintf(_("Delete %s?"), '[#' . $id . '] ' . $ticket->get('summary')); $deleteform = new Whups_Form_Ticket_Delete($vars, $title); if ($vars->get('formname') == 'whups_form_ticket_delete' && $deleteform->validate($vars)) { if ($vars->get('submitbutton') == _("Delete")) { $deleteform->getInfo($vars, $info); try { $ticket->delete(); $notification->push(sprintf(_("Ticket %d has been deleted."), $info['id']), 'horde.success'); Horde::url($prefs->getValue('whups_default_view') . '.php', true)->redirect(); } catch (Whups_Exception $e) { $notification->push(_("There was an error deleting the ticket:") . ' ' . $e->getMessage(), 'horde.error'); } catch (Horde_Exception_NotFound $e) { $notification->push(sprintf(_("Ticket %d not found."), $info['id'])); } } else { $notification->push(_("The ticket was not deleted."), 'horde.message'); } }
$page_output->addLinkTag($ticket->feedLink()); $details = $ticket->getDetails(); if (!Whups::hasPermission($details['queue'], 'queue', Horde_Perms::DELETE)) { $notification->push(_("Permission Denied"), 'horde.error'); Horde::url($prefs->getValue('whups_default_view') . '.php', true)->redirect(); } Whups::addTopbarSearch(); $vars = Horde_Variables::getDefaultVariables(); $vars->set('id', $id = $ticket->getId()); foreach ($details as $varname => $value) { $vars->add($varname, $value); } $title = sprintf(_("Delete %s?"), '[#' . $id . '] ' . $ticket->get('summary')); $deleteform = new Whups_Form_Ticket_Delete($vars, $title); if ($vars->get('formname') == 'whups_form_ticket_delete') { if ($deleteform->validate($vars)) { if ($vars->get('yesno') == 1) { $deleteform->getInfo($vars, $info); try { $ticket->delete(); $notification->push(sprintf(_("Ticket %d has been deleted."), $info['id']), 'horde.success'); Horde::url($prefs->getValue('whups_default_view') . '.php', true)->redirect(); } catch (Whups_Exception $e) { $notification->push(_("There was an error deleting the ticket:") . ' ' . $e->getMessage(), 'horde.error'); } catch (Horde_Exception_NotFound $e) { $notification->push(sprintf(_("Ticket %d not found."), $info['id'])); } } else { $notification->push(_("The ticket was not deleted."), 'horde.message'); } }