[Koha-patches] [PATCH] (bug #2956) fix 4xx plugin pagination

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Thu Feb 12 15:38:52 CET 2009


this patch rework the calculation of the pagination and of results
---
 cataloguing/value_builder/unimarc_field_4XX.pl |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/cataloguing/value_builder/unimarc_field_4XX.pl b/cataloguing/value_builder/unimarc_field_4XX.pl
index b97f27b..208d084 100755
--- a/cataloguing/value_builder/unimarc_field_4XX.pl
+++ b/cataloguing/value_builder/unimarc_field_4XX.pl
@@ -349,17 +349,15 @@ sub plugin {
         # multi page display gestion
         my $displaynext = 0;
         my $displayprev = $startfrom;
-        if ( ( $total - ( ( $startfrom + 1 ) * ($resultsperpage) ) ) > 0 ) {
+
+        if( ( $total_hits - ( ( $startfrom + 1 ) * ($resultsperpage) ) ) > 0 ) {
             $displaynext = 1;
         }
         my @arrayresults;
         my @field_data = ($search);
          for (
-             my $i = $startfrom * $resultsperpage ;
-             $i < (( $startfrom * $resultsperpage + $resultsperpage  < scalar(@$results))
-                 ? $startfrom * $resultsperpage + $resultsperpage
-                 : scalar(@$results)
-             ) ;
+             my $i = 0 ;
+             $i < $resultsperpage ;
              $i++
            )
          {
@@ -445,7 +443,7 @@ sub plugin {
             startfromnext  => $startfrom + 1,
             startfromprev  => $startfrom - 1,
             searchdata     => \@field_data,
-            total          => $total,
+            total          => $total_hits,
             from           => $from,
             to             => $to,
             numbers        => \@numbers,
-- 
1.5.6.3




More information about the Koha-patches mailing list