mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-20 19:05:14 +02:00
Fixed code style.
This commit is contained in:
parent
2853e471c4
commit
d0b1024d80
212 changed files with 495 additions and 1005 deletions
|
@ -71,7 +71,7 @@ class AttachmentTypeAdminForm extends BaseEntityAdminForm
|
|||
'placeholder' => 'attachment_type.edit.filetype_filter.placeholder',
|
||||
],
|
||||
'empty_data' => '',
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
||||
//Normalize data before writing it to database
|
||||
|
|
|
@ -90,7 +90,7 @@ class BaseEntityAdminForm extends AbstractType
|
|||
'attr' => [
|
||||
'placeholder' => 'part.name.placeholder',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
||||
if ($entity instanceof AbstractStructuralDBElement) {
|
||||
|
@ -101,7 +101,7 @@ class BaseEntityAdminForm extends AbstractType
|
|||
'class' => get_class($entity),
|
||||
'required' => false,
|
||||
'label' => 'parent.label',
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
||||
]
|
||||
)
|
||||
->add(
|
||||
|
@ -114,7 +114,7 @@ class BaseEntityAdminForm extends AbstractType
|
|||
'label_attr' => [
|
||||
'class' => 'checkbox-custom',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ class BaseEntityAdminForm extends AbstractType
|
|||
'rows' => 4,
|
||||
],
|
||||
'help' => 'bbcode.hint',
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ class BaseEntityAdminForm extends AbstractType
|
|||
'allow_delete' => true,
|
||||
'label' => false,
|
||||
'reindex_enable' => true,
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'entry_options' => [
|
||||
'data_class' => $options['attachment_class'],
|
||||
],
|
||||
|
@ -153,7 +153,7 @@ class BaseEntityAdminForm extends AbstractType
|
|||
|
||||
$builder->add('master_picture_attachment', MasterPictureAttachmentType::class, [
|
||||
'required' => false,
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'label' => 'part.edit.master_attachment',
|
||||
'entity' => $entity,
|
||||
]);
|
||||
|
@ -173,7 +173,7 @@ class BaseEntityAdminForm extends AbstractType
|
|||
'entry_type' => ParameterType::class,
|
||||
'allow_add' => $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'allow_delete' => $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'reindex_enable' => true,
|
||||
'label' => false,
|
||||
'by_reference' => false,
|
||||
|
@ -191,11 +191,11 @@ class BaseEntityAdminForm extends AbstractType
|
|||
'attr' => [
|
||||
'class' => $is_new ? 'btn-success' : '',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
])
|
||||
->add('reset', ResetType::class, [
|
||||
'label' => 'entity.edit.reset',
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
|||
'label_attr' => [
|
||||
'class' => 'checkbox-custom',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('disable_manufacturers', CheckboxType::class, [
|
||||
|
@ -70,7 +70,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
|||
'label_attr' => [
|
||||
'class' => 'checkbox-custom',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('disable_autodatasheets', CheckboxType::class, [
|
||||
|
@ -80,7 +80,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
|||
'label_attr' => [
|
||||
'class' => 'checkbox-custom',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('disable_properties', CheckboxType::class, [
|
||||
|
@ -90,7 +90,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
|||
'label_attr' => [
|
||||
'class' => 'checkbox-custom',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('partname_hint', TextType::class, [
|
||||
|
@ -100,7 +100,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
|||
'attr' => [
|
||||
'placeholder' => 'category.edit.partname_hint.placeholder',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('partname_regex', TextType::class, [
|
||||
|
@ -110,7 +110,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
|||
'attr' => [
|
||||
'placeholder' => 'category.edit.partname_regex.placeholder',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('default_description', TextType::class, [
|
||||
|
@ -120,7 +120,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
|||
'attr' => [
|
||||
'placeholder' => 'category.edit.default_description.placeholder',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('default_comment', TextType::class, [
|
||||
|
@ -130,7 +130,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
|||
'attr' => [
|
||||
'placeholder' => 'category.edit.default_comment.placeholder',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ class CompanyForm extends BaseEntityAdminForm
|
|||
|
||||
$builder->add('address', TextareaType::class, [
|
||||
'label' => 'company.edit.address',
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'attr' => [
|
||||
'placeholder' => 'company.edit.address.placeholder',
|
||||
],
|
||||
|
@ -67,7 +67,7 @@ class CompanyForm extends BaseEntityAdminForm
|
|||
|
||||
$builder->add('phone_number', TelType::class, [
|
||||
'label' => 'company.edit.phone_number',
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'attr' => [
|
||||
'placeholder' => 'company.edit.phone_number.placeholder',
|
||||
],
|
||||
|
@ -77,7 +77,7 @@ class CompanyForm extends BaseEntityAdminForm
|
|||
|
||||
$builder->add('fax_number', TelType::class, [
|
||||
'label' => 'company.edit.fax_number',
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'attr' => [
|
||||
'placeholder' => 'company.fax_number.placeholder',
|
||||
],
|
||||
|
@ -87,7 +87,7 @@ class CompanyForm extends BaseEntityAdminForm
|
|||
|
||||
$builder->add('email_address', EmailType::class, [
|
||||
'label' => 'company.edit.email',
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'attr' => [
|
||||
'placeholder' => 'company.edit.email.placeholder',
|
||||
],
|
||||
|
@ -97,7 +97,7 @@ class CompanyForm extends BaseEntityAdminForm
|
|||
|
||||
$builder->add('website', UrlType::class, [
|
||||
'label' => 'company.edit.website',
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'attr' => [
|
||||
'placeholder' => 'company.edit.website.placeholder',
|
||||
],
|
||||
|
@ -108,7 +108,7 @@ class CompanyForm extends BaseEntityAdminForm
|
|||
$builder->add('auto_product_url', UrlType::class, [
|
||||
'label' => 'company.edit.auto_product_url',
|
||||
'help' => 'company.edit.auto_product_url.help',
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'attr' => [
|
||||
'placeholder' => 'company.edit.auto_product_url.placeholder',
|
||||
],
|
||||
|
|
|
@ -45,7 +45,6 @@ namespace App\Form\AdminPages;
|
|||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Form\Type\BigDecimalMoneyType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CurrencyType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
@ -73,7 +72,7 @@ class CurrencyAdminForm extends BaseEntityAdminForm
|
|||
'title' => 'selectpicker.nothing_selected',
|
||||
'data-live-search' => true,
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('exchange_rate', BigDecimalMoneyType::class, [
|
||||
|
@ -81,16 +80,16 @@ class CurrencyAdminForm extends BaseEntityAdminForm
|
|||
'label' => 'currency.edit.exchange_rate',
|
||||
'currency' => $this->default_currency,
|
||||
'scale' => 6,
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
||||
if(!$is_new) {
|
||||
if (!$is_new) {
|
||||
$builder->add(
|
||||
'update_exchange_rate',
|
||||
SubmitType::class,
|
||||
[
|
||||
'label' => 'currency.edit.update_rate',
|
||||
'disabled' => ! $this->security->isGranted('edit', $entity)
|
||||
'disabled' => !$this->security->isGranted('edit', $entity),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ class FootprintAdminForm extends BaseEntityAdminForm
|
|||
{
|
||||
$builder->add('footprint_3d', MasterPictureAttachmentType::class, [
|
||||
'required' => false,
|
||||
'disabled' => ! $this->security->isGranted(null === $entity->getID() ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted(null === $entity->getID() ? 'create' : 'edit', $entity),
|
||||
'label' => 'footprint.edit.3d_model',
|
||||
'filter' => '3d_model',
|
||||
'entity' => $entity,
|
||||
|
|
|
@ -60,13 +60,13 @@ class GroupAdminForm extends BaseEntityAdminForm
|
|||
'label_attr' => [
|
||||
'class' => 'checkbox-custom',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('permissions', PermissionsType::class, [
|
||||
'mapped' => false,
|
||||
'data' => $builder->getData(),
|
||||
'disabled' => ! $this->security->isGranted('edit_permissions', $entity),
|
||||
'disabled' => !$this->security->isGranted('edit_permissions', $entity),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@ class ImportType extends AbstractType
|
|||
//Disable import if user is not allowed to create elements.
|
||||
$entity = new $data['entity_class']();
|
||||
$perm_name = 'create';
|
||||
$disabled = ! $this->security->isGranted($perm_name, $entity);
|
||||
$disabled = !$this->security->isGranted($perm_name, $entity);
|
||||
|
||||
$builder
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ class MassCreationForm extends AbstractType
|
|||
//Disable import if user is not allowed to create elements.
|
||||
$entity = new $data['entity_class']();
|
||||
$perm_name = 'create';
|
||||
$disabled = ! $this->security->isGranted($perm_name, $entity);
|
||||
$disabled = !$this->security->isGranted($perm_name, $entity);
|
||||
|
||||
$builder
|
||||
->add('lines', TextareaType::class, [
|
||||
|
|
|
@ -60,7 +60,7 @@ class MeasurementUnitAdminForm extends BaseEntityAdminForm
|
|||
'label_attr' => [
|
||||
'class' => 'checkbox-custom',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('use_si_prefix', CheckboxType::class, [
|
||||
|
@ -70,7 +70,7 @@ class MeasurementUnitAdminForm extends BaseEntityAdminForm
|
|||
'label_attr' => [
|
||||
'class' => 'checkbox-custom',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('unit', TextType::class, [
|
||||
|
@ -79,7 +79,7 @@ class MeasurementUnitAdminForm extends BaseEntityAdminForm
|
|||
'attr' => [
|
||||
'placeholder' => 'measurement_unit.edit.unit_symbol.placeholder',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ class StorelocationAdminForm extends BaseEntityAdminForm
|
|||
'label_attr' => [
|
||||
'class' => 'checkbox-custom',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('limit_to_existing_parts', CheckboxType::class, [
|
||||
|
@ -71,7 +71,7 @@ class StorelocationAdminForm extends BaseEntityAdminForm
|
|||
'label_attr' => [
|
||||
'class' => 'checkbox-custom',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('only_single_part', CheckboxType::class, [
|
||||
|
@ -81,7 +81,7 @@ class StorelocationAdminForm extends BaseEntityAdminForm
|
|||
'label_attr' => [
|
||||
'class' => 'checkbox-custom',
|
||||
],
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('storage_type', StructuralEntityType::class, [
|
||||
|
@ -90,7 +90,7 @@ class StorelocationAdminForm extends BaseEntityAdminForm
|
|||
'help' => 'storelocation.storage_type.help',
|
||||
'class' => MeasurementUnit::class,
|
||||
'disable_not_selectable' => true,
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,7 +46,6 @@ use App\Entity\Base\AbstractNamedDBElement;
|
|||
use App\Entity\PriceInformations\Currency;
|
||||
use App\Form\Type\BigDecimalMoneyType;
|
||||
use App\Form\Type\StructuralEntityType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
|
||||
|
@ -71,7 +70,7 @@ class SupplierForm extends CompanyForm
|
|||
'required' => false,
|
||||
'label' => 'supplier.edit.default_currency',
|
||||
'disable_not_selectable' => true,
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
||||
]);
|
||||
|
||||
$builder->add('shipping_costs', BigDecimalMoneyType::class, [
|
||||
|
@ -79,7 +78,7 @@ class SupplierForm extends CompanyForm
|
|||
'currency' => $this->default_currency,
|
||||
'scale' => 3,
|
||||
'label' => 'supplier.shipping_costs.label',
|
||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue