Bug 16184 - Report bor_issues_top shows incorrect number of rows
authorMason James <mtj@kohaaloha.com>
Fri, 1 Apr 2016 02:56:34 +0000 (15:56 +1300)
committerFrédéric Demians <f.demians@tamil.fr>
Wed, 27 Apr 2016 14:35:37 +0000 (16:35 +0200)
TEST PLAN
---------
1) Have at least 6 patrons with checkouts and some checkins.
2) Reports -> Patrons with the most checkouts
3) Click 'Submit' (default is 5)
   -- more than 5 entries listed.
4) Apply patch
5) Refresh page
   -- only 5 entries listed.
6) Run koha qa test tools

NOTE: While this works, I'd be much happier with a refactor
      as it would also speed up the report. See comment #5.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
(cherry picked from commit 2c68980467009a9d19116440d4f28356707e9e7c)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
(cherry picked from commit bd4659d09f92135a7956496c44af555b5938c8c3)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>

reports/bor_issues_top.pl

index b158b7b..23ccc9e 100755 (executable)
@@ -160,6 +160,7 @@ sub calculate {
     my $grantotal =0;
     my $dbh = C4::Context->dbh;
 
+
 # Checking filters
     my @loopfilter;
        my @cellmap = (
@@ -362,6 +363,7 @@ sub calculate {
                                                } keys %patrons;
     foreach my $id (@ranked_ids) {
         my @loopcell;
+
         foreach my $key (@cols_in_order) {
                        if($column){
                      push @loopcell, {
@@ -381,8 +383,10 @@ sub calculate {
                         'loopcell' => \@loopcell,
                         'hilighted' => ($i%2),
                     };
+        # use a limit, if a limit is defined
+        last if $i > $limit and $limit
     }
-       
+
     # the header of the table
     $globalline{loopfilter}=\@loopfilter;
     # the core of the table