From 916e9f4619229da80d7d8c45cecb77fc7db61816 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 Signed-off-by: Katrin Fischer Signed-off-by: Kyle M Hall --- 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 9c64c4a08d..15cb8a6adb 100755 --- a/reports/issues_stats.pl +++ b/reports/issues_stats.pl @@ -320,8 +320,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] ) ) { @@ -408,8 +408,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] ) ) { @@ -608,7 +608,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 }; @@ -654,7 +654,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.39.5