From debb80546720294215a47d56f6989cf68cc722e3 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Mon, 6 Aug 2012 14:20:25 +0200 Subject: [PATCH] Bug 8575: Expected items count should not include cancelled orders To test: 1/ create a new basket with 2 orders, one with 1 item, another with 2 items 2/ look at booksellers.pl page, you should see that 3 items are expected 3/ cancel the order with 1 item 4/ refresh booksellers.pl page, it should remains 2 expected items Signed-off-by: Chris Cormack Works exactly as designed Signed-off-by: Paul Poulain --- C4/Acquisition.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/C4/Acquisition.pm b/C4/Acquisition.pm index 9678ffc7cd..f6f58058aa 100644 --- a/C4/Acquisition.pm +++ b/C4/Acquisition.pm @@ -565,7 +565,12 @@ sub GetBasketsInfosByBookseller { SELECT aqbasket.*, SUM(aqorders.quantity) AS total_items, COUNT(DISTINCT aqorders.biblionumber) AS total_biblios, - SUM(IF(aqorders.datereceived IS NULL, aqorders.quantity, 0)) AS expected_items + SUM( + IF(aqorders.datereceived IS NULL + AND aqorders.datecancellationprinted IS NULL + , aqorders.quantity + , 0) + ) AS expected_items FROM aqbasket LEFT JOIN aqorders ON aqorders.basketno = aqbasket.basketno WHERE booksellerid = ? -- 2.39.5