mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-20 10:57:40 +02:00
Fixed coding style.
This commit is contained in:
parent
e9493e52ec
commit
f5d685dfd4
71 changed files with 619 additions and 531 deletions
|
@ -45,7 +45,6 @@ namespace App\Form\AdminPages;
|
|||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Entity\Base\AbstractStructuralDBElement;
|
||||
use App\Entity\LabelSystem\LabelOptions;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Form\AttachmentFormType;
|
||||
use App\Form\ParameterType;
|
||||
|
@ -106,7 +105,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(
|
||||
|
@ -119,7 +118,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),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -135,7 +134,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),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
@ -178,7 +177,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,
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -20,7 +23,6 @@
|
|||
|
||||
namespace App\Form\AdminPages;
|
||||
|
||||
|
||||
use App\Entity\Base\AbstractNamedDBElement;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Form\LabelOptionsType;
|
||||
|
@ -30,9 +32,15 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||
|
||||
class LabelProfileAdminForm extends BaseEntityAdminForm
|
||||
{
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
parent::configureOptions($resolver);
|
||||
$resolver->setDefault('data_class', LabelProfile::class);
|
||||
$resolver->setDefault('disable_options', false);
|
||||
}
|
||||
|
||||
protected function additionalFormElements(FormBuilderInterface $builder, array $options, AbstractNamedDBElement $entity): void
|
||||
{
|
||||
|
||||
$builder->add('show_in_dropdown', CheckboxType::class, [
|
||||
'required' => false,
|
||||
'label' => 'label_profile.showInDropdown',
|
||||
|
@ -45,11 +53,4 @@ class LabelProfileAdminForm extends BaseEntityAdminForm
|
|||
'disabled' => $options['disable_options'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
parent::configureOptions($resolver);
|
||||
$resolver->setDefault('data_class', LabelProfile::class);
|
||||
$resolver->setDefault('disable_options', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -20,7 +23,6 @@
|
|||
|
||||
namespace App\Form;
|
||||
|
||||
|
||||
use App\Entity\LabelSystem\LabelOptions;
|
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
|
@ -40,7 +42,7 @@ class LabelOptionsType extends AbstractType
|
|||
$this->security = $security;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder->add('width', NumberType::class, [
|
||||
'label' => 'label_options.page_size.label',
|
||||
|
@ -49,7 +51,7 @@ class LabelOptionsType extends AbstractType
|
|||
'placeholder' => 'label_options.width.placeholder',
|
||||
'min' => 0,
|
||||
'step' => 'any',
|
||||
]
|
||||
],
|
||||
]);
|
||||
$builder->add('height', NumberType::class, [
|
||||
'label' => false,
|
||||
|
@ -58,7 +60,7 @@ class LabelOptionsType extends AbstractType
|
|||
'placeholder' => 'label_options.height.placeholder',
|
||||
'min' => 0,
|
||||
'step' => 'any',
|
||||
]
|
||||
],
|
||||
]);
|
||||
|
||||
$builder->add('supported_element', ChoiceType::class, [
|
||||
|
@ -67,11 +69,11 @@ class LabelOptionsType extends AbstractType
|
|||
'part.label' => 'part',
|
||||
'part_lot.label' => 'part_lot',
|
||||
'storelocation.label' => 'storelocation',
|
||||
]
|
||||
],
|
||||
]);
|
||||
|
||||
$builder->add('barcode_type', ChoiceType::class, [
|
||||
'label' => 'label_options.barcode_type.label',
|
||||
'label' => 'label_options.barcode_type.label',
|
||||
'empty_data' => 'none',
|
||||
'choices' => [
|
||||
'label_options.barcode_type.none' => 'none',
|
||||
|
@ -82,10 +84,10 @@ class LabelOptionsType extends AbstractType
|
|||
'label_options.barcode_type.datamatrix' => 'datamatrix',
|
||||
],
|
||||
'group_by' => function ($choice, $key, $value) {
|
||||
if (in_array($choice, ['qr', 'datamatrix'])) {
|
||||
if (in_array($choice, ['qr', 'datamatrix'], true)) {
|
||||
return 'label_options.barcode_type.2D';
|
||||
}
|
||||
if (in_array($choice, ['code39', 'code93', 'code128'])) {
|
||||
if (in_array($choice, ['code39', 'code93', 'code128'], true)) {
|
||||
return 'label_options.barcode_type.1D';
|
||||
}
|
||||
|
||||
|
@ -95,7 +97,6 @@ class LabelOptionsType extends AbstractType
|
|||
'class' => 'selectpicker',
|
||||
'data-live-search' => true,
|
||||
],
|
||||
|
||||
]);
|
||||
|
||||
$builder->add('lines', CKEditorType::class, [
|
||||
|
@ -126,17 +127,17 @@ class LabelOptionsType extends AbstractType
|
|||
'help_html' => true,
|
||||
'expanded' => true,
|
||||
'attr' => [
|
||||
'class' => 'pt-2'
|
||||
'class' => 'pt-2',
|
||||
],
|
||||
'label_attr' => [
|
||||
'class' => 'radio-custom radio-inline'
|
||||
'class' => 'radio-custom radio-inline',
|
||||
],
|
||||
'disabled' => !$this->security->isGranted('@labels.use_twig')
|
||||
'disabled' => ! $this->security->isGranted('@labels.use_twig'),
|
||||
]);
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefault('data_class', LabelOptions::class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -20,11 +23,9 @@
|
|||
|
||||
namespace App\Form\LabelSystem;
|
||||
|
||||
|
||||
use App\Form\LabelOptionsType;
|
||||
use App\Validator\Constraints\Misc\ValidRange;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
use Symfony\Component\Form\FormBuilderInterface;
|
||||
|
@ -40,7 +41,7 @@ class LabelDialogType extends AbstractType
|
|||
$this->security = $security;
|
||||
}
|
||||
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder->add('target_id', TextType::class, [
|
||||
'required' => true,
|
||||
|
@ -53,18 +54,17 @@ class LabelDialogType extends AbstractType
|
|||
|
||||
$builder->add('options', LabelOptionsType::class, [
|
||||
'label' => false,
|
||||
'disabled' => !$this->security->isGranted('@labels.edit_options') || $options['disable_options'],
|
||||
|
||||
'disabled' => ! $this->security->isGranted('@labels.edit_options') || $options['disable_options'],
|
||||
]);
|
||||
$builder->add('update', SubmitType::class, [
|
||||
'label' => 'label_generator.update',
|
||||
]);
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
parent::configureOptions($resolver);
|
||||
$resolver->setDefault('mapped', false);
|
||||
$resolver->setDefault('disable_options', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
|
@ -20,7 +23,6 @@
|
|||
|
||||
namespace App\Form\LabelSystem;
|
||||
|
||||
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\TextType;
|
||||
|
@ -29,7 +31,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
|
|||
|
||||
class ScanDialogType extends AbstractType
|
||||
{
|
||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
public function buildForm(FormBuilderInterface $builder, array $options): void
|
||||
{
|
||||
$builder->add('input', TextType::class, [
|
||||
'label' => 'scan_dialog.input',
|
||||
|
@ -40,12 +42,12 @@ class ScanDialogType extends AbstractType
|
|||
]);
|
||||
|
||||
$builder->add('submit', SubmitType::class, [
|
||||
'label' => 'scan_dialog.submit'
|
||||
'label' => 'scan_dialog.submit',
|
||||
]);
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
public function configureOptions(OptionsResolver $resolver): void
|
||||
{
|
||||
$resolver->setDefault('mapped', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue