I’d also run into the problem and mentioned it on the list. I offered a
solution, but was told that it wasn’t worth the performance hit to
report accurate information. In case you are interested, I’ll provide
here any way.
I created a new subroutine in lib/RT/Tickets_Overlay.pm:
-
{{{ sub NumTickets
- sub NumTickets {
-
my $self = shift;
-
my $i = 0;
-
while ($self->Next) {
-
$i++;
-
}
-
return $i;
- }
-
}}}
Then changed this line in share/html/Search/Results.html:
$ticketcount = $session{tickets}->CountAll();
to
$ticketcount = $session{tickets}->NumTickets();
Lastly, I modified share/html/Elements/TicketList as such (bear in mind
that I’ve made other mods to the file, so my line numbering may not
match up with yours):
@@ -59,12 +59,12 @@
maxitems => $maxitems &>
% }
-% my $i;
+% my $TotalFound;
% while (my $record = $Collection->Next) {
-% $i++;
+% $TotalFound++;
% # Every ten rows, flush the buffer and put something on the page.
-% $m->flush_buffer() unless ($i % 10);
-<& /Elements/CollectionAsTable/Row, Format => @Format, i => $i,
record => $record, maxitems => $maxitems &>
+% $m->flush_buffer() unless ($TotalFound % 10);
+<& /Elements/CollectionAsTable/Row, Format => @Format, i =>
$TotalFound, record => $record, maxitems => $maxitems &>
% }
</%INIT>
<%ARGS>-----Original Message-----
From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Himanshu
Agrawal
Sent: Thursday, July 13, 2006 2:46 AM
To: rt-users@lists.bestpractical.com
Subject: [rt-users] Discrepancy in Ticket count and Next / Previous
pagelinks on Search->Display page
After performing a search, the results page displays ‘Found X Tickets’
as heading. This count includes tickets for which the user does not have
‘Show Ticket’ rights.
To reproduce:
- Create a user (say TestUser) and a queue (say TestQueue) such that
TestUser has rights only in TestQueue. - Create a ticket in TestQueue, say Test Ticket.
- Perform a search - Queue = ‘TestQueue’
The Ticket count displayed in heading will not match the actual number
of tickets displayed on results page. Also, as TestQueue contains only a
single ticket, so Next and Previous page links should not be visible.
I am not proficient in Perl and could not infer much from
rt3/share/html/Search/Results.html and
rt3/share/html/Elements/ListActions scripts. Please point me right
direction.
I’m using RT 3.4 on Linux RedHat 9 with Apache 2 and Perl 5.8.8.
Thanks and regards,
Himanshu Agrawal
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com
Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com
We’re hiring! Come hack Perl for Best Practical:
http://bestpractical.com/about/jobs.html