[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.8-47-g747595b

? sunnavy sunnavy at bestpractical.com
Fri May 14 02:28:03 EDT 2010


The branch, 3.8-trunk has been updated
       via  747595b8abd123483b66c2e2e5b6fd557fa78899 (commit)
      from  64b4407e97f04521ce3f3b8053c1b7d81f7c8ce7 (commit)

Summary of changes:
 share/html/Elements/CollectionList |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

- Log -----------------------------------------------------------------
commit 747595b8abd123483b66c2e2e5b6fd557fa78899
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri May 14 14:28:20 2010 +0800

    tweak the page number to make sure it's valid

diff --git a/share/html/Elements/CollectionList b/share/html/Elements/CollectionList
index c7bdfd9..218b241 100644
--- a/share/html/Elements/CollectionList
+++ b/share/html/Elements/CollectionList
@@ -54,6 +54,16 @@ if (!$Collection && $Class eq 'RT::Tickets') {
 my $TotalFound = $Collection->CountAll();
 return '' if !$TotalFound && !$ShowEmpty;
 
+if ( $Rows ) {
+    if ( $TotalFound <= $Rows ) {
+        $Page = 1;
+    }
+    else {
+        my $MaxPage = int( $TotalFound / $Rows ) + ( $TotalFound % $Rows ? 1 : 0 );
+        $Page = $MaxPage if $Page > $MaxPage;
+    }
+}
+
 # XXX: ->{'order_by'} is hacky, but there is no way to check if
 # collection is ordered or not
 if ( @OrderBy && ($AllowSorting || !$Collection->{'order_by'}) ) {

-----------------------------------------------------------------------


More information about the Rt-commit mailing list