PDA

View Full Version : [MOD FIX] Wrong number of tickets showing


webPragmatist
09-04-2008, 12:42 PM
I'm not sure which of my MODs (lost track) causes this but if you are experiencing problems with your system showing the wrong number of tickets in the ticket view you can try this:

Change (~line 176):
//get ticket count based on the query so far..
$total=db_count("SELECT count(*) $qfrom $qwhere");

To:
//get ticket count based on the query so far..
$total=mysql_num_rows(db_query("SELECT DISTINCT(ticket.ticket_id) $qfrom $qwhere"));

Also, you may have to name your ticket table in the query. Make sure it says "TICKET_TABLE.' ticket".
$qfrom=' FROM '.TICKET_TABLE.' ticket LEFT JOIN '.DEPT_TABLE.' dept ON ticket.dept_id=dept.dept_id '.
' LEFT JOIN '.TICKET_PRIORITY_TABLE.' pri ON ticket.priority_id=pri.priority_id '.
' LEFT JOIN '.TICKET_LOCK_TABLE.' tlock ON ticket.ticket_id=tlock.ticket_id AND tlock.expire>NOW() '.
' LEFT JOIN '.TICKET_RESPONSE_TABLE.' tresponse ON ticket.ticket_id=tresponse.ticket_id '.
' LEFT JOIN '.TICKET_NOTE_TABLE.' tnote ON ticket.ticket_id=tnote.ticket_id '.
' LEFT JOIN '.STAFF_TABLE.' staff ON ticket.staff_id=staff.staff_id';

Hope this helps!

systech
05-11-2010, 09:37 AM
I know this is an old thread, but better to reply to an old one than create a duplicate, correct? :cool:

I am having some issues with the My Tickets (count) working correctly. Currently the count shows all assigned/open tickets. The actual query shows only open/assigned tickets which is perfect. I have looked through tickets.php and ticket.inc.php and I think i foudn the place to make the change, but its not giving the desired effect.

Here is the issue:
http://rnd0m.com/wrongticketcount.png

In tickets.php on line 432 (my file) this shows
if($stats['assigned']) {
$nav->addSubMenu(array('desc'=>'My Tickets ('.$stats['assigned'].')','title'=>'Assigned Tickets',
'href'=>'tickets.php?status=assigned','iconclass'=>'assignedTickets'));
}


I have these two variations, but they don't seem to be the right change.

if($stats['assigned']+$stats['open']) {
$nav->addSubMenu(array('desc'=>'My Tickets ('.$stats['assigned'].')','title'=>'Assigned Tickets',
'href'=>'tickets.php?status=assigned','iconclass'=>'assignedTickets'));
}


and

if($stats['assigned']) {
$nav->addSubMenu(array('desc'=>'My Tickets ('.$stats['assigned']+$stats['open'].')','title'=>'Assigned Tickets',
'href'=>'tickets.php?status=assigned','iconclass'=>'assignedTickets'));
}


Any ideas why adding +$stats['open'] wouldn't count ONLY open and assigned tickets?

Thanks
-Matt

systech
05-14-2010, 01:28 PM
Friendly bump, anyone have some input?

Thanks
-Matt

systech
05-17-2010, 08:43 AM
Monday bump, hope everyone had a great weekend!

systech
05-21-2010, 08:02 AM
TGIF Bump!