Dont log that shipping costs or price has been changed when just saving a part.

Fixes issue #26
This commit is contained in:
Jan Böhmer 2020-03-28 19:30:57 +01:00
parent 7cf500279e
commit 88580aad79
2 changed files with 8 additions and 2 deletions

View file

@ -162,7 +162,10 @@ class Supplier extends AbstractCompany
*/ */
public function setShippingCosts(?string $shipping_costs): self 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; return $this;
} }

View file

@ -275,7 +275,10 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
{ {
//Assert::natural($new_price, 'The new price must be positive! Got %s!'); //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; return $this;
} }