mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 18:34:32 +02:00
Moved default language, default timezone and base currency settings to new settings system
This commit is contained in:
parent
463812fb3d
commit
2ab2b7f77d
27 changed files with 211 additions and 83 deletions
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||
namespace App\Services\Formatters;
|
||||
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
use App\Settings\SystemSettings\LocalizationSettings;
|
||||
use Locale;
|
||||
use NumberFormatter;
|
||||
|
||||
|
@ -30,7 +31,7 @@ class MoneyFormatter
|
|||
{
|
||||
protected string $locale;
|
||||
|
||||
public function __construct(protected string $base_currency)
|
||||
public function __construct(private readonly LocalizationSettings $localizationSettings)
|
||||
{
|
||||
$this->locale = Locale::getDefault();
|
||||
}
|
||||
|
@ -45,7 +46,7 @@ class MoneyFormatter
|
|||
*/
|
||||
public function format(string|float $value, ?Currency $currency = null, int $decimals = 5, bool $show_all_digits = false): string
|
||||
{
|
||||
$iso_code = $this->base_currency;
|
||||
$iso_code = $this->localizationSettings->baseCurrency;
|
||||
if ($currency instanceof Currency && ($currency->getIsoCode() !== null && $currency->getIsoCode() !== '')) {
|
||||
$iso_code = $currency->getIsoCode();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue