koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha admin/stopwords.pl C4/Koha.pm


From: Pierrick LE GALL
Subject: [Koha-cvs] koha admin/stopwords.pl C4/Koha.pm
Date: Fri, 07 Apr 2006 08:24:36 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         
Changes by:     Pierrick LE GALL <address@hidden>       06/04/07 08:24:36

Modified files:
        admin          : stopwords.pl 
        C4             : Koha.pm 

Log message:
        bug fixed: on admin/stopwords, the calculation of the number of pages to
        display in the pagination bar was wrong on extreme case (when number of
        items equals the pagesize). Calculation replaced by a generic function
        getnbpages in C4::Koha. This function could be useful elsewhere than in
        stpwords management screen and avoid calculation bugs as I did.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/admin/stopwords.pl.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/koha/koha/C4/Koha.pm.diff?tr1=1.28&tr2=1.29&r1=text&r2=text

Patches:
Index: koha/C4/Koha.pm
diff -u koha/C4/Koha.pm:1.28 koha/C4/Koha.pm:1.29
--- koha/C4/Koha.pm:1.28        Mon Feb 27 18:15:41 2006
+++ koha/C4/Koha.pm     Fri Apr  7 08:24:36 2006
@@ -62,6 +62,7 @@
                        &getauthtypes &getauthtype
                        &getallthemes &getalllanguages
                        &getallbranches &getletters
+                        getnbpages
                        $DEBUG);
 
 use vars qw();
@@ -732,6 +733,18 @@
     return @themes;
 }
 
+=item getnbpages
+
+Returns the number of pages to display in a pagination bar, given the number
+of items and the number of items per page.
+
+=cut
+
+sub getnbpages {
+    my ($nb_items, $nb_items_per_page) = @_;
+
+    return int(($nb_items - 1) / $nb_items_per_page) + 1;
+}
 
 1;
 __END__
Index: koha/admin/stopwords.pl
diff -u koha/admin/stopwords.pl:1.15 koha/admin/stopwords.pl:1.16
--- koha/admin/stopwords.pl:1.15        Thu Apr  6 11:00:08 2006
+++ koha/admin/stopwords.pl     Fri Apr  7 08:24:36 2006
@@ -29,6 +29,7 @@
 use CGI;
 use List::Util qw/min/;
 
+use C4::Koha;
 use C4::Context;
 use C4::Output;
 use C4::Search;
@@ -161,7 +162,7 @@
     loop => address@hidden,
     pagination_bar => pagination_bar(
         $script_name,
-        int(scalar(@results) / $pagesize) + 1,
+        getnbpages(scalar @results, $pagesize),
         $page,
         'page'
     )




reply via email to

[Prev in Thread] Current Thread [Next in Thread]