[rt-users] Discrepancy in Ticket count and Next / Previous pagelinks on Search->Display page

Himanshu Agrawal himanshua at cybage.com
Fri Jul 21 02:09:37 EDT 2006


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:ESchultz at corp.untd.com] 
Sent: Friday, July 14, 2006 21:20
To: Himanshu Agrawal; rt-users at lists.bestpractical.com
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 => \@Format, i => $i,
record => $record, maxitems => $maxitems &>
+% $m->flush_buffer() unless ($TotalFound % 10);
+<&   /Elements/CollectionAsTable/Row, Format => \@Format, 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>



More information about the rt-users mailing list