Bug 29204: Fix reports/issues_stats.pl for MySQL 8

Error was: Incorrect DATETIME value: ''

Test plan
Go to Reports -> Circulation
On Period select "Row" or "Column" and choose a date
Submit

Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 9a4b7b1948)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 6b7f348125)
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
This commit is contained in:
Jonathan Druart 2021-10-19 11:08:29 +02:00 committed by Victor Grousset/tuxayo
parent 6dbebcb0d8
commit 2df8077f2b
1 changed files with 4 additions and 2 deletions

View File

@ -319,7 +319,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 AND $line != '' ";
$strsth .= " WHERE $line IS NOT NULL ";
$strsth .= " AND $line != '' " if $line ne "datetime";
}
if ( $line =~ /datetime/ ) {
@ -408,7 +409,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 AND $column != '' ";
$strsth .= " WHERE $column IS NOT NULL";
$strsth .= " AND $column != '' " if $column ne "datetime";
}
if ( $column =~ /datetime/ ) {