koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/reports catalogue_stats.pl,1.1,1.2


From: Henri-Damien LAURENT
Subject: [Koha-cvs] CVS: koha/reports catalogue_stats.pl,1.1,1.2
Date: Thu, 24 Feb 2005 03:27:35 -0800

Update of /cvsroot/koha/koha/reports
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20737/reports

Modified Files:
        catalogue_stats.pl 
Log Message:
bugs fixing on catalogue stats reporting

Index: catalogue_stats.pl
===================================================================
RCS file: /cvsroot/koha/koha/reports/catalogue_stats.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** catalogue_stats.pl  23 Feb 2005 12:56:55 -0000      1.1
--- catalogue_stats.pl  24 Feb 2005 11:27:32 -0000      1.2
***************
*** 106,112 ****
--- 106,114 ----
        $req = $dbh->prepare("select distinctrow left(dewey,3) from 
biblioitems");
        $req->execute;
+       my $hasdewey=1;
        my @select;
        push @select,"";
        while (my ($value) =$req->fetchrow) {
+               $hasdewey =1 if (($value) and (! $hasdewey));
                push @select, $value;
        }
***************
*** 121,125 ****
--- 123,131 ----
        undef @select;
        push @select,"";
+       my $haslccn=1;
+       my $hlghtlccn;
        while (my ($value) =$req->fetchrow) {
+               $hlghtlccn = !($hasdewey);
+               $haslccn =1 if (($value) and (! $haslccn));
                push @select, $value;
        }
***************
*** 130,138 ****
                                -multiple => 0 );
        
!       $req = $dbh->prepare("select distinctrow left(itemcolnumber,5) from 
items");
        $req->execute;
        undef @select;
        push @select,"";
        while (my ($value) =$req->fetchrow) {
                push @select, $value;
        }
--- 136,148 ----
                                -multiple => 0 );
        
!       $req = $dbh->prepare("select distinctrow left(itemcallnumber,5) from 
items");
        $req->execute;
        undef @select;
        push @select,"";
+       my $hascote=1;
+       my $hlghtcote;
        while (my ($value) =$req->fetchrow) {
+               $hascote =1 if (($value) and (! $hascote));
+               $hlghtcote = (($hasdewey) and ($haslccn)) or (!($hasdewey) and 
!($haslccn));
                push @select, $value;
        }
***************
*** 226,233 ****
                                -multiple => 0 );
        
!       $template->param(CGIFromDeweyClass => $CGIdewey,
                                        CGIToDeweyClass => $CGIdewey,
                                        CGIFromLoCClass => $CGIlccn,
                                        CGIToLoCClass => $CGIlccn,
                                        CGIFromCoteClass => $CGIcote,
                                        CGIToCoteClass => $CGIcote,
--- 236,248 ----
                                -multiple => 0 );
        
!       $template->param(hasdewey=>$hasdewey,
!                                       CGIFromDeweyClass => $CGIdewey,
                                        CGIToDeweyClass => $CGIdewey,
+                                       haslccn=> $haslccn,
+                                       hlghtlccn => $hlghtlccn,
                                        CGIFromLoCClass => $CGIlccn,
                                        CGIToLoCClass => $CGIlccn,
+                                       hascote=> $hascote,
+                                       hlghtcote => $hlghtcote,
                                        CGIFromCoteClass => $CGIcote,
                                        CGIToCoteClass => $CGIcote,
***************
*** 270,283 ****
                        }
                        $cell{filter} .= @$filters[$i];
!                       $cell{crit} .="Dewey Classification From :" if ($i==0);
!                       $cell{crit} .="Dewey Classification To :" if ($i==1);
!                       $cell{crit} .="Lccn Classification From :" if ($i==2);
!                       $cell{crit} .="Lccn Classification To :" if ($i==3);
!                       $cell{crit} .="Cote Classification From :" if ($i==4);
!                       $cell{crit} .="Cote Classification To :" if ($i==5);
!                       $cell{crit} .="Document type :" if ($i==6);
!                       $cell{crit} .="Publisher :" if ($i==7);
!                       $cell{crit} .="Publication year From :" if ($i==8);
!                       $cell{crit} .="Publication year To :" if ($i==9);
                        $cell{crit} .="Branch :" if ($i==10);
                        $cell{crit} .="Location:" if ($i==11);
--- 285,298 ----
                        }
                        $cell{filter} .= @$filters[$i];
!                       $cell{crit} .="Dewey Classification From" if ($i==0);
!                       $cell{crit} .="Dewey Classification To" if ($i==1);
!                       $cell{crit} .="Lccn Classification From" if ($i==2);
!                       $cell{crit} .="Lccn Classification To" if ($i==3);
!                       $cell{crit} .="Cote Classification From" if ($i==4);
!                       $cell{crit} .="Cote Classification To" if ($i==5);
!                       $cell{crit} .="Document type" if ($i==6);
!                       $cell{crit} .="Publisher" if ($i==7);
!                       $cell{crit} .="Publication year From" if ($i==8);
!                       $cell{crit} .="Publication year To" if ($i==9);
                        $cell{crit} .="Branch :" if ($i==10);
                        $cell{crit} .="Location:" if ($i==11);
***************
*** 286,290 ****
        }
        
!       my $linefilter = "";
  #     warn "filtres "address@hidden;
  #     warn "filtres "address@hidden;
--- 301,305 ----
        }
        
!       my @linefilter;
  #     warn "filtres "address@hidden;
  #     warn "filtres "address@hidden;
***************
*** 292,321 ****
  #     warn "filtres "address@hidden;
        
!       $linefilter = @$filters[0] if ($line =~ /dewey/ )  ;
!       $linefilter = @$filters[1] if ($line =~ /dewey/ )  ;
!       $linefilter = @$filters[2] if ($line =~ /lccn/ )  ;
!       $linefilter = @$filters[3] if ($line =~ /lccn/ )  ;
!       $linefilter = @$filters[4] if ($line =~ /itemcolnumber/ )  ;
!       $linefilter = @$filters[5] if ($line =~ /itemcolnumber/ )  ;
!       $linefilter = @$filters[6] if ($line =~ /itemtype/ )  ;
!       $linefilter = @$filters[7] if ($line =~ /publishercode/ ) ;
!       $linefilter = @$filters[8] if ($line =~ /publicationyear/ ) ;
!       $linefilter = @$filters[9] if ($line =~ /publicationyear/ ) ;
!       $linefilter = @$filters[10] if ($line =~ /items.homebranch/ ) ;
!       $linefilter = @$filters[11] if ($line =~ /items.location/ ) ;
  # 
!       my $colfilter = "";
!       $colfilter = @$filters[0] if ($column =~ /dewey/ )  ;
!       $colfilter = @$filters[1] if ($column =~ /dewey/ )  ;
!       $colfilter = @$filters[2] if ($column =~ /lccn/ )  ;
!       $colfilter = @$filters[3] if ($column =~ /lccn/ )  ;
!       $colfilter = @$filters[4] if ($column =~ /itemcolnumber/ )  ;
!       $colfilter = @$filters[5] if ($column =~ /itemcolnumber/ )  ;
!       $colfilter = @$filters[6] if ($column =~ /itemtype/ )  ;
!       $colfilter = @$filters[7] if ($column =~ /publishercode/ ) ;
!       $colfilter = @$filters[8] if ($column =~ /publicationyear/ ) ;
!       $colfilter = @$filters[9] if ($column =~ /publicationyear/ ) ;
!       $colfilter = @$filters[10] if ($column =~ /items.homebranch/ ) ;
!       $colfilter = @$filters[11] if ($column =~ /items.location/ ) ;
  
  # 1st, loop rows.
--- 307,336 ----
  #     warn "filtres "address@hidden;
        
!       $linefilter[0] = @$filters[0] if ($line =~ /dewey/ )  ;
!       $linefilter[1] = @$filters[1] if ($line =~ /dewey/ )  ;
!       $linefilter[0] = @$filters[2] if ($line =~ /lccn/ )  ;
!       $linefilter[1] = @$filters[3] if ($line =~ /lccn/ )  ;
!       $linefilter[0] = @$filters[4] if ($line =~ /items.itemcallnumber/ )  ;
!       $linefilter[1] = @$filters[5] if ($line =~ /items.itemcallnumber/ )  ;
!       @linefilter[0] = @$filters[6] if ($line =~ /itemtype/ )  ;
!       @linefilter[0] = @$filters[7] if ($line =~ /publishercode/ ) ;
!       $linefilter[0] = @$filters[8] if ($line =~ /publicationyear/ ) ;
!       $linefilter[1] = @$filters[9] if ($line =~ /publicationyear/ ) ;
!       @linefilter[0] = @$filters[10] if ($line =~ /items.homebranch/ ) ;
!       @linefilter[0] = @$filters[11] if ($line =~ /items.location/ ) ;
  # 
!       my @colfilter ;
!       $colfilter[0] = @$filters[0] if ($column =~ /dewey/ )  ;
!       $colfilter[1] = @$filters[1] if ($column =~ /dewey/ )  ;
!       $colfilter[0] = @$filters[2] if ($column =~ /lccn/ )  ;
!       $colfilter[1] = @$filters[3] if ($column =~ /lccn/ )  ;
!       $colfilter[0] = @$filters[4] if ($column =~ /itemcallnumber/ )  ;
!       $colfilter[1] = @$filters[5] if ($column =~ /itemcallnumber/ )  ;
!       @colfilter[0] = @$filters[6] if ($column =~ /itemtype/ )  ;
!       @colfilter[0] = @$filters[7] if ($column =~ /publishercode/ ) ;
!       $colfilter[0] = @$filters[8] if ($column =~ /publicationyear/ ) ;
!       $colfilter[1] = @$filters[9] if ($column =~ /publicationyear/ ) ;
!       @colfilter[0] = @$filters[10] if ($column =~ /items.homebranch/ ) ;
!       @colfilter[0] = @$filters[11] if ($column =~ /items.location/ ) ;
  
  # 1st, loop rows.
***************
*** 325,329 ****
        } elsif (($line=~/lccn/) and ($lccndigits)) {
                $linefield .="left($line,$lccndigits)";
!       } elsif (($line=~/itemcolnumber/) and ($cotedigits)) {
                $linefield .="left($line,$cotedigits)";
        }else {
--- 340,344 ----
        } elsif (($line=~/lccn/) and ($lccndigits)) {
                $linefield .="left($line,$lccndigits)";
!       } elsif (($line=~/items.itemcallnumber/) and ($cotedigits)) {
                $linefield .="left($line,$cotedigits)";
        }else {
***************
*** 334,340 ****
        my $strsth;
        $strsth .= "select distinctrow $linefield from biblioitems, items where 
(items.biblioitemnumber = biblioitems.biblioitemnumber) and $line is not null ";
!       $linefilter =~ s/\*/%/g;
!       if ( $linefilter ) {
!               $strsth .= " and $linefield LIKE ? " ;
        }
        $strsth .=" order by $linefield";
--- 349,360 ----
        my $strsth;
        $strsth .= "select distinctrow $linefield from biblioitems, items where 
(items.biblioitemnumber = biblioitems.biblioitemnumber) and $line is not null ";
!       if ( @linefilter ) {
!               if ($linefilter[1]){
!                       $strsth .= " and $line >= ? " ;
!                       $strsth .= " and $line <= ? " ;
!               } elsif ($linefilter[0]) {
!                       $linefilter[0] =~ s/\*/%/g;
!                       $strsth .= " and $line LIKE ? " ;
!               }
        }
        $strsth .=" order by $linefield";
***************
*** 342,347 ****
        
        my $sth = $dbh->prepare( $strsth );
!       if ( $linefilter ) {
!               $sth->execute($linefilter);
        } else {
                $sth->execute;
--- 362,369 ----
        
        my $sth = $dbh->prepare( $strsth );
!       if (( @linefilter ) and ($linefilter[1])){
!               $sth->execute($linefilter[0],$linefilter[1]);
!       } elsif ($linefilter[0]) {
!               $sth->execute($linefilter[0]);
        } else {
                $sth->execute;
***************
*** 364,368 ****
        }elsif (($column=~/lccn/) and ($lccndigits)) {
                $colfield .="left($column,$lccndigits)";
!       }elsif (($column=~/itemcolnumber/) and ($cotedigits)) {
                $colfield .="left($column,$cotedigits)";
        }else {
--- 386,390 ----
        }elsif (($column=~/lccn/) and ($lccndigits)) {
                $colfield .="left($column,$lccndigits)";
!       }elsif (($column=~/itemcallnumber/) and ($cotedigits)) {
                $colfield .="left($column,$cotedigits)";
        }else {
***************
*** 371,384 ****
        
        my $strsth2;
-       $colfilter =~ s/\*/%/g;
        $strsth2 .= "select distinctrow $colfield from biblioitems, items where 
(items.biblioitemnumber = biblioitems.biblioitemnumber) and $column is not null 
";
!       if ( $colfilter ) {
!               $strsth2 .= " and $colfield LIKE ? ";
        } 
        $strsth2 .= " order by $colfield";
        warn "". $strsth2;
        my $sth2 = $dbh->prepare( $strsth2 );
!       if ($colfilter) {
!               $sth2->execute($colfilter);
        } else {
                $sth2->execute;
--- 393,410 ----
        
        my $strsth2;
        $strsth2 .= "select distinctrow $colfield from biblioitems, items where 
(items.biblioitemnumber = biblioitems.biblioitemnumber) and $column is not null 
";
!       if (( @colfilter ) and ($colfilter[1])) {
!               $strsth2 .= " and $column> ? and $column< ?";
!       }elsif ($colfilter[0]){
!               $colfilter[0] =~ s/\*/%/g;
!               $strsth2 .= " and $column LIKE ? ";
        } 
        $strsth2 .= " order by $colfield";
        warn "". $strsth2;
        my $sth2 = $dbh->prepare( $strsth2 );
!       if ((@colfilter) and ($colfilter[1])) {
!               $sth2->execute($colfilter[0],$colfilter[1]);
!       } elsif ($colfilter[0]){
!               $sth2->execute($colfilter[0]);
        } else {
                $sth2->execute;
***************
*** 419,425 ****
        $strcalc .= " AND lccn <" . @$filters[3] ."" if ( @$filters[3] );
        @$filters[4]=~ s/\*/%/g if (@$filters[4]);
!       $strcalc .= " AND items.itemcolnumber >" . @$filters[4] ."" if ( 
@$filters[4] );
        @$filters[5]=~ s/\*/%/g if (@$filters[5]);
!       $strcalc .= " AND items.itemcolnumber <" . @$filters[5] ."" if ( 
@$filters[5] );
        @$filters[6]=~ s/\*/%/g if (@$filters[6]);
        $strcalc .= " AND biblioitems.itemtype like '" . @$filters[6] ."'" if ( 
@$filters[6] );
--- 445,451 ----
        $strcalc .= " AND lccn <" . @$filters[3] ."" if ( @$filters[3] );
        @$filters[4]=~ s/\*/%/g if (@$filters[4]);
!       $strcalc .= " AND items.itemcallnumber >" . @$filters[4] ."" if ( 
@$filters[4] );
        @$filters[5]=~ s/\*/%/g if (@$filters[5]);
!       $strcalc .= " AND items.itemcallnumber <" . @$filters[5] ."" if ( 
@$filters[5] );
        @$filters[6]=~ s/\*/%/g if (@$filters[6]);
        $strcalc .= " AND biblioitems.itemtype like '" . @$filters[6] ."'" if ( 
@$filters[6] );
***************
*** 438,444 ****
        my $dbcalc = $dbh->prepare($strcalc);
        $dbcalc->execute;
! #     warn "filling table";
        while (my ($row, $col, $value) = $dbcalc->fetchrow) {
! #             warn "filling table $row / $col / $value ";
                $table{$row}->{$col}=$value;
                $table{$row}->{totalrow}+=$value;
--- 464,470 ----
        my $dbcalc = $dbh->prepare($strcalc);
        $dbcalc->execute;
!       warn "filling table";
        while (my ($row, $col, $value) = $dbcalc->fetchrow) {
!               warn "filling table $row / $col / $value ";
                $table{$row}->{$col}=$value;
                $table{$row}->{totalrow}+=$value;
***************
*** 460,468 ****
        }
        
        foreach my $col ( @loopcol ) {
                my $total=0;
!               foreach my $row ( @loopline ) {
                        $total += $table{$row->{rowtitle}}->{$col->{coltitle}};
                }
                push @loopfooter, {'totalcol' => $total};
        }
--- 486,497 ----
        }
        
+       warn "footer processing";
        foreach my $col ( @loopcol ) {
                my $total=0;
!               foreach my $row ( @looprow ) {
                        $total += $table{$row->{rowtitle}}->{$col->{coltitle}};
+                       warn "value added 
".$table{$row->{rowtitle}}->{$col->{coltitle}}. "for line ".$row->{rowtitle};
                }
+               warn "summ for column ".$col->{coltitle}."  = ".$total;
                push @loopfooter, {'totalcol' => $total};
        }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]