From 0b5f09316d359e18e295393f62c1bac5f37097b0 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Wed, 19 Feb 2014 12:44:29 +0100 Subject: [PATCH] Bug 7679: Fix two SQL queries when using patron attributes and remove some Perl warnings --- reports/issues_stats.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/reports/issues_stats.pl b/reports/issues_stats.pl index 49f6c96..957c4bb 100755 --- a/reports/issues_stats.pl +++ b/reports/issues_stats.pl @@ -317,8 +317,8 @@ sub calculate { ( $linesource eq 'items' ) ? " LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " : " LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; + $strsth .= " WHERE $line is not null "; } - $strsth .= " WHERE $line is not null "; if ( $line =~ /datetime/ ) { if ( $linefilter[1] and ( $linefilter[0] ) ) { @@ -405,8 +405,8 @@ sub calculate { ( $colsource eq 'items' ) ? "LEFT JOIN items ON (statistics.itemnumber = items.itemnumber) " : "LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) "; + $strsth2 .= " WHERE $column IS NOT NULL "; } - $strsth2 .= " WHERE $column IS NOT NULL "; if ( $column =~ /datetime/ ) { if ( ( $colfilter[1] ) and ( $colfilter[0] ) ) { @@ -605,7 +605,7 @@ sub calculate { for my $col (@loopcol) { my $total = 0; foreach my $row (@looprow) { - $total += table_get(\%table, $row->{rowtitle}, $col->{coltitle}); + $total += table_get(\%table, $row->{rowtitle}, $col->{coltitle}) || 0; $debug and warn "value added " . table_get(\%table, $row->{rowtitle}, $col->{coltitle}) . "for line " . $row->{rowtitle}; } push @loopfooter, { 'totalcol' => $total }; @@ -651,7 +651,7 @@ sub table_get { sub table_inc { my ($table, $row, $col, $inc) = @_; - $table->{ null_to_zzempty(lc($row)) }->{ null_to_zzempty(lc($col)) } += $inc; + $table->{ null_to_zzempty(lc($row // '')) }->{ null_to_zzempty(lc($col // '')) } += $inc; } 1; -- 2.1.4