[Koha-cvs] CVS: koha/reports cat_issues_top.pl,1.2,1.3 bor_issues_top.pl,1.2,1.3

Henri-Damien LAURENT hdl at users.sourceforge.net
Tue Mar 29 19:20:06 CEST 2005


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

Modified Files:
	cat_issues_top.pl bor_issues_top.pl 
Log Message:
Improving top lists display

Index: cat_issues_top.pl
===================================================================
RCS file: /cvsroot/koha/koha/reports/cat_issues_top.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** cat_issues_top.pl	24 Mar 2005 15:19:48 -0000	1.2
--- cat_issues_top.pl	29 Mar 2005 17:20:03 -0000	1.3
***************
*** 272,276 ****
  		foreach my $col ( @loopcol ) {
  #			warn " init table : $row->{rowtitle} / $col->{coltitle} ";
! 			$table[$i]->{($col->{coltitle})?$col->{coltitle}:"total"}=0;
  		}
  	}
--- 272,276 ----
  		foreach my $col ( @loopcol ) {
  #			warn " init table : $row->{rowtitle} / $col->{coltitle} ";
! 			$table[$i]->{($col->{coltitle})?$col->{coltitle}:"total"}->{'name'}=0;
  		}
  	}
***************
*** 281,287 ****
  	
  # Processing average loanperiods
! 	$strcalc .= "SELECT CONCAT( biblioitems.biblioitemnumber) , COUNT(*) AS RANK";
  	$strcalc .= " , $colfield " if ($colfield);
! 	$strcalc .= " FROM `issues`,borrowers,biblioitems LEFT JOIN items ON (biblioitems.biblioitemnumber=items.biblioitemnumber) LEFT JOIN issuingrules ON (issuingrules.branchcode=issues.branchcode AND  issuingrules.itemtype=biblioitems.itemtype AND  issuingrules.categorycode=borrowers.categorycode) WHERE issues.itemnumber=items.itemnumber AND issues.borrowernumber=borrowers.borrowernumber and returndate is not null";
  
   	@$filters[0]=~ s/\*/%/g if (@$filters[0]);
--- 281,287 ----
  	
  # Processing average loanperiods
! 	$strcalc .= "SELECT biblio.title, COUNT(*) AS RANK, biblio.biblionumber AS ID";
  	$strcalc .= " , $colfield " if ($colfield);
! 	$strcalc .= " FROM `issues`,borrowers,(items LEFT JOIN biblioitems ON biblioitems.biblioitemnumber=items.biblioitemnumber) LEFT JOIN biblio ON (biblio.biblionumber=items.biblionumber) WHERE issues.itemnumber=items.itemnumber AND issues.borrowernumber=borrowers.borrowernumber and returndate is not null";
  
   	@$filters[0]=~ s/\*/%/g if (@$filters[0]);
***************
*** 324,359 ****
  	my $i=1;
  	while (my  @data = $dbcalc->fetchrow) {
! 		my ($row, $rank, $col )=@data;
! #		warn "filling table $row / $col / $issuedate / $returndate /$weight";
  		$col = "zzEMPTY" if ($col eq undef);
  		$i=1 if (($previous_col) and not($col eq $previous_col));
! 		$table[$i]->{$col}=$row;
  #		warn " ".$i." ".$col. " ".$row;
  		$i++;
  		$previous_col=$col;
- #		$table{$row}->{totalrow}+=$weight*$loanlength;
  	}
  	
! 	push @loopcol,{coltitle => "Global"} if not ($column);
  	
  	for ($i=1; $i<=$line;$i++) {
- 		warn " ".$i;
  		my @loopcell;
  		#@loopcol ensures the order for columns is common with column titles
  		# and the number matches the number of columns
  		my $colcount=0;
  		foreach my $col ( @loopcol ) {
  			my $value;
  			if (@loopcol){
! 				#warn " test ".(($col->{coltitle} eq "NULL") or ($col->{coltitle} eq "Global"))?"zzEMPTY":$col->{coltitle};
! 				$value =$table[$i]->{(($col->{coltitle} eq "NULL") or ($col->{coltitle} eq "Global"))?"zzEMPTY":$col->{coltitle}};
  			} else {
! 				$value =$table[$i]->{"zzEMPTY"};
  			}
! #			$table{$row}->{(($col->{coltitle} eq "NULL")or ($col->{coltitle} eq ""))?"zzEMPTY":$col->{coltitle}} = $value;
! 			#$table{$row}->{totalrow}+=$value;
! 			#warn "row : $row col:$col  $cnttable{$row}->{(($col->{coltitle} eq \"NULL\")or ($col->{coltitle} eq \"\"))?\"zzEMPTY\":$col->{coltitle}}";
! #			$colcount+=$cnttable{$row}->{(($col->{coltitle} eq "NULL")or ($col->{coltitle} eq ""))?"zzEMPTY":$col->{coltitle}};
! 			push @loopcell, {value => $value} ;
  		}
  		#warn "row : $row colcount:$colcount";
--- 324,362 ----
  	my $i=1;
  	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 eq "") or ($row eq undef))?"Title":$row;
! 		$table[$i]->{$col}->{'count'}=$rank;
! 		$table[$i]->{$col}->{'link'}=$id;
  #		warn " ".$i." ".$col. " ".$row;
  		$i++;
  		$previous_col=$col;
  	}
  	
! 	push @loopcol,{coltitle => "Global"} if not($column);
  	
  	for ($i=1; $i<=$line;$i++) {
  		my @loopcell;
+ 		warn " $i";
  		#@loopcol ensures the order for columns is common with column titles
  		# and the number matches the number of columns
  		my $colcount=0;
  		foreach my $col ( @loopcol ) {
+ #			warn " colonne :$col->{coltitle}";
  			my $value;
+ 			my $count=0;
+ 			my $link;
  			if (@loopcol){
! 				$value =$table[$i]->{(($col->{coltitle} eq "NULL") or ($col->{coltitle} eq "Global"))?"zzEMPTY":$col->{coltitle}}->{'name'};
! 				$count =$table[$i]->{(($col->{coltitle} eq "NULL") or ($col->{coltitle} eq "Global"))?"zzEMPTY":$col->{coltitle}}->{'count'};
! 				$link =$table[$i]->{(($col->{coltitle} eq "NULL") or ($col->{coltitle} eq "Global"))?"zzEMPTY":$col->{coltitle}}->{'link'};
  			} else {
! 				$value =$table[$i]->{"zzEMPTY"}->{'name'};
! 				$count =$table[$i]->{"zzEMPTY"}->{'count'};
! 				$link =$table[$i]->{"zzEMPTY"}->{'link'};
  			}
! #			warn " ".$i ." value:$value count:$count reference:$link";
! 			push @loopcell, {value => $value, count =>$count, reference => $link} ;
  		}
  		#warn "row : $row colcount:$colcount";

Index: bor_issues_top.pl
===================================================================
RCS file: /cvsroot/koha/koha/reports/bor_issues_top.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** bor_issues_top.pl	24 Mar 2005 15:19:48 -0000	1.2
--- bor_issues_top.pl	29 Mar 2005 17:20:03 -0000	1.3
***************
*** 240,258 ****
  		
  		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;
! 		}
! 		
  	
  		while (my ($celvalue) = $sth2->fetchrow) {
  			my %cell;
- 	#		my %ft;
- 	#		warn "coltitle :".$celvalue;
  			$cell{coltitle} = $celvalue;
- 	#		$ft{totalcol} = 0;
  			push @loopcol, \%cell;
  		}
--- 240,248 ----
  		
  		my $sth2 = $dbh->prepare( $strsth2 );
! 		$sth2->execute;
  	
  		while (my ($celvalue) = $sth2->fetchrow) {
  			my %cell;
  			$cell{coltitle} = $celvalue;
  			push @loopcol, \%cell;
  		}
***************
*** 271,275 ****
  		foreach my $col ( @loopcol ) {
  #			warn " init table : $row->{rowtitle} / $col->{coltitle} ";
! 			$table[$i]->{($col->{coltitle})?$col->{coltitle}:"total"}=0;
  		}
  	}
--- 261,265 ----
  		foreach my $col ( @loopcol ) {
  #			warn " init table : $row->{rowtitle} / $col->{coltitle} ";
! 			$table[$i]->{($col->{coltitle})?$col->{coltitle}:"total"}->{'name'}=0;
  		}
  	}
***************
*** 280,286 ****
  	
  # Processing average loanperiods
! 	$strcalc .= "SELECT CONCAT( borrowers.surname , \"\\t\",borrowers.firstname, \"\\t\", borrowers.cardnumber) , COUNT(*) AS RANK";
  	$strcalc .= " , $colfield " if ($colfield);
! 	$strcalc .= " FROM `issues`,borrowers,biblioitems LEFT JOIN items ON (biblioitems.biblioitemnumber=items.biblioitemnumber) LEFT JOIN issuingrules ON (issuingrules.branchcode=issues.branchcode AND  issuingrules.itemtype=biblioitems.itemtype AND  issuingrules.categorycode=borrowers.categorycode) WHERE issues.itemnumber=items.itemnumber AND issues.borrowernumber=borrowers.borrowernumber and returndate is not null";
  
   	@$filters[0]=~ s/\*/%/g if (@$filters[0]);
--- 270,276 ----
  	
  # Processing average loanperiods
! 	$strcalc .= "SELECT  CONCAT(borrowers.surname , \"\\t\",borrowers.firstname),  COUNT(*) AS RANK, borrowers.borrowernumber AS ID";
  	$strcalc .= " , $colfield " if ($colfield);
! 	$strcalc .= " FROM `issues`,borrowers,biblioitems LEFT JOIN items ON (biblioitems.biblioitemnumber=items.biblioitemnumber)  WHERE issues.itemnumber=items.itemnumber AND issues.borrowernumber=borrowers.borrowernumber and returndate is not null";
  
   	@$filters[0]=~ s/\*/%/g if (@$filters[0]);
***************
*** 323,330 ****
  	my $i=1;
  	while (my  @data = $dbcalc->fetchrow) {
! 		my ($row, $rank, $col )=@data;
  		$col = "zzEMPTY" if ($col eq undef);
  		$i=1 if (($previous_col) and not($col eq $previous_col));
! 		$table[$i]->{$col}=$row;
  		warn " ".$i." ".$col. " ".$row;
  		$i++;
--- 313,322 ----
  	my $i=1;
  	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;
  		warn " ".$i." ".$col. " ".$row;
  		$i++;
***************
*** 335,351 ****
  	
  	for ($i=1; $i<=$line;$i++) {
- 		warn " ".$i;
  		my @loopcell;
  		#@loopcol ensures the order for columns is common with column titles
  		# and the number matches the number of columns
  		my $colcount=0;
  		foreach my $col ( @loopcol ) {
  			my $value;
  			if (@loopcol){
! 				$value =$table[$i]->{(($col->{coltitle} eq "NULL") or ($col->{coltitle} eq "Global"))?"zzEMPTY":$col->{coltitle}};
  			} else {
! 				$value =$table[$i]->{"zzEMPTY"};
  			}
! 			push @loopcell, {value => $value} ;
  		}
  		push @looprow,{ 'rowtitle' => $i ,
--- 327,351 ----
  	
  	for ($i=1; $i<=$line;$i++) {
  		my @loopcell;
+ 		warn " $i";
  		#@loopcol ensures the order for columns is common with column titles
  		# and the number matches the number of columns
  		my $colcount=0;
  		foreach my $col ( @loopcol ) {
+ #			warn " colonne :$col->{coltitle}";
  			my $value;
+ 			my $count=0;
+ 			my $link;
  			if (@loopcol){
! 				$value =$table[$i]->{(($col->{coltitle} eq "NULL") or ($col->{coltitle} eq "Global"))?"zzEMPTY":$col->{coltitle}}->{'name'};
! 				$count =$table[$i]->{(($col->{coltitle} eq "NULL") or ($col->{coltitle} eq "Global"))?"zzEMPTY":$col->{coltitle}}->{'count'};
! 				$link =$table[$i]->{(($col->{coltitle} eq "NULL") or ($col->{coltitle} eq "Global"))?"zzEMPTY":$col->{coltitle}}->{'link'};
  			} else {
! 				$value =$table[$i]->{"zzEMPTY"}->{'name'};
! 				$count =$table[$i]->{"zzEMPTY"}->{'count'};
! 				$link =$table[$i]->{"zzEMPTY"}->{'link'};
  			}
! #			warn " ".$i ." value:$value count:$count reference:$link";
! 			push @loopcell, {value => $value, count =>$count, reference => $link} ;
  		}
  		push @looprow,{ 'rowtitle' => $i ,





More information about the Koha-cvs mailing list