mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-15 12:54:30 +02:00
Fixed missing parameter in CurrencyAdminForm
This commit is contained in:
parent
71727e1828
commit
6db3f454e3
1 changed files with 10 additions and 1 deletions
|
@ -46,9 +46,18 @@ use App\Entity\Base\AbstractNamedDBElement;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\CurrencyType;
|
use Symfony\Component\Form\Extension\Core\Type\CurrencyType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
|
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
|
use Symfony\Component\Security\Core\Security;
|
||||||
|
|
||||||
class CurrencyAdminForm extends BaseEntityAdminForm
|
class CurrencyAdminForm extends BaseEntityAdminForm
|
||||||
{
|
{
|
||||||
|
private $default_currency;
|
||||||
|
|
||||||
|
public function __construct(Security $security, string $default_currency)
|
||||||
|
{
|
||||||
|
parent::__construct($security);
|
||||||
|
$this->default_currency = $default_currency;
|
||||||
|
}
|
||||||
|
|
||||||
protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void
|
protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void
|
||||||
{
|
{
|
||||||
$is_new = null === $entity->getID();
|
$is_new = null === $entity->getID();
|
||||||
|
@ -68,7 +77,7 @@ class CurrencyAdminForm extends BaseEntityAdminForm
|
||||||
$builder->add('exchange_rate', MoneyType::class, [
|
$builder->add('exchange_rate', MoneyType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => 'currency.edit.exchange_rate',
|
'label' => 'currency.edit.exchange_rate',
|
||||||
'currency' => $this->params->get('default_currency'),
|
'currency' => $this->default_currency,
|
||||||
'scale' => 6,
|
'scale' => 6,
|
||||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||||
]);
|
]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue