This commit is contained in:
Bernd Bestel 2019-09-26 12:45:35 +02:00
parent 02f30d141e
commit 2809cc1454
No known key found for this signature in database
GPG Key ID: 71BD34C0D4891300
2 changed files with 10 additions and 10 deletions

View File

@ -1,5 +1,5 @@
ALTER TABLE products
ADD cumulate_min_stock_amount_of_subproducts TINYINT DEFAULT 0;
ADD cumulate_min_stock_amount_of_sub_products TINYINT DEFAULT 0;
DROP VIEW stock_missing_products;
CREATE VIEW stock_missing_products
@ -15,7 +15,7 @@ FROM products p
LEFT JOIN stock_current s
ON p.id = s.product_id
WHERE p.min_stock_amount != 0
AND p.cumulate_min_stock_amount_of_subproducts = 0
AND p.cumulate_min_stock_amount_of_sub_products = 0
GROUP BY p.id
HAVING IFNULL(SUM(s.amount), 0) < p.min_stock_amount
@ -35,7 +35,7 @@ JOIN products sub_p
LEFT JOIN stock_current s
ON pr.sub_product_id = s.product_id
WHERE sub_p.min_stock_amount != 0
AND p.cumulate_min_stock_amount_of_subproducts = 1
AND p.cumulate_min_stock_amount_of_sub_products = 1
GROUP BY p.id
HAVING IFNULL(SUM(s.amount), 0) < SUM(sub_p.min_stock_amount)
@ -55,7 +55,7 @@ JOIN products sub_p
LEFT JOIN stock_current s
ON pr.sub_product_id = s.product_id
WHERE sub_p.min_stock_amount != 0
AND p.cumulate_min_stock_amount_of_subproducts = 0
AND p.cumulate_min_stock_amount_of_sub_products = 0
GROUP BY sub_p.id
HAVING IFNULL(SUM(s.amount), 0) < sub_p.min_stock_amount;
@ -75,7 +75,7 @@ FROM products p
LEFT JOIN stock_current s
ON p.id = s.product_id
WHERE p.min_stock_amount != 0
AND p.cumulate_min_stock_amount_of_subproducts = 0
AND p.cumulate_min_stock_amount_of_sub_products = 0
GROUP BY p.id
HAVING IFNULL(SUM(s.amount), 0) < p.min_stock_amount
@ -95,7 +95,7 @@ JOIN products sub_p
LEFT JOIN stock_current s
ON pr.sub_product_id = s.product_id
WHERE sub_p.min_stock_amount != 0
AND p.cumulate_min_stock_amount_of_subproducts = 1
AND p.cumulate_min_stock_amount_of_sub_products = 1
GROUP BY p.id
HAVING IFNULL(SUM(s.amount), 0) < SUM(sub_p.min_stock_amount)
@ -115,6 +115,6 @@ JOIN products sub_p
LEFT JOIN stock_current s
ON pr.sub_product_id = s.product_id
WHERE sub_p.min_stock_amount != 0
AND p.cumulate_min_stock_amount_of_subproducts = 0
AND p.cumulate_min_stock_amount_of_sub_products = 0
GROUP BY sub_p.id
HAVING IFNULL(SUM(s.amount), 0) < sub_p.min_stock_amount;

View File

@ -100,9 +100,9 @@
<div class="form-group">
<div class="form-check">
<input type="hidden" name="cumulate_min_stock_amount_of_subproducts" value="0">
<input @if($mode == 'edit' && $product->cumulate_min_stock_amount_of_subproducts == 1) checked @endif class="form-check-input" type="checkbox" id="cumulate_min_stock_amount_of_subproducts" name="cumulate_min_stock_amount_of_subproducts" value="1">
<label class="form-check-label" for="cumulate_min_stock_amount_of_subproducts">{{ $__t('Accumulate sub products min. stock amount') }}
<input type="hidden" name="cumulate_min_stock_amount_of_sub_products" value="0">
<input @if($mode == 'edit' && $product->cumulate_min_stock_amount_of_sub_products == 1) checked @endif class="form-check-input" type="checkbox" id="cumulate_min_stock_amount_of_sub_products" name="cumulate_min_stock_amount_of_sub_products" value="1">
<label class="form-check-label" for="cumulate_min_stock_amount_of_sub_products">{{ $__t('Accumulate sub products min. stock amount') }}
<span class="text-muted small">{{ $__t('If enabled, the min. stock amount of sub products will be accumulated into this product, means the sub product will never be "missing", only this product') }}</span>
</label>
</div>