Am I missing something here? This was working until just an hour ago or so.
Ideally what I would like is for only the assigned tickets you have that are OPEN to show up under "My Tickets".
The following command is what is running:
Code:
SELECT DISTINCT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,ticket.staff_id,subject,name,ticket.email,dept_name,staff.firstname,staff.lastname ,ticket.status,ticket.source,isoverdue,ticket.created,pri.*,CASE WHEN status = "open" THEN FLOOR(TIME_TO_SEC(TIMEDIFF(now(),ticket.created))/60) ELSE FLOOR(TIME_TO_SEC(TIMEDIFF(ticket.closed,ticket.created))/60) END AS timeopen,count(attach.attach_id) as attachments ,count(attach.attach_id) as attachments FROM ost_ticket ticket LEFT JOIN ost_department dept ON ticket.dept_id=dept.dept_id LEFT JOIN ost_staff staff ON ticket.staff_id=staff.staff_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() LEFT JOIN ost_ticket_attachment attach ON ticket.ticket_id=attach.ticket_id WHERE 1 AND ticket.staff_id=1 GROUP BY ticket.ticket_id ORDER BY priority_urgency,ticket.created DESC LIMIT 0,35
the most important part being:
Code:
CASE WHEN status = "open"
Oddly this shows the correct NUMBER of tickets in My Tickets (#). But then its listing all of my tickets, regardless if they are open or closed. I even ran the command manually from phpmyadmin and it shows the same results (duh) and of course the status there shows open, closed, closed, closed. I thought I had also set this somewhere else in another file but I can't seem to find that now either to troubleshoot it.
Any help?