Bug 21385: Correctly count all items in basket for booksellers list

To reproduce:

1) Create a basket with 2 biblios, one with 2 items and one with 1 item
2) Search for vendors and note the basket above should contain 'Item
count 3', 'Biblio count 2', 'Items expected 3'
3) Receive shipment, and only receive 1 of the items on the biblio with
2 items above.
4) Search for vendors and note that the 'Item count' for the basket
above is now '2'.

The item count for a closed basket should remain the same and should
differ from the 'items expected' count some items have been recieved.

Signed-off-by: Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Amended patch:
FAIL   C4/Acquisition.pm
   FAIL   spelling
     RECIEVED  ==> RECEIVED

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Martin Renvoize 2018-09-21 15:10:15 +01:00 committed by Nick Clemens
parent 08386cd3f0
commit 17db3ab05c

View file

@ -708,11 +708,13 @@ sub GetBasketsInfosByBookseller {
LEFT JOIN aqorders ON aqorders.basketno = aqbasket.basketno
WHERE booksellerid = ?};
unless ( $allbaskets ) {
$query.=" AND (closedate IS NULL OR (aqorders.quantity > aqorders.quantityreceived AND datecancellationprinted IS NULL))";
}
$query.=" GROUP BY aqbasket.basketno, aqbasket.basketname, aqbasket.note, aqbasket.booksellernote, aqbasket.contractnumber, aqbasket.creationdate, aqbasket.closedate, aqbasket.booksellerid, aqbasket.authorisedby, aqbasket.booksellerinvoicenumber, aqbasket.basketgroupid, aqbasket.deliveryplace, aqbasket.billingplace, aqbasket.branch, aqbasket.is_standing, aqbasket.create_items";
unless ( $allbaskets ) {
# Don't show the basket if it's NOT CLOSED or is FULLY RECEIVED
$query.=" HAVING (closedate IS NULL OR (expected_items > 0))"
}
my $sth = $dbh->prepare($query);
$sth->execute($supplierid);
my $baskets = $sth->fetchall_arrayref({});