SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,ticket.staff_id,subject,name,email,dept_name ,status,source,isoverdue,ticket.created,pri.* FROM ost_ticket ticket LEFT JOIN ost_department dept ON ticket.dept_id=dept.dept_id LEFT JOIN ost_ticket_priority pri ON ticket.priority_id=pri.priority_id LEFT JOIN ost_ticket_lock tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() WHERE (ticket.dept_id IN (4) OR ticket.staff_id=4) AND status='Open' AND (ticket.staff_id=0 OR ticket.staff_id=4 OR dept.manager_id=4) ORDER BY priority_urgency,ticket.created DESC LIMIT 0,25
Thats the query that it should be doing, there was an extra coma in the IN syntax, check your code and replace that value.
Give me a yell if you don't know how to do that, I haven't gotten to read through the code enough to tell you where is that from. :)