X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=rt%2Flib%2FRT%2FSearch%2FUnrepliedTickets.pm;h=0328983914c0a9247033ad41c89d2bafa0e5934d;hb=4e282b89c158949c1726f044e0102e126fbf5bf2;hp=a99690156ff377e8d92250a8b1227ee45f1ccd9c;hpb=d22baa4e71bfa9e153c1fe1152ff4c748f1d935c;p=freeside.git diff --git a/rt/lib/RT/Search/UnrepliedTickets.pm b/rt/lib/RT/Search/UnrepliedTickets.pm index a99690156..032898391 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,15 +30,22 @@ sub Prepare { my $self = shift; my $TicketsObj = $self->TicketsObj; - $TicketsObj->Limit( - FIELD => 'Owner', - VALUE => $TicketsObj->CurrentUser->id - ); - $TicketsObj->Limit( - FIELD => 'Status', - OPERATOR => '!=', - VALUE => 'resolved' - ); + # 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 + ); + } + foreach my $status (qw(resolved rejected deleted)) { + $TicketsObj->Limit( + FIELD => 'Status', + OPERATOR => '!=', + ENTRYAGGREGATOR => 'AND', + VALUE => $status, + ); + } my $txn_alias = $TicketsObj->JoinTransactions; $TicketsObj->Limit( ALIAS => $txn_alias,