/[koha]/koha/reports/bor_issues_top.pl
ViewVC logotype

Diff of /koha/reports/bor_issues_top.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3.2.1 by tipaul, Thu Apr 7 12:06:05 2005 UTC revision 1.3.2.2 by hdl, Mon Nov 28 10:40:32 2005 UTC
# Line 243  sub calculate { Line 243  sub calculate {
243                    
244                  while (my ($celvalue) = $sth2->fetchrow) {                  while (my ($celvalue) = $sth2->fetchrow) {
245                          my %cell;                          my %cell;
246                          $cell{coltitle} = $celvalue;                          $cell{'coltitle'} = ($celvalue?$celvalue:"NULL");
247                          push @loopcol, \%cell;                          push @loopcol, \%cell;
248                  }                  }
249          #       warn "fin des titres colonnes";          #       warn "fin des titres colonnes";
# Line 296  sub calculate { Line 296  sub calculate {
296                    
297          $strcalc .= " group by borrowers.borrowernumber";          $strcalc .= " group by borrowers.borrowernumber";
298          $strcalc .= ", $colfield" if ($column);          $strcalc .= ", $colfield" if ($column);
299          $strcalc .= " order by ";          $strcalc .= " order by RANK DESC";
300          $strcalc .= "$colfield, " if ($colfield);          $strcalc .= ",$colfield " if ($colfield);
301          $strcalc .= "RANK DESC ";  #       my $max;
302          my $max;  #       if (@loopcol) {
303          if (@loopcol) {  #               $max = $line*@loopcol;
304                  $max = $line*@loopcol;  #       } else { $max=$line;}
305          } else { $max=$line;}  #       $strcalc .= " LIMIT 0,$max";
         $strcalc .= " LIMIT 0,$max";  
306          warn "SQL :". $strcalc;          warn "SQL :". $strcalc;
307                    
308          my $dbcalc = $dbh->prepare($strcalc);          my $dbcalc = $dbh->prepare($strcalc);
309          $dbcalc->execute;          $dbcalc->execute;
310  #       warn "filling table";  #       warn "filling table";
311          my $previous_col;          my $previous_col;
312          my $i=1;          my %indice;
313          while (my  @data = $dbcalc->fetchrow) {          while (my  @data = $dbcalc->fetchrow) {
314                  my ($row, $rank, $id, $col )=@data;                  my ($row, $rank, $id, $col )=@data;
315                  $col = "zzEMPTY" if ($col eq undef);                  $col = "zzEMPTY" if ($col eq undef);
316                  $i=1 if (($previous_col) and not($col eq $previous_col));                  $indice{$col}=1 if (not($indice{$col}));
317                  $table[$i]->{$col}->{'name'}=$row;                  $table[$indice{$col}]->{$col}->{'name'}=$row;
318                  $table[$i]->{$col}->{'count'}=$rank;                  $table[$indice{$col}]->{$col}->{'count'}=$rank;
319                  $table[$i]->{$col}->{'link'}=$id;                  $table[$indice{$col}]->{$col}->{'link'}=$id;
320                  warn " ".$i." ".$col. " ".$row;  #               warn " ".$i." ".$col. " ".$row;
321                  $i++;                  $indice{$col}++;
                 $previous_col=$col;  
322          }          }
323                    
324          push @loopcol,{coltitle => "Global"} if not($column);          push @loopcol,{coltitle => "Global"} if not($column);
# Line 328  sub calculate { Line 326  sub calculate {
326          for ($i=1; $i<=$line;$i++) {          for ($i=1; $i<=$line;$i++) {
327                  my @loopcell;                  my @loopcell;
328                  warn " $i";                  warn " $i";
329                  #@loopcol ensures the order for columns is common with column titles                  #@loborrowersopcol ensures the order for columns is common with column titles
330                  # and the number matches the number of columns                  # and the number matches the number of columns
331                  my $colcount=0;                  my $colcount=0;
332                  foreach my $col ( @loopcol ) {                  foreach my $col ( @loopcol ) {

Legend:
Removed from v.1.3.2.1  
changed lines
  Added in v.1.3.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26