diff --git a/src/Entity/Parts/Supplier.php b/src/Entity/Parts/Supplier.php index 0ac3a1ed..0c35d768 100644 --- a/src/Entity/Parts/Supplier.php +++ b/src/Entity/Parts/Supplier.php @@ -162,7 +162,10 @@ class Supplier extends AbstractCompany */ public function setShippingCosts(?string $shipping_costs): self { - $this->shipping_costs = $shipping_costs; + /* Just a little hack to ensure that price has 5 digits after decimal point, + so that DB does not detect changes, when something like 0.4 is passed + Third parameter must have the scale value of decimal column. */ + $this->shipping_costs = bcmul($shipping_costs, '1.0', 5); return $this; } diff --git a/src/Entity/PriceInformations/Pricedetail.php b/src/Entity/PriceInformations/Pricedetail.php index 35e05a4f..2ecf5cf8 100644 --- a/src/Entity/PriceInformations/Pricedetail.php +++ b/src/Entity/PriceInformations/Pricedetail.php @@ -275,7 +275,10 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface { //Assert::natural($new_price, 'The new price must be positive! Got %s!'); - $this->price = $new_price; + /* Just a little hack to ensure that price has 5 digits after decimal point, + so that DB does not detect changes, when something like 0.4 is passed + Third parameter must have the scale value of decimal column. */ + $this->price = bcmul($new_price, '1.0', static::PRICE_PRECISION); return $this; }