diff options
Diffstat (limited to 'rt')
-rw-r--r-- | rt/lib/RT/Search/UnrepliedTickets.pm | 21 | ||||
-rw-r--r-- | rt/lib/RT/Ticket_Vendor.pm | 23 | ||||
-rw-r--r-- | rt/share/html/Elements/CollectionAsTable/Row | 5 | ||||
-rw-r--r-- | rt/share/html/Elements/QueueSummaryByLifecycle | 24 | ||||
-rw-r--r-- | rt/share/static/css/freeside3/ticket-lists.css | 14 | ||||
-rw-r--r-- | rt/share/static/css/freeside4/ticket-lists.css | 13 |
6 files changed, 91 insertions, 9 deletions
diff --git a/rt/lib/RT/Search/UnrepliedTickets.pm b/rt/lib/RT/Search/UnrepliedTickets.pm index a99690156..12d847a0a 100644 --- a/rt/lib/RT/Search/UnrepliedTickets.pm +++ b/rt/lib/RT/Search/UnrepliedTickets.pm @@ -6,9 +6,9 @@ =head1 DESCRIPTION -Find all unresolved tickets owned by the current user where the last correspondence -from a requestor (or ticket creation) is more recent than the last -correspondence from a non-requestor (if there is any). +Find all unresolved tickets owned by the current user where the last +correspondence from a requestor (or ticket creation) is more recent than the +last correspondence from a non-requestor (if there is any). =head1 METHODS @@ -30,14 +30,23 @@ sub Prepare { my $self = shift; my $TicketsObj = $self->TicketsObj; + # if SystemUser does this search (as in QueueSummaryByLifecycle), they + # should get all tickets regardless of ownership + if ($TicketsObj->CurrentUser->id != RT->SystemUser->id) { + $TicketsObj->Limit( + FIELD => 'Owner', + VALUE => $TicketsObj->CurrentUser->id + ); + } $TicketsObj->Limit( - FIELD => 'Owner', - VALUE => $TicketsObj->CurrentUser->id + FIELD => 'Status', + OPERATOR => '!=', + VALUE => 'resolved' ); $TicketsObj->Limit( FIELD => 'Status', OPERATOR => '!=', - VALUE => 'resolved' + VALUE => 'rejected', ); my $txn_alias = $TicketsObj->JoinTransactions; $TicketsObj->Limit( diff --git a/rt/lib/RT/Ticket_Vendor.pm b/rt/lib/RT/Ticket_Vendor.pm index a55bb7b0d..4a7883888 100644 --- a/rt/lib/RT/Ticket_Vendor.pm +++ b/rt/lib/RT/Ticket_Vendor.pm @@ -92,5 +92,28 @@ sub WillResolveAsString { return $self->WillResolveObj->AsString(); } +=head2 IsUnreplied + +Returns true if there's a Correspond or Create transaction more recent than +the Told date of this ticket (or the ticket has no Told date) and the ticket +is not rejected or resolved. + +=cut + +sub IsUnreplied { + my $self = shift; + return 0 if $self->Status eq 'resolved' + or $self->Status eq 'rejected'; + + my $Told = $self->Told || '1970-01-01'; + my $Txns = $self->Transactions; + $Txns->Limit(FIELD => 'Type', + OPERATOR => 'IN', + VALUE => [ 'Correspond', 'Create' ]); + $Txns->Limit(FIELD => 'Created', + OPERATOR => '>', + VALUE => $Told); + $Txns->Count ? 1 : 0; +} 1; diff --git a/rt/share/html/Elements/CollectionAsTable/Row b/rt/share/html/Elements/CollectionAsTable/Row index deaa312ba..4b2cfae43 100644 --- a/rt/share/html/Elements/CollectionAsTable/Row +++ b/rt/share/html/Elements/CollectionAsTable/Row @@ -57,6 +57,11 @@ $Class => 'RT__Ticket' $Classes => '' </%ARGS> <%init> +# it's a hack, but it has to be applied in every ticket search regardless +# of format, so... +if ( $record and $record->isa('RT::Ticket') and $record->IsUnreplied ) { + $Classes .= ' unreplied-ticket'; +} $m->out( '<tr class="' . $Classes . ' ' . ( $Warning ? 'warnline' : $i % 2 ? 'oddline' : 'evenline' ) . '" >' . "\n" ); diff --git a/rt/share/html/Elements/QueueSummaryByLifecycle b/rt/share/html/Elements/QueueSummaryByLifecycle index f21cb20c3..d6ed1e678 100644 --- a/rt/share/html/Elements/QueueSummaryByLifecycle +++ b/rt/share/html/Elements/QueueSummaryByLifecycle @@ -66,9 +66,13 @@ for my $queue (@queues) { next if lc($queue->{Lifecycle} || '') ne lc $lifecycle->Name; $i++; + + my $classes = $i%2 ? 'oddline' : 'evenline'; + $classes .= ' unreplied-ticket' if $queue->{Unreplied} > 0; </%PERL> -<tr class="<% $i%2 ? 'oddline' : 'evenline'%>" > +<tr class="<% $classes %>"> +<td></td> <td> <a href="<% $link_all->($queue, \@cur_statuses) %>" title="<% $queue->{Description} %>"><% $queue->{Name} %></a> </td> @@ -134,6 +138,24 @@ for my $queue (@queues) { $lifecycle{ lc $cycle->Name } = $cycle; } +use RT::Search::UnrepliedTickets; +my $Tickets = RT::Tickets->new( RT->SystemUser ); +my $Search = RT::Search::UnrepliedTickets->new( TicketsObj => $Tickets ); +$Search->Prepare; + +for my $queue (@queues) { + my $cycle = RT::Lifecycle->Load( Name => $queue->{'Lifecycle'} ); + $lifecycle{ lc $cycle->Name } = $cycle; + + # show whether there are unreplied tickets + # somewhat inefficient but we only use the count query + my $tix = $Tickets->Clone; + $tix->Limit(FIELD => 'Queue', + OPERATOR => '=', + VALUE => $queue->{id}); + $queue->{Unreplied} = $tix->Count; +} + unless (@statuses) { my %seen; foreach my $set ( 'initial', 'active' ) { diff --git a/rt/share/static/css/freeside3/ticket-lists.css b/rt/share/static/css/freeside3/ticket-lists.css index 84c9a92de..257cf3b07 100644 --- a/rt/share/static/css/freeside3/ticket-lists.css +++ b/rt/share/static/css/freeside3/ticket-lists.css @@ -99,8 +99,18 @@ tr.collection-as-table+tr.collection-as-table th { } - - +tr.unreplied-ticket > :first-child::before { + /* green dot */ + border: 1px solid black; + border-radius: 50%; + display: inline-block; + height: 1ex; + width: 1ex; + float: left; + content: ''; + margin-top: 1ex; + background-color: green; +} table.queue-summary td { background: #efefef; diff --git a/rt/share/static/css/freeside4/ticket-lists.css b/rt/share/static/css/freeside4/ticket-lists.css index cdf10193a..3d4706fd2 100644 --- a/rt/share/static/css/freeside4/ticket-lists.css +++ b/rt/share/static/css/freeside4/ticket-lists.css @@ -81,6 +81,19 @@ table.collection-as-table.chart th { border-bottom: 2px solid #ccc } +tr.unreplied-ticket > :first-child::before { + /* green dot */ + border: 1px solid black; + border-radius: 50%; + display: inline-block; + height: 1ex; + width: 1ex; + float: left; + content: ''; + margin-right: 1ex; + background-color: green; +} + table.queue-summary td { background: #efefef; border-bottom: 1px solid #ccc; |