[Koha-cvs] Changes to koha/reports/cat_issues_top.pl [rel_2_2]

Henri-Damien LAURENT laurenthdl at alinto.com
Mon Nov 28 11:40:33 CET 2005


Index: koha/reports/cat_issues_top.pl
diff -u koha/reports/cat_issues_top.pl:1.5.2.1 koha/reports/cat_issues_top.pl:1.5.2.2
--- koha/reports/cat_issues_top.pl:1.5.2.1	Thu Apr  7 12:06:05 2005
+++ koha/reports/cat_issues_top.pl	Mon Nov 28 10:40:32 2005
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-# $Id: cat_issues_top.pl,v 1.5.2.1 2005/04/07 12:06:05 tipaul Exp $
+# $Id: cat_issues_top.pl,v 1.5.2.2 2005/11/28 10:40:32 hdl Exp $
 
 # Copyright 2000-2002 Katipo Communications
 #
@@ -251,10 +251,7 @@
 	
 		while (my ($celvalue) = $sth2->fetchrow) {
 			my %cell;
-	#		my %ft;
-	#		warn "coltitle :".$celvalue;
-			$cell{coltitle} = $celvalue;
-	#		$ft{totalcol} = 0;
+			$cell{coltitle} = ($celvalue?$celvalue:"NULL");
 			push @loopcol, \%cell;
 		}
 	#	warn "fin des titres colonnes";
@@ -307,31 +304,29 @@
 	
 	$strcalc .= " group by biblio.biblionumber";
 	$strcalc .= ", $colfield" if ($column);
-	$strcalc .= " order by ";
-	$strcalc .= "$colfield, " if ($colfield);
-	$strcalc .= "RANK DESC ";
-	my $max;
-	if (@loopcol) {
-		$max = $line*@loopcol;
-	} else { $max=$line;}
-	$strcalc .= " LIMIT 0,$max";
+	$strcalc .= " order by RANK DESC";
+	$strcalc .= ", $colfield " if ($colfield);
+# 	my $max;
+# 	if (@loopcol) {
+# 		$max = $line*@loopcol;
+# 	} else { $max=$line;}
+# 	$strcalc .= " LIMIT 0,$max";
 	warn "SQL :". $strcalc;
 	
 	my $dbcalc = $dbh->prepare($strcalc);
 	$dbcalc->execute;
 # 	warn "filling table";
 	my $previous_col;
-	my $i=1;
+	my %indice;
 	while (my  @data = $dbcalc->fetchrow) {
 		my ($row, $rank, $id, $col )=@data;
 		$col = "zzEMPTY" if ($col eq undef);
-		$i=1 if (($previous_col) and not($col eq $previous_col));
-		$table[$i]->{$col}->{'name'}=$row;
-		$table[$i]->{$col}->{'count'}=$rank;
-		$table[$i]->{$col}->{'link'}=$id;
+		$indice{$col}=1 if (not($indice{$col}));
+		$table[$indice{$col}]->{$col}->{'name'}=$row;
+		$table[$indice{$col}]->{$col}->{'count'}=$rank;
+		$table[$indice{$col}]->{$col}->{'link'}=$id;
 #		warn " ".$i." ".$col. " ".$row;
-		$i++;
-		$previous_col=$col;
+		$indice{$col}++;
 	}
 	
 	push @loopcol,{coltitle => "Global"} if not($column);





More information about the Koha-cvs mailing list