From a70320077c7bb9878762e42d39211ab4de8e19dd Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 8 Nov 2019 14:49:48 +0100 Subject: [PATCH] Bug 24002: Incorrect DATE value: '' in C4/Acquisition.pm DBD::mysql::st execute failed: Incorrect DATE value: '' [for Statement " SELECT aqbasket.basketno, aqorders.ordernumber, DATE(aqbasket.closedate) AS orderdate, aqbasket.basketname AS basketname, aqbasket.basketgroupid AS basketgroupid, aqbasketgroups.name AS basketgroupname, aqorders.rrp AS unitpricesupplier, aqorders.ecost AS unitpricelib, aqorders.claims_count AS claims_count, aqorders.claimed_date AS claimed_date, aqbudgets.budget_name AS budget, borrowers.branchcode AS branch, aqbooksellers.name AS supplier, aqbooksellers.id AS supplierid, biblio.author, biblio.title, biblioitems.publishercode AS publisher, biblioitems.publicationyear, ADDDATE(aqbasket.closedate, INTERVAL aqbooksellers.deliverytime DAY) AS estimateddeliverydate, aqorders.quantity - COALESCE(aqorders.quantityreceived,0) AS quantity, (aqorders.quantity - COALESCE(aqorders.quantityreceived,0)) * aqorders.rrp AS subtotal, DATEDIFF(CAST(now() AS date),closedate) AS latesince FROM aqorders LEFT JOIN biblio ON biblio.biblionumber = aqorders.biblionumber LEFT JOIN biblioitems ON biblioitems.biblionumber = biblio.biblionumber LEFT JOIN aqbudgets ON aqorders.budget_id = aqbudgets.budget_id, aqbasket LEFT JOIN borrowers ON aqbasket.authorisedby = borrowers.borrowernumber LEFT JOIN aqbooksellers ON aqbasket.booksellerid = aqbooksellers.id LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid = aqbasketgroups.id WHERE aqorders.basketno = aqbasket.basketno AND ( datereceived = '' OR datereceived IS NULL OR aqorders.quantityreceived < aqorders.quantity ) AND aqbasket.closedate IS NOT NULL AND aqorders.datecancellationprinted IS NULL AND (closedate <= DATE_SUB(CAST(now() AS date),INTERVAL ? DAY)) AND aqorders.quantity - COALESCE(aqorders.quantityreceived,0) <> 0 AND orderstatus <> 'cancelled' ORDER BY latesince, basketno, borrowers.branchcode, supplier" with ParamValues: 0=0] at /kohadevbox/koha/C4/Acquisition.pm line 2248. Signed-off-by: Martin Renvoize --- C4/Acquisition.pm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 4ac0ea0034..fcd590df79 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -2182,8 +2182,7 @@ sub GetLateOrders { LEFT JOIN aqbooksellers ON aqbasket.booksellerid = aqbooksellers.id LEFT JOIN aqbasketgroups ON aqbasket.basketgroupid = aqbasketgroups.id WHERE aqorders.basketno = aqbasket.basketno - AND ( datereceived = '' - OR datereceived IS NULL + AND ( datereceived IS NULL OR aqorders.quantityreceived < aqorders.quantity ) AND aqbasket.closedate IS NOT NULL -- 2.39.5