Skip to content
Snippets Groups Projects
Commit 2fecfe80 authored by Jared Hancock's avatar Jared Hancock
Browse files

Fetch thread before deleting ticket

parent 31bb4ac0
No related branches found
No related tags found
No related merge requests found
...@@ -1670,12 +1670,15 @@ class Ticket { ...@@ -1670,12 +1670,15 @@ class Ticket {
function delete() { function delete() {
//delete just orphaned ticket thread & associated attachments.
// Fetch thread prior to removing ticket entry
$t = $this->getThread();
$sql = 'DELETE FROM '.TICKET_TABLE.' WHERE ticket_id='.$this->getId().' LIMIT 1'; $sql = 'DELETE FROM '.TICKET_TABLE.' WHERE ticket_id='.$this->getId().' LIMIT 1';
if(!db_query($sql) || !db_affected_rows()) if(!db_query($sql) || !db_affected_rows())
return false; return false;
//delete just orphaned ticket thread & associated attachments. $t->delete();
$this->getThread()->delete();
foreach (DynamicFormEntry::forTicket($this->getId()) as $form) foreach (DynamicFormEntry::forTicket($this->getId()) as $form)
$form->delete(); $form->delete();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment