Squashed commit

Fixed some localization strings
Reviewed/optimized product deletion handling
Add option to hide products from the stock overview page (closes #906)
Prefill default_due_days also on the inventory page (closes #591)
Added DataTables accent chinese-string plugin (closes #872)
Show costs and calories per recipe ingredient (closes #1072)
Fixed user permission saving (fixes #1099)
User permissions should not have an effect for demo mode (closes #972)
Handle QU conversion when consuming a substituation (child) product (fixes #1118)
Consume/open any child product when the parent product is not in stock (closes #899)
Added a retry camera barcode scanning button to product picker workflow (closes #736)
This commit is contained in:
Bernd Bestel
2020-12-07 19:48:33 +01:00
parent 2bdb6ab2d4
commit cf34df5e3f
53 changed files with 387 additions and 210 deletions

View File

@@ -70,6 +70,7 @@ CREATE TABLE products (
cumulate_min_stock_amount_of_sub_products TINYINT DEFAULT 0,
due_type TINYINT NOT NULL DEFAULT 1 CHECK(due_type IN (1, 2)),
quick_consume_amount REAL NOT NULL DEFAULT 1,
show_on_stock_overview TINYINT NOT NULL DEFAULT 1 CHECK(show_on_stock_overview IN (0, 1)),
row_created_timestamp DATETIME DEFAULT (datetime('now', 'localtime'))
);

View File

@@ -37,7 +37,8 @@ FROM (
WHERE m.id NOT IN (SELECT product_id FROM stock_current)
) sc
LEFT JOIN products p
ON sc.product_id = p.id;
ON sc.product_id = p.id
WHERE p.show_on_stock_overview = 1;
CREATE VIEW uihelper_stock_current_overview
AS
@@ -78,4 +79,5 @@ FROM (
WHERE m.id NOT IN (SELECT product_id FROM stock_current)
) sc
LEFT JOIN products p
ON sc.product_id = p.id;
ON sc.product_id = p.id
WHERE p.show_on_stock_overview = 1;

View File

@@ -128,7 +128,7 @@ SELECT
SELECT pc.permission_name
FROM user_permissions_resolved pc
WHERE pc.user_id = u.id
)
) AS has_permission,
ph.parent AS parent
)
) AS has_permission,
ph.parent AS parent
FROM users u, permission_hierarchy ph;

25
migrations/0120.sql Normal file
View File

@@ -0,0 +1,25 @@
CREATE TRIGGER cascade_product_removal AFTER DELETE ON products
BEGIN
DELETE FROM stock_log
WHERE product_id = OLD.id;
DELETE FROM product_barcodes
WHERE product_id = OLD.id;
DELETE FROM quantity_unit_conversions
WHERE product_id = OLD.id;
DELETE FROM recipes_pos
WHERE product_id = OLD.id;
UPDATE recipes
SET product_id = NULL
WHERE product_id = OLD.id;
DELETE FROM meal_plan
WHERE product_id = OLD.id
AND type = 'product';
DELETE FROM shopping_list
WHERE product_id = OLD.id;
END;