(bug #3557) fix bor_issues_top
authorNahuel ANGELINETTI <nahuel.angelinetti@biblibre.com>
Fri, 28 Aug 2009 21:47:49 +0000 (23:47 +0200)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Wed, 30 Sep 2009 09:30:12 +0000 (11:30 +0200)
Just add the condition where column is "None".

reports/bor_issues_top.pl

index 12a6168..bb17d0a 100755 (executable)
@@ -109,7 +109,7 @@ my $dbh = C4::Context->dbh;
 my @values;
 
 # here each element returned by map is a hashref, get it?
-my @mime  = ( map { +{type =>$_} } (split /[;:]/,C4::Context->preference("MIME")) );
+my @mime  = ( map { {type =>$_} } (split /[;:]/,C4::Context->preference("MIME")) );
 my $delims = GetDelimiterChoices;
 my $branches = GetBranches;
 my @branchloop;
@@ -264,7 +264,7 @@ sub calculate {
         print DEBUG "rows: ", $sth2->rows, "\n";
         while (my @row = $sth2->fetchrow) {
                        $columns{($row[0] ||'NULL')}++;
-            push @loopcol, +{ coltitle => $row[0] || 'NULL' };
+            push @loopcol, { coltitle => $row[0] || 'NULL' };
         }
 
                $strsth2 =~ s/old_issues/issues/g;
@@ -274,9 +274,11 @@ sub calculate {
         $debug and print DEBUG "rows: ", $sth2->rows, "\n";
         while (my @row = $sth2->fetchrow) {
                        $columns{($row[0] ||'NULL')}++;
-            push @loopcol, +{ coltitle => $row[0] || 'NULL' };
+            push @loopcol, { coltitle => $row[0] || 'NULL' };
         }
                $debug and print DEBUG "full array: ", Dumper(\%columns), "\n";
+    }else{
+        $columns{''} = 1;
     }
 
     #Initialization of cell values.....
@@ -383,11 +385,19 @@ sub calculate {
     foreach my $id (@ranked_ids) {
         my @loopcell;
         foreach my $key (@cols_in_order) {
-            push @loopcell, {
+                       if($column){
+                     push @loopcell, {
                                value => $patrons{$id}->{name},
+                               reference => $id,
                                count => $patrons{$id}->{allcols}->{$key},
+                         };
+                       }else{
+                         push @loopcell, {
+                               value => $patrons{$id}->{name},
                                reference => $id,
-                       };
+                               count => $patrons{$id}->{total},
+                         };  
+                       }
         }
         push @looprow,{ 'rowtitle' => $i++ ,
                         'loopcell' => \@loopcell,
@@ -399,7 +409,7 @@ sub calculate {
     $globalline{loopfilter}=\@loopfilter;
     # the core of the table
     $globalline{looprow} = \@looprow;
-    $globalline{loopcol} = [ map {+{coltitle=>$_}} @cols_in_order ];
+    $globalline{loopcol} = [ map {{coltitle=>$_}} @cols_in_order ];
        # the foot (totals by borrower type)
     $globalline{loopfooter} = [];
     $globalline{total}= $grantotal;            # FIXME: useless