Change FIFO to "First expiring first, then first in first out"

This commit is contained in:
Bernd Bestel 2017-04-22 21:15:30 +02:00
parent 9e68d38df8
commit b4b29878db

View File

@ -80,7 +80,7 @@ class GrocyLogicStock
$db = Grocy::GetDbConnection();
$productStockAmount = $db->stock()->where('product_id', $productId)->sum('amount');
$potentialStockEntries = $db->stock()->where('product_id', $productId)->orderBy('purchased_date', 'ASC')->fetchAll(); //FIFO
$potentialStockEntries = $db->stock()->where('product_id', $productId)->orderBy('best_before_date', 'ASC')->orderBy('purchased_date', 'ASC')->fetchAll(); //First expiring first, then first in first out
if ($amount > $productStockAmount)
{