From b5169ae560eed9ee9fb60521f7fe43e723f28880 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 8 Nov 2019 14:46:38 +0100 Subject: [PATCH] Bug 24002: Incorrect DATE value: '0000-00-00' in C4/Acquisition.pm t/db_dependent/Acquisition/close_reopen_basket.t .. DBD::mysql::st execute failed: Incorrect DATE value: '0000-00-00' [for Statement " SELECT COUNT( DISTINCT( biblionumber ) ) FROM aqorders WHERE basketno = ? AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00') " with ParamValues: 0='2'] at /kohadevbox/koha/C4/Acquisition.pm line 3012. DBD::mysql::st execute failed: Incorrect DATE value: '0000-00-00' [for Statement " SELECT COUNT( DISTINCT( biblionumber ) ) FROM aqorders WHERE basketno = ? AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00') " with ParamValues: 0='2'] at /kohadevbox/koha/C4/Acquisition.pm line 3012. And anticipating other failures --- C4/Acquisition.pm | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index a3408883f1..4ac0ea0034 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -681,7 +681,7 @@ sub GetBasketsInfosByBookseller { COUNT(DISTINCT aqorders.biblionumber) AS total_biblios, SUM( IF(aqorders.datereceived IS NULL - AND (aqorders.datecancellationprinted IS NULL OR aqorders.datecancellationprinted='0000-00-00') + AND aqorders.datecancellationprinted IS NULL , aqorders.quantity , 0) ) AS expected_items, @@ -697,7 +697,7 @@ sub GetBasketsInfosByBookseller { $query.=" HAVING (closedate IS NULL OR ( SUM( IF(aqorders.datereceived IS NULL - AND (aqorders.datecancellationprinted IS NULL OR aqorders.datecancellationprinted='0000-00-00') + AND aqorders.datecancellationprinted IS NULL , aqorders.quantity , 0) ) > 0))" @@ -1136,15 +1136,14 @@ sub GetOrders { if ($cancelled) { $orderby ||= q|biblioitems.publishercode, biblio.title|; $query .= q| - AND (datecancellationprinted IS NOT NULL - AND datecancellationprinted <> '0000-00-00') + AND datecancellationprinted IS NOT NULL |; } else { $orderby ||= q|aqorders.datecancellationprinted desc, aqorders.timestamp desc|; $query .= q| - AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00') + AND datecancellationprinted IS NULL |; } @@ -2188,7 +2187,7 @@ sub GetLateOrders { OR aqorders.quantityreceived < aqorders.quantity ) AND aqbasket.closedate IS NOT NULL - AND (aqorders.datecancellationprinted IS NULL OR aqorders.datecancellationprinted='0000-00-00') + AND aqorders.datecancellationprinted IS NULL "; if ($dbdriver eq "mysql") { $select .= " @@ -2396,7 +2395,7 @@ sub GetHistory { $query .= " WHERE 1 "; unless ($get_canceled_order or (defined $orderstatus and $orderstatus eq 'cancelled')) { - $query .= " AND (datecancellationprinted is NULL or datecancellationprinted='0000-00-00') "; + $query .= " AND datecancellationprinted IS NULL "; } my @query_params = (); @@ -3005,7 +3004,7 @@ sub GetBiblioCountByBasketno { SELECT COUNT( DISTINCT( biblionumber ) ) FROM aqorders WHERE basketno = ? - AND (datecancellationprinted IS NULL OR datecancellationprinted='0000-00-00') + AND datecancellationprinted IS NULL "; my $sth = $dbh->prepare($query); -- 2.11.0