diff --git a/include/class.ticket.php b/include/class.ticket.php index 26f3312dbb40eab39f7753ff19c544b84fd43cc4..faa95986b396c64e9656d9ef3b9f57e745b8c9d5 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -837,6 +837,10 @@ class Ticket { if (!$status || !$status instanceof TicketStatus) return false; + // XXX: intercept deleted status and do hard delete + if (!strcasecmp($status->getState(), 'deleted')) + return $this->delete($comments); + if ($this->getStatusId() == $status->getId()) return true; @@ -2025,7 +2029,8 @@ class Ticket { exit; } - function delete() { + function delete($comments='') { + global $ost, $thisstaff; //delete just orphaned ticket thread & associated attachments. // Fetch thread prior to removing ticket entry @@ -2042,6 +2047,18 @@ class Ticket { $this->deleteDrafts(); + // Log delete + $log = sprintf(__('Ticket #%1$s deleted by %2$s'), + $this->getNumber(), + $thisstaff ? $thisstaff->getName() : __('SYSTEM')); + + if ($comments) + $log .= sprintf('<hr>%s', $comments); + + $ost->logDebug( + sprintf( __('Ticket #%s deleted'), $this->getNumber()), + $log); + return true; } diff --git a/scp/js/ticket.js b/scp/js/ticket.js index afbf1ecc9c53b73703f33e0839f8ed5808f36b8a..ca5f3957e25da6f1218aa102e27725f6c51b17e3 100644 --- a/scp/js/ticket.js +++ b/scp/js/ticket.js @@ -396,8 +396,9 @@ var ticket_onload = function($) { var url = 'ajax.php/' +$(this).attr('href').substr(1) +'?_uid='+new Date().getTime(); + var $redirect = $(this).data('href'); $.dialog(url, [201], function (xhr) { - window.location.href = window.location.href; + window.location.href = $redirect ? $redirect : window.location.href; }); return false;