Skip to content
Snippets Groups Projects
Commit fd40f882 authored by Peter Rotich's avatar Peter Rotich
Browse files

Change last message lookup to use ticket_id instead of external ticket

id/number.

* Ticket number will be customization in the future
* Ticket thread only link to Ticket should be internal ticket id.
parent a3dd33d7
No related branches found
No related tags found
No related merge requests found
...@@ -783,15 +783,16 @@ class Message extends ThreadEntry { ...@@ -783,15 +783,16 @@ class Message extends ThreadEntry {
)?$m:null; )?$m:null;
} }
function lastByExtTicketId($ticketId) { function lastByTicketId($ticketId) {
$sql = 'SELECT thread.id FROM '.TICKET_THREAD_TABLE
.' thread JOIN '.TICKET_TABLE.' ticket ON (ticket.ticket_id = thread.ticket_id) $sql=' SELECT thread.id FROM '.TICKET_THREAD_TABLE.' thread '
WHERE thread_type=\'M\' AND ticket.ticketID = '.db_input($ticketId) .' WHERE thread_type=\'M\' AND thread.ticket_id = '.db_input($ticketId)
.' ORDER BY thread.id DESC LIMIT 1'; .' ORDER BY thread.id DESC LIMIT 1';
if (($res = db_query($sql)) && (list($id) = db_fetch_row($res)))
if (($res = db_query($sql)) && ($id = db_result($res)))
return Message::lookup($id); return Message::lookup($id);
else
return null; return null;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment