diff --git a/include/staff/templates/tickets.tmpl.php b/include/staff/templates/tickets.tmpl.php index 038ed8057ae237dd134423c16d3b0d6e057cb4c2..c140f689011ea81412d674e6398797056795b484 100644 --- a/include/staff/templates/tickets.tmpl.php +++ b/include/staff/templates/tickets.tmpl.php @@ -25,6 +25,11 @@ if (!$thisstaff->hasPerm(SearchBackend::PERM_EVERYTHING)) { $tickets->filter(Q::any($visibility)); } + +$tickets->constrain(array('lock' => array( + 'lock__expire__gt' => SqlFunction::NOW()))); + + $tickets->annotate(array( 'collab_count' => SqlAggregate::COUNT('thread__collaborators', true), 'attachment_count' => SqlAggregate::COUNT(SqlCase::N() diff --git a/include/staff/tickets.inc.php b/include/staff/tickets.inc.php index 5adab6cec0eb49ac93584102a36b4b8c646bd90b..2bdb8ba5ecc81cad256df6d4fdbcbb59441bc442 100644 --- a/include/staff/tickets.inc.php +++ b/include/staff/tickets.inc.php @@ -319,6 +319,11 @@ $tickets->annotate(array( ->aggregate(array('count' => SqlAggregate::COUNT('entries__id'))), )); + +// Make sure we're only getting active locks +$tickets->constrain(array('lock' => array( + 'lock__expire__gt' => SqlFunction::NOW()))); + ?> <!-- SEARCH FORM START -->