Added some helper functions to make it easier to parse Pricedetails

This commit is contained in:
Jan Böhmer 2023-09-18 21:37:21 +02:00
parent 59f62d4a4c
commit 8182e83846

View file

@ -188,6 +188,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
*
* @return BigDecimal the price as a bcmath string
*/
#[Groups(['pricedetail:read'])]
public function getPricePerUnit(float|string|BigDecimal $multiplier = 1.0): BigDecimal
{
$tmp = BigDecimal::of($multiplier);
@ -249,6 +250,17 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
return $this->currency;
}
/**
* Returns the ISO code of the currency associated with this price information, or null if no currency is selected.
* Then the global base currency should be assumed.
* @return string|null
*/
#[Groups(['pricedetail:read'])]
public function getCurrencyISOCode(): ?string
{
return $this->currency?->getIsoCode();
}
/********************************************************************************
*
* Setters