mirror of
https://github.com/grocy/grocy.git
synced 2025-04-29 09:39:57 +00:00
Fixed stock overview page status button counters related to the product option "Never show on stock overview" (fixes #1956)
This commit is contained in:
parent
5b53175ed6
commit
57d70851c8
@ -11,6 +11,7 @@
|
||||
- Fixed that the average shelf life of a product (on the productcard) was wrong when the corresponding stock entry was edited
|
||||
- Fixed that when the stock setting "Decimal places allowed for amounts" was set to `0`, unit conversion (if any) failed when adding the corresponding product to stock
|
||||
- Fixed that consuming a parent product which is not in stock itself (so essentially using any of the child products) may failed when unit conversions were involved (the current stock amount check was wrong in that case)
|
||||
- Fixed that the status button counters on the stock overview page ("X products are overdue" and so on) included products which have the option `Never show on stock overview` enabled
|
||||
|
||||
### Shopping list
|
||||
|
||||
@ -55,4 +56,5 @@
|
||||
|
||||
### API
|
||||
|
||||
- xxx
|
||||
- Endpoint `/stock/volatile`
|
||||
- The field/property `missing_products` now also contains the `product` object
|
||||
|
@ -267,10 +267,15 @@ function RefreshStatistics()
|
||||
Grocy.Api.Get('stock/volatile?due_soon_days=' + nextXDays,
|
||||
function(result)
|
||||
{
|
||||
$("#info-duesoon-products").html('<span class="d-block d-md-none">' + result.due_products.length + ' <i class="fa-solid fa-clock"></i></span><span class="d-none d-md-block">' + __n(result.due_products.length, '%s product is due', '%s products are due') + ' ' + __n(nextXDays, 'within the next day', 'within the next %s days') + '</span>');
|
||||
$("#info-overdue-products").html('<span class="d-block d-md-none">' + result.overdue_products.length + ' <i class="fa-solid fa-times-circle"></i></span><span class="d-none d-md-block">' + __n(result.overdue_products.length, '%s product is overdue', '%s products are overdue') + '</span>');
|
||||
$("#info-expired-products").html('<span class="d-block d-md-none">' + result.expired_products.length + ' <i class="fa-solid fa-times-circle"></i></span><span class="d-none d-md-block">' + __n(result.expired_products.length, '%s product is expired', '%s products are expired') + '</span>');
|
||||
$("#info-missing-products").html('<span class="d-block d-md-none">' + result.missing_products.length + ' <i class="fa-solid fa-exclamation-circle"></i></span><span class="d-none d-md-block">' + __n(result.missing_products.length, '%s product is below defined min. stock amount', '%s products are below defined min. stock amount') + '</span>');
|
||||
var dueProducts = result.due_products.filter(x => !BoolVal(x.product.hide_on_stock_overview));
|
||||
var overdueProducts = result.overdue_products.filter(x => !BoolVal(x.product.hide_on_stock_overview));
|
||||
var expiredProducts = result.expired_products.filter(x => !BoolVal(x.product.hide_on_stock_overview));
|
||||
var missingProducts = result.missing_products.filter(x => !BoolVal(x.product.hide_on_stock_overview));
|
||||
|
||||
$("#info-duesoon-products").html('<span class="d-block d-md-none">' + dueProducts.length + ' <i class="fa-solid fa-clock"></i></span><span class="d-none d-md-block">' + __n(dueProducts.length, '%s product is due', '%s products are due') + ' ' + __n(nextXDays, 'within the next day', 'within the next %s days') + '</span>');
|
||||
$("#info-overdue-products").html('<span class="d-block d-md-none">' + overdueProducts.length + ' <i class="fa-solid fa-times-circle"></i></span><span class="d-none d-md-block">' + __n(overdueProducts.length, '%s product is overdue', '%s products are overdue') + '</span>');
|
||||
$("#info-expired-products").html('<span class="d-block d-md-none">' + expiredProducts.length + ' <i class="fa-solid fa-times-circle"></i></span><span class="d-none d-md-block">' + __n(expiredProducts.length, '%s product is expired', '%s products are expired') + '</span>');
|
||||
$("#info-missing-products").html('<span class="d-block d-md-none">' + missingProducts.length + ' <i class="fa-solid fa-exclamation-circle"></i></span><span class="d-none d-md-block">' + __n(missingProducts.length, '%s product is below defined min. stock amount', '%s products are below defined min. stock amount') + '</span>');
|
||||
},
|
||||
function(xhr)
|
||||
{
|
||||
|
@ -677,7 +677,16 @@ class StockService extends BaseService
|
||||
|
||||
public function GetMissingProducts()
|
||||
{
|
||||
return $this->getDatabaseService()->ExecuteDbQuery('SELECT * FROM stock_missing_products')->fetchAll(\PDO::FETCH_OBJ);
|
||||
$missingProductsResponse = $this->getDatabaseService()->ExecuteDbQuery('SELECT * FROM stock_missing_products')->fetchAll(\PDO::FETCH_OBJ);
|
||||
|
||||
$relevantProducts = $this->getDatabase()->products()->where('id IN (SELECT id FROM stock_missing_products)');
|
||||
foreach ($relevantProducts as $product)
|
||||
{
|
||||
FindObjectInArrayByPropertyValue($missingProductsResponse, 'id', $product->id)->product = $product;
|
||||
|
||||
}
|
||||
|
||||
return $missingProductsResponse;
|
||||
}
|
||||
|
||||
public function GetProductDetails(int $productId)
|
||||
|
Loading…
x
Reference in New Issue
Block a user