https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37706

            Bug ID: 37706
           Summary: Date filter not used in circulation report
 Change sponsored?: ---
           Product: Koha
           Version: 23.11
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: Reports
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]

I noticed that the cirulation report was putting a significant load on the
system so I added some debug logging to reports/issues_stats.pl to see what was
going on:

    use Data::Dumper;
    warn Dumper([$line, $column, $podsp, $type, $daysel, $monthsel, $calc,
\@filters, $attribute_filters]);
    my $results = calculate( $line, $column, $podsp, $type, $daysel, $monthsel,
$calc, \@filters, $attribute_filters);


and:

    warn "strsth: $strsth";
    my $sth = $dbh->prepare($strsth);

and:

    warn "strsth2: $strsth2";
    my $sth2 = $dbh->prepare($strsth2);

As you can see a filter was selected for the date period:


2024/08/22 08:02:52] [WARN] $VAR1 = [
  'branch',
  'itemtype',
  '',
  'issue',
  '',
  '',
  '1',
  [
    '2024-08-21',
    '2024-08-21',
  ...

We get a warnings because the date validation tries to numerically compare the
date strings (which will cause the validation to always succeed even when
selecting a start date greater than the end date):

[2024/08/22 08:02:52] [WARN] Argument "2024-08-21" isn't numeric in numeric lt
(<) at /usr/share/koha/intranet/cgi-bin/reports/issues_stats.pl line 216.
[2024/08/22 08:02:52] [WARN] Argument "2024-08-21" isn't numeric in numeric lt
(<) at /usr/share/koha/intranet/cgi-bin/reports/issues_stats.pl line 216.

But neither sql queries refer to the selected date period:

[2024/08/22 08:02:52] [WARN] strsth: SELECT distinctrow branch FROM statistics 
LEFT JOIN borrowers ON (statistics.borrowernumber = borrowers.borrowernumber) 
WHERE branch IS NOT NULL  AND branch != ''  AND branch LIKE ?  group by branch
order by branch  at /usr/share/koha/intranet/cgi-bin/reports/issues_stats.pl
line 327.
[2024/08/22 08:03:28] [WARN] strsth2: SELECT distinctrow itemtype FROM
statistics LEFT JOIN borrowers ON (statistics.borrowernumber =
borrowers.borrowernumber)  WHERE itemtype IS NOT NULL AND itemtype != ''  group
by itemtype order by itemtype  at
/usr/share/koha/intranet/cgi-bin/reports/issues_stats.pl line 418.

So, the date filter is not actually used (other than for claiming that it was
used in the generated report).

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to