Skip to content

Commit

Permalink
sql fix for 'tickets from selected queues setting'
Browse files Browse the repository at this point in the history
  • Loading branch information
chilek committed Mar 12, 2014
1 parent 6515e65 commit 905c070
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions userpanel/lib/ULMS.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,11 @@ function GetCustomerMessage($id)

function GetCustomerTickets($id)
{
if ($this->CONFIG['userpanel']['tickets_from_selected_queues'])
$queues = $this->DB->GetCol('SELECT id FROM rtqueues'
. (!empty($this->CONFIG['userpanel']['queues'])
? ' WHERE id IN (' . str_replace(';', ',', $this->CONFIG['userpanel']['queues']) . ')'
: ''));
$tickets = $this->DB->GetAll('SELECT * FROM rttickets WHERE customerid=? '
. ($this->CONFIG['userpanel']['tickets_from_selected_queues'] ?
'AND queueid IN (' . implode(',', $queues) . ')' : '')
if ($this->CONFIG['userpanel']['tickets_from_selected_queues'] && !empty($this->CONFIG['userpanel']['queues']))
$queues = $this->DB->GetCol('SELECT id FROM rtqueues
WHERE id IN (' . str_replace(';', ',', $this->CONFIG['userpanel']['queues']) . ')');
$tickets = $this->DB->GetAll('SELECT * FROM rttickets WHERE customerid=?'
. (isset($queues) && !empty($queues) ? ' AND queueid IN (' . implode(',', $queues) . ')' : '')
. ' ORDER BY createtime DESC', array($id));
if (!empty($tickets))
foreach ($tickets as $idx => $ticket)
Expand Down

0 comments on commit 905c070

Please sign in to comment.