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 <chris@bigballofwax.co.nz>

Works exactly as designed

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Julian Maurice 2012-08-06 14:20:25 +02:00 committed by Chris Cormack
parent 9dadedb17f
commit e6afce128f
1 changed files with 6 additions and 1 deletions

View File

@ -486,7 +486,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 = ?