mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 18:34:32 +02:00
Use string for price of pricedetails.
This commit is contained in:
parent
42399b5517
commit
43c439bc9e
2 changed files with 18 additions and 4 deletions
|
@ -90,11 +90,11 @@ class Pricedetail extends DBElement
|
|||
protected $orderdetail;
|
||||
|
||||
/**
|
||||
* @var float The price related to the detail. (Given in the selected currency)
|
||||
* @var string The price related to the detail. (Given in the selected currency)
|
||||
* @ORM\Column(type="decimal", precision=11, scale=5)
|
||||
* @Assert\Positive()
|
||||
*/
|
||||
protected $price = 0.0;
|
||||
protected $price = "0.0";
|
||||
|
||||
/**
|
||||
* @var ?Currency The currency used for the current price information.
|
||||
|
@ -147,11 +147,21 @@ class Pricedetail extends DBElement
|
|||
* It is given in current currency and for the price related quantity.
|
||||
* @return float
|
||||
*/
|
||||
public function getPrice() : float
|
||||
public function getPriceFloat() : float
|
||||
{
|
||||
return (float) $this->price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the price associated with this pricedetail.
|
||||
* It is given in current currency and for the price related quantity.
|
||||
* @return string The price as string, like returned raw from DB.
|
||||
*/
|
||||
public function getPrice() : string
|
||||
{
|
||||
return $this->price;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the price for a single unit in the currency associated with this price detail.
|
||||
*
|
||||
|
|
|
@ -58,7 +58,11 @@ class PricedetailType extends AbstractType
|
|||
'measurement_unit' => $options['measurement_unit'],
|
||||
'attr' => ['class' => 'form-control-sm']
|
||||
]);
|
||||
$builder->add("price", NumberType::class);
|
||||
$builder->add("price", NumberType::class, [
|
||||
'scale' => 5,
|
||||
'html5' => true,
|
||||
'attr' => ['min' => 0, 'step' => "any"]
|
||||
]);
|
||||
$builder->add("currency", CurrencyEntityType::class, ['required' => false]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue