[Koha-cvs] CVS: koha/reports issues_stats.pl,1.8,1.9

Henri-Damien LAURENT hdl at users.sourceforge.net
Wed Jul 20 11:52:34 CEST 2005


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

Modified Files:
	issues_stats.pl 
Log Message:
Adding Borrowers count feature.
Note : This COULD be reported in 2.2 branch.


Index: issues_stats.pl
===================================================================
RCS file: /cvsroot/koha/koha/reports/issues_stats.pl,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** issues_stats.pl	18 Mar 2005 15:36:25 -0000	1.8
--- issues_stats.pl	20 Jul 2005 09:52:31 -0000	1.9
***************
*** 308,312 ****
  	if (($line =~/datetime/) and ($dsp == 1)) {
  		#Display by day
! 		$linefield .="concat(weekday($line),' ',dayname($line))";  
  	} elsif (($line=~/datetime/) and ($dsp == 2)) {
  		#Display by Month
--- 308,312 ----
  	if (($line =~/datetime/) and ($dsp == 1)) {
  		#Display by day
! 		$linefield .="dayname($line)";  
  	} elsif (($line=~/datetime/) and ($dsp == 2)) {
  		#Display by Month
***************
*** 321,325 ****
  	}  
  	my $lineorder = $linefield;
! 	$lineorder = "weekday($line)" if $lineorder =~ "^dayname";
  
   	my $strsth;
--- 321,327 ----
  	}  
  	my $lineorder = $linefield;
! 	$lineorder = "weekday($line)" if $linefield =~ /dayname/;
! 	$lineorder = "month($line)" if $linefield =~ "^month";
! 	$lineorder = $linefield if (not ($linefield =~ "^month") and not($linefield =~ /dayname/));
  
   	my $strsth;
***************
*** 366,370 ****
  
  # 2nd, loop cols.
! 	my $colfield;                               
  	if (($column =~/datetime/) and ($dsp == 1)) {
  		#Display by day
--- 368,373 ----
  
  # 2nd, loop cols.
! 	my $colfield;
! 	my $colorder;                               
  	if (($column =~/datetime/) and ($dsp == 1)) {
  		#Display by day
***************
*** 381,384 ****
--- 384,390 ----
  		$colfield .= $column;
  	}  
+ 	$colorder = "weekday($line)" if $colfield =~ "^dayname";
+ 	$colorder = "month($line)" if $colfield =~ "^month";
+ 	$colorder = $colfield if (not ($colfield =~ "^month") and not($colfield =~ "^dayname"));
  	
   	my $strsth2;
***************
*** 401,405 ****
   	}
  	$strsth2 .=" group by $colfield";
! 	$strsth2 .=" order by $colfield";
  #	warn "". $strsth2;
  	
--- 407,411 ----
   	}
  	$strsth2 .=" group by $colfield";
! 	$strsth2 .=" order by $colorder";
  #	warn "". $strsth2;
  	
***************
*** 444,447 ****
--- 450,456 ----
  	$strcalc .= "SELECT $linefield, $colfield, ";
  	$strcalc .= "COUNT( * ) " if ($process ==1);
+ 	if ($process ==2){
+ 		$strcalc .= "(COUNT(DISTINCT borrowers.borrowernumber))" ;
+ 	}
  	if ($process ==3){
  		my $rqbookcount = $dbh->prepare("SELECT count(*) FROM items");
***************
*** 470,474 ****
  	$strcalc .= " AND statistics.type like '" . $type ."'" if ( $type );
  	
! 	$strcalc .= " group by $linefield, $colfield order by $lineorder,$colfield";
  	warn "". $strcalc;
  	my $dbcalc = $dbh->prepare($strcalc);
--- 479,483 ----
  	$strcalc .= " AND statistics.type like '" . $type ."'" if ( $type );
  	
! 	$strcalc .= " group by $linefield, $colfield order by $lineorder,$colorder";
  	warn "". $strcalc;
  	my $dbcalc = $dbh->prepare($strcalc);
***************
*** 477,481 ****
  	my $emptycol; 
  	while (my ($row, $col, $value) = $dbcalc->fetchrow) {
! #		warn "filling table $row / $col / $value ";
  		$emptycol = 1 if ($col eq undef);
  		$col = "zzEMPTY" if ($col eq undef);
--- 486,490 ----
  	my $emptycol; 
  	while (my ($row, $col, $value) = $dbcalc->fetchrow) {
! 		warn "filling table $row / $col / $value ";
  		$emptycol = 1 if ($col eq undef);
  		$col = "zzEMPTY" if ($col eq undef);
***************
*** 488,503 ****
  	push @loopcol,{coltitle => "NULL"} if ($emptycol);
  
! 	foreach my $row ( sort keys %table ) {
  		my @loopcell;
  		#@loopcol ensures the order for columns is common with column titles
  		# and the number matches the number of columns
  		foreach my $col ( @loopcol ) {
! 			my $value =$table{$row}->{($col->{coltitle} eq "NULL")?"zzEMPTY":$col->{coltitle}};
  			push @loopcell, {value => $value  } ;
  		}
! 		push @looprow,{ 'rowtitle' => ($row eq "zzEMPTY")?"NULL":$row,
  							'loopcell' => \@loopcell,
  							'hilighted' => ($hilighted >0),
! 							'totalrow' => $table{$row}->{totalrow}
  						};
  		$hilighted = -$hilighted;
--- 497,512 ----
  	push @loopcol,{coltitle => "NULL"} if ($emptycol);
  
! 	foreach my $row (@loopline) {
  		my @loopcell;
  		#@loopcol ensures the order for columns is common with column titles
  		# and the number matches the number of columns
  		foreach my $col ( @loopcol ) {
! 			my $value =$table{($row->{rowtitle} eq "NULL")?"zzEMPTY":$row->{rowtitle}}->{($col->{coltitle} eq "NULL")?"zzEMPTY":$col->{coltitle}};
  			push @loopcell, {value => $value  } ;
  		}
! 		push @looprow,{ 'rowtitle' => ($row->{rowtitle} eq "NULL")?"zzEMPTY":$row->{rowtitle},
  							'loopcell' => \@loopcell,
  							'hilighted' => ($hilighted >0),
! 							'totalrow' => $table{($row->{rowtitle} eq "NULL")?"zzEMPTY":$row->{rowtitle}}->{totalrow}
  						};
  		$hilighted = -$hilighted;





More information about the Koha-cvs mailing list