PDA

View Full Version : ugh


jason
12-21-2007, 03:48 PM
I dont know what I did but I broke something, I pretty much had everything working the way I wanted and all of the sudden I started getting this as soon as a staff member logs in:[SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.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] - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '4) OR ticket.staff_id=4) AND status='Open' AND (ticket.staff_id=0 OR ticket.staf' at line 1

I think the problem is in tickits.inc.php but I dont even think I touched this file.

Any help would be appreciated.

Jason

dElo
12-21-2007, 05:30 PM
SELECT ticket.ticket_id,lock_id,ticketID,ticket.dept_id,t icket.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. :)

jason
12-21-2007, 06:03 PM
Im pretty sure the query is built by ticket.inc.php I need to see if I can find where the IN is put into the string.

jason
12-21-2007, 06:19 PM
ok on line 66 of tickets.inc.php there is this

$qwhere =' WHERE (ticket.dept_id IN ('.implode(',',$depts).') OR ticket.staff_id='.$thisuser->getId().')';

I changed it to this:
$qwhere =' WHERE (ticket.dept_id IN ('.implode($depts).') OR ticket.staff_id='.$thisuser->getId().')';

and everything works, but it seems like that comma must have been there for some reason.

Ill let you know if there are more problems.

Jason

peter
12-21-2007, 07:07 PM
Jason,

I guess you are in the school of "don't find the root cause just make it work!" Joking a side your "fix" will have issues as soon the user's group is given access to more departments.

What did you change to cause the error and why?

jason
12-22-2007, 09:56 AM
Im not sure what I changed, i was just doing some small customization, I commented out the directory and knowledge base tab, changed the wording on some stuff, things like that.

When I was trying to fix it I reuploaded the entire includes directory and the includes/staff directory and that didnt fix the problem.


Im not much of a programmer I just kind of hack at stuff until I get it to work like i want.