mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-23 12:24:45 +02:00
Fixed wrongly detected changes of prices caused by not identical objects.
This commit is contained in:
parent
f92802a3c7
commit
c60f27ef86
3 changed files with 23 additions and 3 deletions
|
@ -275,7 +275,11 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
|||
*/
|
||||
public function setPrice(BigDecimal $new_price): self
|
||||
{
|
||||
$this->price = $new_price->toScale(self::PRICE_PRECISION, RoundingMode::HALF_UP);
|
||||
$tmp = $new_price->toScale(self::PRICE_PRECISION, RoundingMode::HALF_UP);
|
||||
//Only change the object, if the value changes, so that doctrine does not detect it as changed.
|
||||
if ((string) $tmp !== (string) $this->price) {
|
||||
$this->price = $tmp;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue