Sorry again, I didn't finish it. Suppose total found tickets is 200; rows parameter is set to 50 for search result page; the logged in user can see only 5 tickets out of 200, but these tickets get displayed on 3rd page.;
In this scenario, the count is displayed as 5; the results page does not list any tickets and Next / Previous page links does not show up. I will appreciate any inputs on the same. Thanks Himanshu Agrawal -----Original Message----- From: Himanshu Agrawal Sent: Friday, July 21, 2006 11:40 To: 'Schultz, Eric'; [email protected] Subject: RE: [rt-users] Discrepancy in Ticket count and Next / Previous pagelinks on Search->Display page Thanks for your inputs and apologies for reply after so long. I tried the changes you mentioned but did not get the full desired functionality. It corrects the count in 'Found X tickets' but messes up the Next / Previous page links. Elaborate it bit more: Suppose total found tickets is 200; rows parameter is set to 50 for search result page and the user can see -----Original Message----- From: Schultz, Eric [mailto:[EMAIL PROTECTED] Sent: Friday, July 14, 2006 21:20 To: Himanshu Agrawal; [email protected] Subject: RE: [rt-users] Discrepancy in Ticket count and Next / Previous pagelinks on Search->Display page 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 => [EMAIL PROTECTED], i => $i, record => $record, maxitems => $maxitems &> +% $m->flush_buffer() unless ($TotalFound % 10); +<& /Elements/CollectionAsTable/Row, Format => [EMAIL PROTECTED], i => $TotalFound, record => $record, maxitems => $maxitems &> % } </TABLE> @@ -137,7 +137,6 @@ $Collection->OrderBy(FIELD => $OrderBy, ORDER => $Order); $Collection->RowsPerPage($Rows) if ($Rows); $Collection->GotoPage($Page-1); # SB uses page 0 as the first page -my $TotalFound = $Collection->CountAll(); </%INIT> <%ARGS> _______________________________________________ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: [EMAIL PROTECTED] 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
