From 37bf78c0e783b7d63e42f040f5d03505bb79ee39 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Thu, 19 Dec 2013 15:33:39 +0100 Subject: [PATCH] Bug 7683: Finish the removal of items.statisticvalue Some pieces of code was still referring to items.statisticvalue. Also fix indexes of @filters array --- reports/catalogue_stats.pl | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/reports/catalogue_stats.pl b/reports/catalogue_stats.pl index ea1c635..54ae927 100755 --- a/reports/catalogue_stats.pl +++ b/reports/catalogue_stats.pl @@ -233,7 +233,7 @@ sub calculate { my @loopfilter; for ( my $i = 0 ; $i <= @$filters ; $i++ ) { my %cell; - if ( defined @$filters[$i] and @$filters[$i] ne '' and $i != 16 ) { + if ( defined @$filters[$i] and @$filters[$i] ne '' and $i != 15 ) { if ( ( ( $i == 1 ) or ( $i == 3 ) or ( $i == 5 ) or ( $i == 9 ) ) and ( @$filters[ $i - 1 ] ) ) { $cell{err} = 1 if ( @$filters[$i] < @$filters[ $i - 1 ] ); } @@ -292,11 +292,10 @@ sub calculate { $linefilter[0] = @$filters[12] if ( $line =~ /items\.ccode/ ); $linefilter[0] = @$filters[13] if ( $line =~ /items\.notforloan/ ); $linefilter[0] = @$filters[14] if ( $line =~ /items\.materials/ ); - $linefilter[0] = @$filters[15] if ( $line =~ /items\.statisticvalue/ ); - $linefilter[0] = @$filters[18] if ( $line =~ /items\.dateaccessioned/ ); - $linefilter[1] = @$filters[19] if ( $line =~ /items\.dateaccessioned/ ); - $linefilter[0] = @$filters[20] if ( $line =~ /deleteditems\.timestamp/ ); - $linefilter[1] = @$filters[21] if ( $line =~ /deleteditems\.timestamp/ ); + $linefilter[0] = @$filters[17] if ( $line =~ /items\.dateaccessioned/ ); + $linefilter[1] = @$filters[18] if ( $line =~ /items\.dateaccessioned/ ); + $linefilter[0] = @$filters[19] if ( $line =~ /deleteditems\.timestamp/ ); + $linefilter[1] = @$filters[20] if ( $line =~ /deleteditems\.timestamp/ ); my @colfilter; $colfilter[0] = @$filters[0] if ( $column =~ /dewey/ ); @@ -318,11 +317,10 @@ sub calculate { $colfilter[0] = @$filters[12] if ( $column =~ /items\.ccode/ ); $colfilter[0] = @$filters[13] if ( $column =~ /items\.notforloan/ ); $colfilter[0] = @$filters[14] if ( $column =~ /items\.materials/ ); - $colfilter[0] = @$filters[15] if ( $column =~ /items\.statisticvalue/ ); - $colfilter[0] = @$filters[18] if ( $column =~ /items.dateaccessioned/ ); - $colfilter[1] = @$filters[19] if ( $column =~ /items\.dateaccessioned/ ); - $colfilter[0] = @$filters[20] if ( $column =~ /deleteditems\.timestamp/ ); - $colfilter[1] = @$filters[21] if ( $column =~ /deleteditems\.timestamp/ ); + $colfilter[0] = @$filters[17] if ( $column =~ /items.dateaccessioned/ ); + $colfilter[1] = @$filters[18] if ( $column =~ /items\.dateaccessioned/ ); + $colfilter[0] = @$filters[19] if ( $column =~ /deleteditems\.timestamp/ ); + $colfilter[1] = @$filters[20] if ( $column =~ /deleteditems\.timestamp/ ); # 1st, loop rows. my $origline = $line; @@ -538,25 +536,21 @@ sub calculate { @$filters[14] =~ s/\*/%/g; $strcalc .= " AND $itemstable.materials LIKE '" . @$filters[14] . "'"; } - if ( defined @$filters[15] and @$filters[15] ne '' ) { - @$filters[15] =~ s/\*/%/g; - $strcalc .= " AND $itemstable.statisticvalue LIKE '" . @$filters[15] . "'"; + if ( @$filters[17] ) { + @$filters[17] =~ s/\*/%/g; + $strcalc .= " AND $itemstable.dateaccessioned >= '@$filters[17]' "; } if ( @$filters[18] ) { @$filters[18] =~ s/\*/%/g; - $strcalc .= " AND $itemstable.dateaccessioned >= '@$filters[18]' "; + $strcalc .= " AND $itemstable.dateaccessioned <= '@$filters[18]' "; } - if ( @$filters[19] ) { + if ( $cellvalue eq 'deleteditems' and @$filters[19] ) { @$filters[19] =~ s/\*/%/g; - $strcalc .= " AND $itemstable.dateaccessioned <= '@$filters[19]' "; + $strcalc .= " AND DATE(deleteditems.timestamp) >= '@$filters[19]' "; } if ( $cellvalue eq 'deleteditems' and @$filters[20] ) { @$filters[20] =~ s/\*/%/g; - $strcalc .= " AND DATE(deleteditems.timestamp) >= '@$filters[20]' "; - } - if ( $cellvalue eq 'deleteditems' and @$filters[21] ) { - @$filters[21] =~ s/\*/%/g; - $strcalc .= " AND DATE(deleteditems.timestamp) <= '@$filters[21]' "; + $strcalc .= " AND DATE(deleteditems.timestamp) <= '@$filters[20]' "; } $strcalc .= " group by $linefield, $colfield order by $linefield,$colfield"; $debug and warn "SQL: $strcalc"; -- 1.7.10.4