mirror of
https://github.com/grocy/grocy.git
synced 2025-04-30 10:05:45 +00:00
Also update from_qu_id and to_qu_id of inverse unit conversions automatically (closes #1977)
This commit is contained in:
parent
52e2c6d480
commit
c396c2a84c
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
### Stock
|
### Stock
|
||||||
|
|
||||||
|
- Improved that when editing a unit conversion, the "Quantity unit from" and "Quantity unit to" of the corresponding inverse conversion is now also updated accordingly if changed (until now only the factor was updated automatically)
|
||||||
- Fixed that stock entry notes were lost when consuming/opening/transferring a partial amount of the corresponding stock entry (thanks @akoshpinter)
|
- Fixed that stock entry notes were lost when consuming/opening/transferring a partial amount of the corresponding stock entry (thanks @akoshpinter)
|
||||||
- Fixed that the average shelf life of a product (on the productcard) was wrong when the corresponding stock entry was edited
|
- 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 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
|
||||||
|
15
migrations/0199.sql
Normal file
15
migrations/0199.sql
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
DROP TRIGGER qu_conversions_inverse_UPD;
|
||||||
|
CREATE TRIGGER qu_conversions_inverse_UPD AFTER UPDATE ON quantity_unit_conversions
|
||||||
|
BEGIN
|
||||||
|
/*
|
||||||
|
Update the inverse QU conversion
|
||||||
|
*/
|
||||||
|
|
||||||
|
UPDATE quantity_unit_conversions
|
||||||
|
SET factor = 1 / IFNULL(NEW.factor, 1),
|
||||||
|
from_qu_id = NEW.to_qu_id,
|
||||||
|
to_qu_id = NEW.from_qu_id
|
||||||
|
WHERE from_qu_id = OLD.to_qu_id
|
||||||
|
AND to_qu_id = OLD.from_qu_id
|
||||||
|
AND IFNULL(product_id, -1) = IFNULL(NEW.product_id, -1);
|
||||||
|
END;
|
Loading…
x
Reference in New Issue
Block a user