From 1ac8e0d2876a3f260ba6fea21f581fce5ad5321f Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Wed, 20 May 2015 16:08:08 -0500 Subject: [PATCH] users: Fix attachment and collab counts in user directory --- include/staff/templates/tickets.tmpl.php | 24 +++++++++++++++++++----- scp/css/scp.css | 2 +- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/include/staff/templates/tickets.tmpl.php b/include/staff/templates/tickets.tmpl.php index a9310ed5b..450b82728 100644 --- a/include/staff/templates/tickets.tmpl.php +++ b/include/staff/templates/tickets.tmpl.php @@ -26,9 +26,19 @@ if (!$thisstaff->getRole()->hasPerm(SearchBackend::PERM_EVERYTHING)) { } $tickets->annotate(array( - 'collab_count' => SqlAggregate::COUNT('thread__collaborators'), - 'attachment_count' => SqlAggregate::COUNT('thread__entries__attachments'), - 'thread_count' => SqlAggregate::COUNT('thread__entries'), + 'collab_count' => SqlAggregate::COUNT('thread__collaborators', true), + 'attachment_count' => SqlAggregate::COUNT(SqlCase::N() + ->when(new SqlField('thread__entries__attachments__inline'), null) + ->otherwise(new SqlField('thread__entries__attachments')), + true + ), + 'thread_count' => SqlAggregate::COUNT(SqlCase::N() + ->when( + new Q(array('thread__entries__flags__hasbit'=>ThreadEntry::FLAG_HIDDEN)), + null) + ->otherwise(new SqlField('thread__entries__id')), + true + ), )); $tickets->values('staff_id', 'staff__firstname', 'staff__lastname', 'team__name', 'team_id', 'lock__lock_id', 'lock__staff_id', 'isoverdue', 'status_id', 'status__name', 'status__state', 'number', 'cdata__subject', 'ticket_id', 'source', 'dept_id', 'dept__name', 'user_id', 'user__default_email__address', 'user__name', 'lastupdate'); @@ -134,14 +144,18 @@ if ($results) { ?> style="max-width: 230px;" href="tickets.php?id=<?php echo $T['ticket_id']; ?>"><?php echo $subject; ?></a> <?php + if ($T['attachment_count']) + echo '<i class="small icon-paperclip icon-flip-horizontal" data-toggle="tooltip" title="' + .$T['attachment_count'].'"></i>'; if ($threadcount > 1) { ?> <span class="pull-right faded-more"><i class="icon-comments-alt"></i> <small><?php echo $threadcount; ?></small></span> <?php } if ($T['attachments']) echo '<i class="small icon-paperclip icon-flip-horizontal"></i>'; - if ($T['collaborators']) - echo '<i class="icon-group faded-more"></i>'; + if ($T['collab_count']) + echo '<span class="faded-more" data-toggle="tooltip" title="' + .$T['collab_count'].'"><i class="icon-group"></i></span>'; ?> </span></td> <?php diff --git a/scp/css/scp.css b/scp/css/scp.css index 8bc4d42bc..1ccde42fb 100644 --- a/scp/css/scp.css +++ b/scp/css/scp.css @@ -57,7 +57,7 @@ div#header a { } .faded-more { color: #aaa; - color: rgba(0,0,0,0.4); + color: rgba(0,0,0,0.35); } .small[class^="icon-"], -- GitLab