251 |
|
|
252 |
while (my ($celvalue) = $sth2->fetchrow) { |
while (my ($celvalue) = $sth2->fetchrow) { |
253 |
my %cell; |
my %cell; |
254 |
# my %ft; |
$cell{coltitle} = ($celvalue?$celvalue:"NULL"); |
|
# warn "coltitle :".$celvalue; |
|
|
$cell{coltitle} = $celvalue; |
|
|
# $ft{totalcol} = 0; |
|
255 |
push @loopcol, \%cell; |
push @loopcol, \%cell; |
256 |
} |
} |
257 |
# warn "fin des titres colonnes"; |
# warn "fin des titres colonnes"; |
304 |
|
|
305 |
$strcalc .= " group by biblio.biblionumber"; |
$strcalc .= " group by biblio.biblionumber"; |
306 |
$strcalc .= ", $colfield" if ($column); |
$strcalc .= ", $colfield" if ($column); |
307 |
$strcalc .= " order by "; |
$strcalc .= " order by RANK DESC"; |
308 |
$strcalc .= "$colfield, " if ($colfield); |
$strcalc .= ", $colfield " if ($colfield); |
309 |
$strcalc .= "RANK DESC "; |
# my $max; |
310 |
my $max; |
# if (@loopcol) { |
311 |
if (@loopcol) { |
# $max = $line*@loopcol; |
312 |
$max = $line*@loopcol; |
# } else { $max=$line;} |
313 |
} else { $max=$line;} |
# $strcalc .= " LIMIT 0,$max"; |
|
$strcalc .= " LIMIT 0,$max"; |
|
314 |
warn "SQL :". $strcalc; |
warn "SQL :". $strcalc; |
315 |
|
|
316 |
my $dbcalc = $dbh->prepare($strcalc); |
my $dbcalc = $dbh->prepare($strcalc); |
317 |
$dbcalc->execute; |
$dbcalc->execute; |
318 |
# warn "filling table"; |
# warn "filling table"; |
319 |
my $previous_col; |
my $previous_col; |
320 |
my $i=1; |
my %indice; |
321 |
while (my @data = $dbcalc->fetchrow) { |
while (my @data = $dbcalc->fetchrow) { |
322 |
my ($row, $rank, $id, $col )=@data; |
my ($row, $rank, $id, $col )=@data; |
323 |
$col = "zzEMPTY" if ($col eq undef); |
$col = "zzEMPTY" if ($col eq undef); |
324 |
$i=1 if (($previous_col) and not($col eq $previous_col)); |
$indice{$col}=1 if (not($indice{$col})); |
325 |
$table[$i]->{$col}->{'name'}=$row; |
$table[$indice{$col}]->{$col}->{'name'}=$row; |
326 |
$table[$i]->{$col}->{'count'}=$rank; |
$table[$indice{$col}]->{$col}->{'count'}=$rank; |
327 |
$table[$i]->{$col}->{'link'}=$id; |
$table[$indice{$col}]->{$col}->{'link'}=$id; |
328 |
# warn " ".$i." ".$col. " ".$row; |
# warn " ".$i." ".$col. " ".$row; |
329 |
$i++; |
$indice{$col}++; |
|
$previous_col=$col; |
|
330 |
} |
} |
331 |
|
|
332 |
push @loopcol,{coltitle => "Global"} if not($column); |
push @loopcol,{coltitle => "Global"} if not($column); |