mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-30 13:34:28 +02:00
Use BigDecimal for Pricedetail price field.
This commit is contained in:
parent
db4d7dc5fc
commit
b1db89e3b4
8 changed files with 116 additions and 49 deletions
|
@ -53,6 +53,7 @@ use App\Services\MarkdownParser;
|
|||
use App\Services\MoneyFormatter;
|
||||
use App\Services\SIFormatter;
|
||||
use App\Services\Trees\TreeViewGenerator;
|
||||
use Brick\Math\BigDecimal;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
|
@ -153,6 +154,10 @@ class AppExtension extends AbstractExtension
|
|||
|
||||
public function formatCurrency($amount, ?Currency $currency = null, int $decimals = 5)
|
||||
{
|
||||
if ($amount instanceof BigDecimal) {
|
||||
$amount = (string) $amount;
|
||||
}
|
||||
|
||||
return $this->moneyFormatter->format($amount, $currency, $decimals);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue