From 70e0f19f5f790f3e30a2b792414db5cb3e3811d7 Mon Sep 17 00:00:00 2001 From: tipaul Date: Tue, 8 Mar 2005 09:55:29 +0000 Subject: [PATCH] stats ignore null values, this is a preliminary bugfix for this problem --- reports/catalogue_stats.pl | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/reports/catalogue_stats.pl b/reports/catalogue_stats.pl index ef85a8ba03..1a99b4f242 100755 --- a/reports/catalogue_stats.pl +++ b/reports/catalogue_stats.pl @@ -460,7 +460,7 @@ sub calculate { } # preparing calculation - my $strcalc .= "SELECT $linefield, $colfield, count( * ) FROM biblioitems, items WHERE (items.biblioitemnumber = biblioitems.biblioitemnumber) AND $line is not null AND $column is not null"; + my $strcalc .= "SELECT $linefield, $colfield, count( * ) FROM biblioitems, items WHERE (items.biblioitemnumber = biblioitems.biblioitemnumber) "; @$filters[0]=~ s/\*/%/g if (@$filters[0]); $strcalc .= " AND dewey >" . @$filters[0] ."" if ( @$filters[0] ); @$filters[1]=~ s/\*/%/g if (@$filters[1]); @@ -486,17 +486,24 @@ sub calculate { @$filters[11]=~ s/\*/%/g if (@$filters[11]); $strcalc .= " AND items.location like '" . @$filters[11] ."'" if ( @$filters[11] ); $strcalc .= " group by $linefield, $colfield order by $linefield,$colfield"; -# warn "". $strcalc; + warn "". $strcalc; my $dbcalc = $dbh->prepare($strcalc); $dbcalc->execute; # warn "filling table"; while (my ($row, $col, $value) = $dbcalc->fetchrow) { # warn "filling table $row / $col / $value "; + $row="ZZEMPTY" unless $row; + $col="ZZEMPTY" unless $col; $table{$row}->{$col}=$value; $table{$row}->{totalrow}+=$value; $grantotal += $value; } + my %cell = {rowtitle => 'ZZEMPTY'}; + push @loopline,\%cell; + my %cell = {coltitle => 'ZZEMPTY'}; + push @loopcol,\%cell; + foreach my $row ( sort keys %table ) { my @loopcell; #@loopcol ensures the order for columns is common with column titles -- 2.39.5