mirror of
https://github.com/grocy/grocy.git
synced 2025-10-12 16:44:55 +00:00
Added a filter option to only show currently out-of-stock products on /products (closes #2192)
This commit is contained in:
@@ -243,6 +243,10 @@ class StockController extends BaseController
|
||||
{
|
||||
$products = $products->where('id IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)');
|
||||
}
|
||||
if (isset($request->getQueryParams()['only_out_of_stock']))
|
||||
{
|
||||
$products = $products->where('id NOT IN (SELECT product_id from stock_current WHERE amount_aggregated > 0)');
|
||||
}
|
||||
|
||||
$products = $products->orderBy('name', 'COLLATE NOCASE');
|
||||
|
||||
|
Reference in New Issue
Block a user