[Koha-patches] [PATCH] (bug #3557) fix bor_issues_top

Nahuel ANGELINETTI nahuel.angelinetti at biblibre.com
Wed Aug 26 16:56:38 CEST 2009


Just add the condition where column is "None".
---
 reports/bor_issues_top.pl |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/reports/bor_issues_top.pl b/reports/bor_issues_top.pl
index 12a6168..bb17d0a 100755
--- a/reports/bor_issues_top.pl
+++ b/reports/bor_issues_top.pl
@@ -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
-- 
1.6.0.4




More information about the Koha-patches mailing list