From a0c6e9ac842bca09d0f8612a31e5dd376b7dd712 Mon Sep 17 00:00:00 2001 From: Andrew Fuerste-Henry Date: Thu, 27 Aug 2020 18:03:14 +0000 Subject: [PATCH] Bug 17801: Use issuedate for limits in Most Circulated Items To test: 1 - Have two checkouts in old_issues issue 1: timestamp 2020-08-01 00:00:00, issuedate 2019-08-01 00:00:00 issue 2: timestamp 2020-07-01 00:00:00, issuedate 2019-07-01 00:00:00 2 - Perform a Most Circulated Items search for checkout dates 2020-06-01 to 2020-09-01. Both checkouts appear in search 3 - Repeat search with checkout dates 2019-06-01 to 2019-09-01. Neither checkout appears in search 4 - apply patch, restart all 5 - Repeat search with checkout dates 2020-06-01 to 2020-09-01. Neither checkout appears in search 6 - Repeat search with checkout dates 2019-06-01 to 2019-09-01. Both checkouts appears in search Signed-off-by: Fridolin Somers Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart (cherry picked from commit 89cc457ca25e0fbaccba28b249ceedeef6573abf) Signed-off-by: Lucas Gass (cherry picked from commit ce0988970945b063b514e26d41abd2fbe108177e) Signed-off-by: Aleisha Amohia --- reports/cat_issues_top.pl | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/reports/cat_issues_top.pl b/reports/cat_issues_top.pl index 0792a28c6d..596ea00449 100755 --- a/reports/cat_issues_top.pl +++ b/reports/cat_issues_top.pl @@ -194,14 +194,14 @@ sub calculate { my $colfield; my $colorder; if ($column){ - $column = "old_issues.".$column if (($column=~/branchcode/) or ($column=~/timestamp/)); + $column = "old_issues.".$column if (($column=~/branchcode/) or ($column=~/issuedate/)); if($column=~/itemtype/){ $column = C4::Context->preference('item-level_itypes') ? "items.itype": "biblioitems.itemtype"; } $column = "borrowers.".$column if $column=~/categorycode/; my @colfilter ; - $colfilter[0] = @$filters[0] if ($column =~ /timestamp/ ) ; - $colfilter[1] = @$filters[1] if ($column =~ /timestamp/ ) ; + $colfilter[0] = @$filters[0] if ($column =~ /issuedate/ ) ; + $colfilter[1] = @$filters[1] if ($column =~ /issuedate/ ) ; $colfilter[0] = @$filters[2] if ($column =~ /returndate/ ) ; $colfilter[1] = @$filters[3] if ($column =~ /returndate/ ) ; $colfilter[0] = @$filters[4] if ($column =~ /branch/ ) ; @@ -212,25 +212,25 @@ sub calculate { $colfilter[0] = @$filters[8] if ($column =~ /category/ ) ; # This commented out row (sort2) was not removed when adding new filters for ccode, shelving location and call number # $colfilter[0] = @$filters[11] if ($column =~ /sort2/ ) ; - $colfilter[0] = @$filters[9] if ($column =~ /timestamp/ ) ; - $colfilter[0] = @$filters[10] if ($column =~ /timestamp/ ) ; - $colfilter[0] = @$filters[11] if ($column =~ /timestamp/ ) ; + $colfilter[0] = @$filters[9] if ($column =~ /issuedate/ ) ; + $colfilter[0] = @$filters[10] if ($column =~ /issuedate/ ) ; + $colfilter[0] = @$filters[11] if ($column =~ /issuedate/ ) ; #warn "filtre col ".$colfilter[0]." ".$colfilter[1]; # loop cols. if ($column eq "Day") { #Display by day - $column = "old_issues.timestamp"; + $column = "old_issues.issuedate"; $colfield .="dayname($column)"; $colorder .="weekday($column)"; } elsif ($column eq "Month") { #Display by Month - $column = "old_issues.timestamp"; + $column = "old_issues.issuedate"; $colfield .="monthname($column)"; $colorder .="month($column)"; } elsif ($column eq "Year") { #Display by Year - $column = "old_issues.timestamp"; + $column = "old_issues.issuedate"; $colfield .="Year($column)"; $colorder .= $column; } else { @@ -245,7 +245,7 @@ sub calculate { LEFT JOIN items ON old_issues.itemnumber=items.itemnumber LEFT JOIN biblioitems ON biblioitems.biblioitemnumber=items.biblioitemnumber WHERE 1"; - if (($column=~/timestamp/) or ($column=~/returndate/)){ + if (($column=~/issuedate/) or ($column=~/returndate/)){ if ($colfilter[1] and ($colfilter[0])){ $strsth2 .= " and $column between '$colfilter[0]' and '$colfilter[1]' " ; } elsif ($colfilter[1]) { @@ -311,9 +311,9 @@ sub calculate { WHERE 1"; @$filters[0]=~ s/\*/%/g if (@$filters[0]); - $strcalc .= " AND old_issues.timestamp > '" . @$filters[0] ."'" if ( @$filters[0] ); + $strcalc .= " AND old_issues.issuedate > '" . @$filters[0] ."'" if ( @$filters[0] ); @$filters[1]=~ s/\*/%/g if (@$filters[1]); - $strcalc .= " AND old_issues.timestamp < '" . @$filters[1] ."'" if ( @$filters[1] ); + $strcalc .= " AND old_issues.issuedate < '" . @$filters[1] ."'" if ( @$filters[1] ); @$filters[2]=~ s/\*/%/g if (@$filters[2]); $strcalc .= " AND old_issues.returndate > '" . @$filters[2] ."'" if ( @$filters[2] ); @$filters[3]=~ s/\*/%/g if (@$filters[3]); @@ -338,11 +338,11 @@ sub calculate { @$filters[9]=~ s/\*/%/g if (@$filters[9]); $strcalc .= " AND borrowers.categorycode like '" . @$filters[9] ."'" if ( @$filters[9] ); @$filters[10]=~ s/\*/%/g if (@$filters[10]); - $strcalc .= " AND dayname(old_issues.timestamp) like '" . @$filters[10]."'" if (@$filters[10]); + $strcalc .= " AND dayname(old_issues.issuedate) like '" . @$filters[10]."'" if (@$filters[10]); @$filters[11]=~ s/\*/%/g if (@$filters[11]); - $strcalc .= " AND monthname(old_issues.timestamp) like '" . @$filters[11]."'" if (@$filters[11]); + $strcalc .= " AND monthname(old_issues.issuedate) like '" . @$filters[11]."'" if (@$filters[11]); @$filters[12]=~ s/\*/%/g if (@$filters[12]); - $strcalc .= " AND year(old_issues.timestamp) like '" . @$filters[12] ."'" if ( @$filters[12] ); + $strcalc .= " AND year(old_issues.issuedate) like '" . @$filters[12] ."'" if ( @$filters[12] ); $strcalc .= " group by biblio.biblionumber"; $strcalc .= ", $colfield" if ($column); -- 2.39.5