mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Dont call translator inside the form classes.
Translation is already done in the templates, so translator calls in form classes, are bad for performance and readability.
This commit is contained in:
parent
e7b920c4fe
commit
89acfff857
28 changed files with 1875 additions and 2259 deletions
|
@ -107,13 +107,13 @@ abstract class BaseAdminController extends AbstractController
|
||||||
|
|
||||||
$em->persist($entity);
|
$em->persist($entity);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
$this->addFlash('success', $this->translator->trans('entity.edit_flash'));
|
$this->addFlash('success', 'entity.edit_flash');
|
||||||
|
|
||||||
//Rebuild form, so it is based on the updated data. Important for the parent field!
|
//Rebuild form, so it is based on the updated data. Important for the parent field!
|
||||||
//We can not use dynamic form events here, because the parent entity list is build from database!
|
//We can not use dynamic form events here, because the parent entity list is build from database!
|
||||||
$form = $this->createForm($this->form_class, $entity, ['attachment_class' => $this->attachment_class]);
|
$form = $this->createForm($this->form_class, $entity, ['attachment_class' => $this->attachment_class]);
|
||||||
} elseif ($form->isSubmitted() && !$form->isValid()) {
|
} elseif ($form->isSubmitted() && !$form->isValid()) {
|
||||||
$this->addFlash('error', $this->translator->trans('entity.edit_flash.invalid'));
|
$this->addFlash('error', 'entity.edit_flash.invalid');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render($this->twig_template, [
|
return $this->render($this->twig_template, [
|
||||||
|
@ -163,13 +163,13 @@ abstract class BaseAdminController extends AbstractController
|
||||||
|
|
||||||
$em->persist($new_entity);
|
$em->persist($new_entity);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
$this->addFlash('success', $this->translator->trans('entity.created_flash'));
|
$this->addFlash('success', 'entity.created_flash');
|
||||||
|
|
||||||
return $this->redirectToRoute($this->route_base.'_edit', ['id' => $new_entity->getID()]);
|
return $this->redirectToRoute($this->route_base.'_edit', ['id' => $new_entity->getID()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($form->isSubmitted() && !$form->isValid()) {
|
if ($form->isSubmitted() && !$form->isValid()) {
|
||||||
$this->addFlash('error', $this->translator->trans('entity.created_flash.invalid'));
|
$this->addFlash('error', 'entity.created_flash.invalid');
|
||||||
}
|
}
|
||||||
|
|
||||||
//Import form
|
//Import form
|
||||||
|
|
|
@ -1,82 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
|
||||||
*
|
|
||||||
* Copyright (C) 2019 Jan Böhmer (https://github.com/jbtronics)
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace App\Controller;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class DebugController.
|
|
||||||
*/
|
|
||||||
class DebugController extends AbstractController
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @Route("/debug/flash_test")
|
|
||||||
*/
|
|
||||||
public function flashTest()
|
|
||||||
{
|
|
||||||
$this->addFlash('success', 'Success Flash Message!');
|
|
||||||
$this->addFlash('error', 'Error Flash Message!');
|
|
||||||
$this->addFlash('warning', 'Warning Flash Message!');
|
|
||||||
$this->addFlash('notice', 'Notice Flash Message!');
|
|
||||||
$this->addFlash('info', 'Info Flash Message! <b>Test</b>');
|
|
||||||
|
|
||||||
$this->addFlash('testkjfd', 'Blabla. This message type should be not know to template!');
|
|
||||||
|
|
||||||
return $this->render('base.html.twig');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Route("/debug/dummy")
|
|
||||||
*/
|
|
||||||
public function dummy(TranslatorInterface $translator)
|
|
||||||
{
|
|
||||||
//Here we collect translation keys automatically created, so they can be extracted easily
|
|
||||||
|
|
||||||
//Validators:
|
|
||||||
$translator->trans('validator.noneofitschild.self');
|
|
||||||
$translator->trans('validator.noneofitschild.children');
|
|
||||||
$translator->trans('validator.isSelectable');
|
|
||||||
$translator->trans('validator.part_lot.location_full.no_increasment');
|
|
||||||
$translator->trans('validator.part_lot.location_full');
|
|
||||||
$translator->trans('validator.part_lot.only_existing');
|
|
||||||
$translator->trans('validator.part_lot.single_part');
|
|
||||||
|
|
||||||
//Manufacturer status
|
|
||||||
$translator->trans('m_status.active.help');
|
|
||||||
$translator->trans('m_status.announced.help');
|
|
||||||
$translator->trans('m_status.discontinued.help');
|
|
||||||
$translator->trans('m_status.eol.help');
|
|
||||||
$translator->trans('m_status.nrfnd.help');
|
|
||||||
$translator->trans('m_status.unknown.help');
|
|
||||||
|
|
||||||
//Flash titles
|
|
||||||
$translator->trans('flash.success');
|
|
||||||
$translator->trans('flash.error');
|
|
||||||
$translator->trans('flash.warning');
|
|
||||||
$translator->trans('flash.notice');
|
|
||||||
$translator->trans('flash.info');
|
|
||||||
|
|
||||||
$translator->trans('validator.noLockout');
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -97,11 +97,11 @@ class PartController extends AbstractController
|
||||||
|
|
||||||
$em->persist($part);
|
$em->persist($part);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
$this->addFlash('info', $translator->trans('part.edited_flash'));
|
$this->addFlash('info', 'part.edited_flash');
|
||||||
//Reload form, so the SIUnitType entries use the new part unit
|
//Reload form, so the SIUnitType entries use the new part unit
|
||||||
$form = $this->createForm(PartBaseType::class, $part);
|
$form = $this->createForm(PartBaseType::class, $part);
|
||||||
} elseif ($form->isSubmitted() && !$form->isValid()) {
|
} elseif ($form->isSubmitted() && !$form->isValid()) {
|
||||||
$this->addFlash('error', $translator->trans('part.edited_flash.invalid'));
|
$this->addFlash('error', 'part.edited_flash.invalid');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('Parts/edit/edit_part_info.html.twig',
|
return $this->render('Parts/edit/edit_part_info.html.twig',
|
||||||
|
@ -180,13 +180,13 @@ class PartController extends AbstractController
|
||||||
|
|
||||||
$em->persist($new_part);
|
$em->persist($new_part);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
$this->addFlash('success', $translator->trans('part.created_flash'));
|
$this->addFlash('success', 'part.created_flash');
|
||||||
|
|
||||||
return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]);
|
return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($form->isSubmitted() && !$form->isValid()) {
|
if ($form->isSubmitted() && !$form->isValid()) {
|
||||||
$this->addFlash('error', $translator->trans('part.created_flash.invalid'));
|
$this->addFlash('error', 'part.created_flash.invalid');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('Parts/edit/new_part.html.twig',
|
return $this->render('Parts/edit/new_part.html.twig',
|
||||||
|
@ -216,7 +216,7 @@ class PartController extends AbstractController
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$em->persist($new_part);
|
$em->persist($new_part);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
$this->addFlash('success', $translator->trans('part.created_flash'));
|
$this->addFlash('success', 'part.created_flash');
|
||||||
|
|
||||||
return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]);
|
return $this->redirectToRoute('part_edit', ['id' => $new_part->getID()]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ class SecurityController extends AbstractController
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$passwordReset->request($form->getData()['user']);
|
$passwordReset->request($form->getData()['user']);
|
||||||
$this->addFlash('success', $this->translator->trans('pw_reset.request.success'));
|
$this->addFlash('success', 'pw_reset.request.success');
|
||||||
return $this->redirectToRoute('login');
|
return $this->redirectToRoute('login');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,9 +152,9 @@ class SecurityController extends AbstractController
|
||||||
//Try to set the new password
|
//Try to set the new password
|
||||||
$success = $passwordReset->setNewPassword($data['username'], $data['token'], $data['new_password']);
|
$success = $passwordReset->setNewPassword($data['username'], $data['token'], $data['new_password']);
|
||||||
if (!$success) {
|
if (!$success) {
|
||||||
$this->addFlash('error', $this->translator->trans('pw_reset.new_pw.error'));
|
$this->addFlash('error', 'pw_reset.new_pw.error');
|
||||||
} else {
|
} else {
|
||||||
$this->addFlash('success', $this->translator->trans('pw_reset.new_pw.success'));
|
$this->addFlash('success', 'pw_reset.new_pw.success');
|
||||||
return $this->redirectToRoute('login');
|
return $this->redirectToRoute('login');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,10 +34,10 @@ class AttachmentTypeAdminForm extends BaseEntityAdminForm
|
||||||
{
|
{
|
||||||
protected $filterTools;
|
protected $filterTools;
|
||||||
|
|
||||||
public function __construct(Security $security, ParameterBagInterface $params, TranslatorInterface $trans, FileTypeFilterTools $filterTools)
|
public function __construct(Security $security, ParameterBagInterface $params, FileTypeFilterTools $filterTools)
|
||||||
{
|
{
|
||||||
$this->filterTools = $filterTools;
|
$this->filterTools = $filterTools;
|
||||||
parent::__construct($security, $params, $trans);
|
parent::__construct($security, $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function additionalFormElements(FormBuilderInterface $builder, array $options, NamedDBElement $entity)
|
protected function additionalFormElements(FormBuilderInterface $builder, array $options, NamedDBElement $entity)
|
||||||
|
@ -45,9 +45,9 @@ class AttachmentTypeAdminForm extends BaseEntityAdminForm
|
||||||
$is_new = null === $entity->getID();
|
$is_new = null === $entity->getID();
|
||||||
|
|
||||||
$builder->add('filetype_filter', TextType::class, ['required' => false,
|
$builder->add('filetype_filter', TextType::class, ['required' => false,
|
||||||
'label' => $this->trans->trans('attachment_type.edit.filetype_filter'),
|
'label' => 'attachment_type.edit.filetype_filter',
|
||||||
'help' => $this->trans->trans('attachment_type.edit.filetype_filter.help'),
|
'help' => 'attachment_type.edit.filetype_filter.help',
|
||||||
'attr' => ['placeholder' => $this->trans->trans('attachment_type.edit.filetype_filter.placeholder')],
|
'attr' => ['placeholder' => 'attachment_type.edit.filetype_filter.placeholder'],
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), ]);
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), ]);
|
||||||
|
|
||||||
|
|
|
@ -44,13 +44,11 @@ class BaseEntityAdminForm extends AbstractType
|
||||||
{
|
{
|
||||||
protected $security;
|
protected $security;
|
||||||
protected $params;
|
protected $params;
|
||||||
protected $trans;
|
|
||||||
|
|
||||||
public function __construct(Security $security, ParameterBagInterface $params, TranslatorInterface $trans)
|
public function __construct(Security $security, ParameterBagInterface $params)
|
||||||
{
|
{
|
||||||
$this->security = $security;
|
$this->security = $security;
|
||||||
$this->params = $params;
|
$this->params = $params;
|
||||||
$this->trans = $trans;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
@ -66,23 +64,23 @@ class BaseEntityAdminForm extends AbstractType
|
||||||
$is_new = null === $entity->getID();
|
$is_new = null === $entity->getID();
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
->add('name', TextType::class, ['empty_data' => '', 'label' => $this->trans->trans('name.label'),
|
->add('name', TextType::class, ['empty_data' => '', 'label' => 'name.label',
|
||||||
'attr' => ['placeholder' => $this->trans->trans('part.name.placeholder')],
|
'attr' => ['placeholder' =>'part.name.placeholder'],
|
||||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), ])
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), ])
|
||||||
|
|
||||||
->add('parent', StructuralEntityType::class, ['class' => \get_class($entity),
|
->add('parent', StructuralEntityType::class, ['class' => \get_class($entity),
|
||||||
'required' => false, 'label' => $this->trans->trans('parent.label'),
|
'required' => false, 'label' => 'parent.label',
|
||||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity), ])
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity), ])
|
||||||
|
|
||||||
->add('not_selectable', CheckboxType::class, ['required' => false,
|
->add('not_selectable', CheckboxType::class, ['required' => false,
|
||||||
'label' => $this->trans->trans('entity.edit.not_selectable'),
|
'label' => 'entity.edit.not_selectable',
|
||||||
'help' => $this->trans->trans('entity.edit.not_selectable.help'),
|
'help' => 'entity.edit.not_selectable.help',
|
||||||
'label_attr' => ['class' => 'checkbox-custom'],
|
'label_attr' => ['class' => 'checkbox-custom'],
|
||||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), ])
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), ])
|
||||||
|
|
||||||
->add('comment', CKEditorType::class, ['required' => false, 'empty_data' => '',
|
->add('comment', CKEditorType::class, ['required' => false, 'empty_data' => '',
|
||||||
'label' => $this->trans->trans('comment.label'),
|
'label' => 'comment.label',
|
||||||
'attr' => ['rows' => 4], 'help' => $this->trans->trans('bbcode.hint'),
|
'attr' => ['rows' => 4], 'help' => 'bbcode.hint',
|
||||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), ]);
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), ]);
|
||||||
|
|
||||||
$this->additionalFormElements($builder, $options, $entity);
|
$this->additionalFormElements($builder, $options, $entity);
|
||||||
|
@ -103,13 +101,13 @@ class BaseEntityAdminForm extends AbstractType
|
||||||
$builder->add('master_picture_attachment', MasterPictureAttachmentType::class, [
|
$builder->add('master_picture_attachment', MasterPictureAttachmentType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||||
'label' => $this->trans->trans('part.edit.master_attachment'),
|
'label' => 'part.edit.master_attachment',
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//Buttons
|
//Buttons
|
||||||
$builder->add('save', SubmitType::class, [
|
$builder->add('save', SubmitType::class, [
|
||||||
'label' => $is_new ? $this->trans->trans('entity.create') : $this->trans->trans('entity.edit.save'),
|
'label' => $is_new ? 'entity.create' : 'entity.edit.save',
|
||||||
'attr' => ['class' => $is_new ? 'btn-success' : ''],
|
'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',
|
->add('reset', ResetType::class, ['label' => 'entity.edit.reset',
|
||||||
|
|
|
@ -33,46 +33,46 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
||||||
$is_new = null === $entity->getID();
|
$is_new = null === $entity->getID();
|
||||||
|
|
||||||
$builder->add('disable_footprints', CheckboxType::class, ['required' => false,
|
$builder->add('disable_footprints', CheckboxType::class, ['required' => false,
|
||||||
'label' => $this->trans->trans('category.edit.disable_footprints'),
|
'label' => 'category.edit.disable_footprints',
|
||||||
'help' => $this->trans->trans('category.edit.disable_footprints.help'),
|
'help' => 'category.edit.disable_footprints.help',
|
||||||
'label_attr' => ['class' => 'checkbox-custom'],
|
'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, ['required' => false,
|
$builder->add('disable_manufacturers', CheckboxType::class, ['required' => false,
|
||||||
'label' => $this->trans->trans('category.edit.disable_manufacturers'),
|
'label' => 'category.edit.disable_manufacturers',
|
||||||
'help' => $this->trans->trans('category.edit.disable_manufacturers.help'),
|
'help' => 'category.edit.disable_manufacturers.help',
|
||||||
'label_attr' => ['class' => 'checkbox-custom'],
|
'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, ['required' => false,
|
$builder->add('disable_autodatasheets', CheckboxType::class, ['required' => false,
|
||||||
'label' => $this->trans->trans('category.edit.disable_autodatasheets'),
|
'label' => 'category.edit.disable_autodatasheets',
|
||||||
'help' => $this->trans->trans('category.edit.disable_autodatasheets.help'),
|
'help' => 'category.edit.disable_autodatasheets.help',
|
||||||
'label_attr' => ['class' => 'checkbox-custom'],
|
'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, ['required' => false,
|
$builder->add('disable_properties', CheckboxType::class, ['required' => false,
|
||||||
'label' => $this->trans->trans('category.edit.disable_properties'),
|
'label' => 'category.edit.disable_properties',
|
||||||
'help' => $this->trans->trans('category.edit.disable_properties.help'),
|
'help' => 'category.edit.disable_properties.help',
|
||||||
'label_attr' => ['class' => 'checkbox-custom'],
|
'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, ['required' => false, 'empty_data' => '',
|
$builder->add('partname_hint', TextType::class, ['required' => false, 'empty_data' => '',
|
||||||
'label' => $this->trans->trans('category.edit.partname_hint'),
|
'label' => 'category.edit.partname_hint',
|
||||||
'attr' => ['placeholder' => $this->trans->trans('category.edit.partname_hint.placeholder')],
|
'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, ['required' => false, 'empty_data' => '',
|
$builder->add('partname_regex', TextType::class, ['required' => false, 'empty_data' => '',
|
||||||
'label' => $this->trans->trans('category.edit.partname_regex'),
|
'label' => 'category.edit.partname_regex',
|
||||||
'attr' => ['placeholder' => 'category.edit.partname_regex.placeholder'],
|
'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, ['required' => false, 'empty_data' => '',
|
$builder->add('default_description', TextType::class, ['required' => false, 'empty_data' => '',
|
||||||
'label' => $this->trans->trans('category.edit.default_description'),
|
'label' => 'category.edit.default_description',
|
||||||
'attr' => ['placeholder' => $this->trans->trans('category.edit.default_description.placeholder')],
|
'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, ['required' => false, 'empty_data' => '',
|
$builder->add('default_comment', TextType::class, ['required' => false, 'empty_data' => '',
|
||||||
'label' => $this->trans->trans('category.edit.default_comment'),
|
'label' => 'category.edit.default_comment',
|
||||||
'attr' => ['placeholder' => $this->trans->trans('category.edit.default_comment.placeholder')],
|
'attr' => ['placeholder' => $this->trans->trans('category.edit.default_comment.placeholder')],
|
||||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), ]);
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), ]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,46 +35,46 @@ class CompanyForm extends BaseEntityAdminForm
|
||||||
$is_new = null === $entity->getID();
|
$is_new = null === $entity->getID();
|
||||||
|
|
||||||
$builder->add('address', TextareaType::class, [
|
$builder->add('address', TextareaType::class, [
|
||||||
'label' => $this->trans->trans('company.edit.address'),
|
'label' => 'company.edit.address',
|
||||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||||
'attr' => ['placeholder' => $this->trans->trans('company.edit.address.placeholder')], 'required' => false,
|
'attr' => ['placeholder' => 'company.edit.address.placeholder'], 'required' => false,
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('phone_number', TelType::class, [
|
$builder->add('phone_number', TelType::class, [
|
||||||
'label' => $this->trans->trans('company.edit.phone_number'),
|
'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' => $this->trans->trans('company.edit.phone_number.placeholder')],
|
'attr' => ['placeholder' => 'company.edit.phone_number.placeholder'],
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('fax_number', TelType::class, [
|
$builder->add('fax_number', TelType::class, [
|
||||||
'label' => $this->trans->trans('company.edit.fax_number'),
|
'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'], 'required' => false,
|
'attr' => ['placeholder' => 'company.fax_number.placeholder'], 'required' => false,
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('email_address', EmailType::class, [
|
$builder->add('email_address', EmailType::class, [
|
||||||
'label' => $this->trans->trans('company.edit.email'),
|
'label' => 'company.edit.email',
|
||||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||||
'attr' => ['placeholder' => $this->trans->trans('company.edit.email.placeholder')], 'required' => false,
|
'attr' => ['placeholder' => 'company.edit.email.placeholder'], 'required' => false,
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('website', UrlType::class, [
|
$builder->add('website', UrlType::class, [
|
||||||
'label' => $this->trans->trans('company.edit.website'),
|
'label' => 'company.edit.website',
|
||||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||||
'attr' => ['placeholder' => $this->trans->trans('company.edit.website.placeholder')], 'required' => false,
|
'attr' => ['placeholder' => 'company.edit.website.placeholder'], 'required' => false,
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('auto_product_url', UrlType::class, [
|
$builder->add('auto_product_url', UrlType::class, [
|
||||||
'label' => $this->trans->trans('company.edit.auto_product_url'),
|
'label' => 'company.edit.auto_product_url',
|
||||||
'help' => $this->trans->trans('company.edit.auto_product_url.help'),
|
'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' => $this->trans->trans('company.edit.auto_product_url.placeholder')],
|
'attr' => ['placeholder' => 'company.edit.auto_product_url.placeholder'],
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -34,14 +34,14 @@ class CurrencyAdminForm extends BaseEntityAdminForm
|
||||||
|
|
||||||
$builder->add('iso_code', CurrencyType::class, [
|
$builder->add('iso_code', CurrencyType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('currency.edit.iso_code'),
|
'label' => 'currency.edit.iso_code',
|
||||||
'preferred_choices' => ['EUR', 'USD', 'GBP', 'JPY', 'CNY'],
|
'preferred_choices' => ['EUR', 'USD', 'GBP', 'JPY', 'CNY'],
|
||||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true],
|
'attr' => ['class' => 'selectpicker', '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', MoneyType::class, [
|
$builder->add('exchange_rate', MoneyType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('currency.edit.exchange_rate'),
|
'label' => 'currency.edit.exchange_rate',
|
||||||
'currency' => $this->params->get('default_currency'),
|
'currency' => $this->params->get('default_currency'),
|
||||||
'scale' => 6,
|
'scale' => 6,
|
||||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), ]);
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity), ]);
|
||||||
|
|
|
@ -32,7 +32,7 @@ class FootprintAdminForm extends BaseEntityAdminForm
|
||||||
$builder->add('footprint_3d', MasterPictureAttachmentType::class, [
|
$builder->add('footprint_3d', MasterPictureAttachmentType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'disabled' => !$this->security->isGranted(null === $entity->getID() ? 'create' : 'edit', $entity),
|
'disabled' => !$this->security->isGranted(null === $entity->getID() ? 'create' : 'edit', $entity),
|
||||||
'label' => $this->trans->trans('footprint.edit.3d_model'),
|
'label' => 'footprint.edit.3d_model',
|
||||||
'filter' => '3d_model',
|
'filter' => '3d_model',
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -36,12 +36,10 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
class ImportType extends AbstractType
|
class ImportType extends AbstractType
|
||||||
{
|
{
|
||||||
protected $security;
|
protected $security;
|
||||||
protected $trans;
|
|
||||||
|
|
||||||
public function __construct(Security $security, TranslatorInterface $trans)
|
public function __construct(Security $security)
|
||||||
{
|
{
|
||||||
$this->security = $security;
|
$this->security = $security;
|
||||||
$this->trans = $trans;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
@ -57,33 +55,33 @@ class ImportType extends AbstractType
|
||||||
|
|
||||||
->add('format', ChoiceType::class, [
|
->add('format', ChoiceType::class, [
|
||||||
'choices' => ['JSON' => 'json', 'XML' => 'xml', 'CSV' => 'csv', 'YAML' => 'yaml'],
|
'choices' => ['JSON' => 'json', 'XML' => 'xml', 'CSV' => 'csv', 'YAML' => 'yaml'],
|
||||||
'label' => $this->trans->trans('export.format'),
|
'label' => 'export.format',
|
||||||
'disabled' => $disabled, ])
|
'disabled' => $disabled, ])
|
||||||
->add('csv_separator', TextType::class, ['data' => ';',
|
->add('csv_separator', TextType::class, ['data' => ';',
|
||||||
'label' => $this->trans->trans('import.csv_separator'),
|
'label' => 'import.csv_separator',
|
||||||
'disabled' => $disabled, ]);
|
'disabled' => $disabled, ]);
|
||||||
|
|
||||||
if ($entity instanceof StructuralDBElement) {
|
if ($entity instanceof StructuralDBElement) {
|
||||||
$builder->add('parent', StructuralEntityType::class, [
|
$builder->add('parent', StructuralEntityType::class, [
|
||||||
'class' => $data['entity_class'],
|
'class' => $data['entity_class'],
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('parent.label'),
|
'label' => 'parent.label',
|
||||||
'disabled' => $disabled,
|
'disabled' => $disabled,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$builder->add('file', FileType::class, [
|
$builder->add('file', FileType::class, [
|
||||||
'label' => $this->trans->trans('import.file'),
|
'label' => 'import.file',
|
||||||
'attr' => ['class' => 'file', 'data-show-preview' => 'false', 'data-show-upload' => 'false'],
|
'attr' => ['class' => 'file', 'data-show-preview' => 'false', 'data-show-upload' => 'false'],
|
||||||
'disabled' => $disabled,
|
'disabled' => $disabled,
|
||||||
])
|
])
|
||||||
|
|
||||||
->add('preserve_children', CheckboxType::class, ['data' => true, 'required' => false,
|
->add('preserve_children', CheckboxType::class, ['data' => true, 'required' => false,
|
||||||
'label' => $this->trans->trans('import.preserve_children'),
|
'label' => 'import.preserve_children',
|
||||||
'label_attr' => ['class' => 'checkbox-custom'], 'disabled' => $disabled, ])
|
'label_attr' => ['class' => 'checkbox-custom'], 'disabled' => $disabled, ])
|
||||||
->add('abort_on_validation_error', CheckboxType::class, ['data' => true, 'required' => false,
|
->add('abort_on_validation_error', CheckboxType::class, ['data' => true, 'required' => false,
|
||||||
'label' => $this->trans->trans('import.abort_on_validation'),
|
'label' => 'import.abort_on_validation',
|
||||||
'help' => $this->trans->trans('import.abort_on_validation.help'),
|
'help' => 'import.abort_on_validation.help',
|
||||||
'label_attr' => ['class' => 'checkbox-custom'], 'disabled' => $disabled, ])
|
'label_attr' => ['class' => 'checkbox-custom'], 'disabled' => $disabled, ])
|
||||||
|
|
||||||
//Buttons
|
//Buttons
|
||||||
|
|
|
@ -33,12 +33,10 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
class MassCreationForm extends AbstractType
|
class MassCreationForm extends AbstractType
|
||||||
{
|
{
|
||||||
protected $security;
|
protected $security;
|
||||||
protected $translator;
|
|
||||||
|
|
||||||
public function __construct(Security $security, TranslatorInterface $translator)
|
public function __construct(Security $security)
|
||||||
{
|
{
|
||||||
$this->security = $security;
|
$this->security = $security;
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
|
@ -52,10 +50,10 @@ class MassCreationForm extends AbstractType
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
->add('lines', TextareaType::class, ['data' => '',
|
->add('lines', TextareaType::class, ['data' => '',
|
||||||
'label' => $this->translator->trans('mass_creation.lines'),
|
'label' => 'mass_creation.lines',
|
||||||
'disabled' => $disabled, 'required' => true,
|
'disabled' => $disabled, 'required' => true,
|
||||||
'attr' => [
|
'attr' => [
|
||||||
'placeholder' => $this->translator->trans('mass_creation.lines.placeholder'),
|
'placeholder' => 'mass_creation.lines.placeholder',
|
||||||
'rows' => 10,
|
'rows' => 10,
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
@ -63,13 +61,13 @@ class MassCreationForm extends AbstractType
|
||||||
$builder->add('parent', StructuralEntityType::class, [
|
$builder->add('parent', StructuralEntityType::class, [
|
||||||
'class' => $data['entity_class'],
|
'class' => $data['entity_class'],
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->translator->trans('parent.label'),
|
'label' => 'parent.label',
|
||||||
'disabled' => $disabled, ]);
|
'disabled' => $disabled, ]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Buttons
|
//Buttons
|
||||||
$builder->add('create', SubmitType::class, [
|
$builder->add('create', SubmitType::class, [
|
||||||
'label' => $this->translator->trans('entity.mass_creation.btn'),
|
'label' => 'entity.mass_creation.btn',
|
||||||
'disabled' => $disabled,
|
'disabled' => $disabled,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,20 +33,20 @@ class MeasurementUnitAdminForm extends BaseEntityAdminForm
|
||||||
$is_new = null === $entity->getID();
|
$is_new = null === $entity->getID();
|
||||||
|
|
||||||
$builder->add('is_integer', CheckboxType::class, ['required' => false,
|
$builder->add('is_integer', CheckboxType::class, ['required' => false,
|
||||||
'label' => $this->trans->trans('measurement_unit.edit.is_integer'),
|
'label' => 'measurement_unit.edit.is_integer',
|
||||||
'help' => $this->trans->trans('measurement_unit.edit.is_integer.help'),
|
'help' => 'measurement_unit.edit.is_integer.help',
|
||||||
'label_attr' => ['class' => 'checkbox-custom'],
|
'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, ['required' => false,
|
$builder->add('use_si_prefix', CheckboxType::class, ['required' => false,
|
||||||
'label' => $this->trans->trans('measurement_unit.edit.use_si_prefix'),
|
'label' => 'measurement_unit.edit.use_si_prefix',
|
||||||
'help' => $this->trans->trans('measurement_unit.edit.use_si_prefix.help'),
|
'help' => 'measurement_unit.edit.use_si_prefix.help',
|
||||||
'label_attr' => ['class' => 'checkbox-custom'],
|
'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, ['required' => false,
|
$builder->add('unit', TextType::class, ['required' => false,
|
||||||
'label' => $this->trans->trans('measurement_unit.edit.unit_symbol'),
|
'label' => 'measurement_unit.edit.unit_symbol',
|
||||||
'attr' => ['placeholder' => $this->trans->trans('measurement_unit.edit.unit_symbol.placeholder')],
|
'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), ]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,29 +35,29 @@ class StorelocationAdminForm extends BaseEntityAdminForm
|
||||||
|
|
||||||
$builder->add('is_full', CheckboxType::class, [
|
$builder->add('is_full', CheckboxType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('storelocation.edit.is_full.label'),
|
'label' => 'storelocation.edit.is_full.label',
|
||||||
'help' => $this->trans->trans('storelocation.edit.is_full.help'),
|
'help' => 'storelocation.edit.is_full.help',
|
||||||
'label_attr' => ['class' => 'checkbox-custom'],
|
'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, [
|
$builder->add('limit_to_existing_parts', CheckboxType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('storelocation.limit_to_existing.label'),
|
'label' => 'storelocation.limit_to_existing.label',
|
||||||
'help' => $this->trans->trans('storelocation.limit_to_existing.help'),
|
'help' => 'storelocation.limit_to_existing.help',
|
||||||
'label_attr' => ['class' => 'checkbox-custom'],
|
'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, [
|
$builder->add('only_single_part', CheckboxType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('storelocation.only_single_part.label'),
|
'label' => 'storelocation.only_single_part.label',
|
||||||
'help' => $this->trans->trans('storelocation.only_single_part.help'),
|
'help' => 'storelocation.only_single_part.help',
|
||||||
'label_attr' => ['class' => 'checkbox-custom'],
|
'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, [
|
$builder->add('storage_type', StructuralEntityType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('storelocation.storage_type.label'),
|
'label' => 'storelocation.storage_type.label',
|
||||||
'help' => $this->trans->trans('storelocation.storage_type.help'),
|
'help' => 'storelocation.storage_type.help',
|
||||||
'class' => MeasurementUnit::class, 'disable_not_selectable' => true,
|
'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), ]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ class SupplierForm extends CompanyForm
|
||||||
$builder->add('default_currency', StructuralEntityType::class, [
|
$builder->add('default_currency', StructuralEntityType::class, [
|
||||||
'class' => Currency::class,
|
'class' => Currency::class,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('supplier.edit.default_currency'),
|
'label' => 'supplier.edit.default_currency',
|
||||||
'disable_not_selectable' => true,
|
'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,7 @@ class SupplierForm extends CompanyForm
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'currency' => $this->params->get('default_currency'),
|
'currency' => $this->params->get('default_currency'),
|
||||||
'scale' => 3,
|
'scale' => 3,
|
||||||
'label' => $this->trans->trans('supplier.shipping_costs.label'),
|
'label' => 'supplier.shipping_costs.label',
|
||||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,15 +43,13 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
class AttachmentFormType extends AbstractType
|
class AttachmentFormType extends AbstractType
|
||||||
{
|
{
|
||||||
protected $attachment_helper;
|
protected $attachment_helper;
|
||||||
protected $trans;
|
|
||||||
protected $urlGenerator;
|
protected $urlGenerator;
|
||||||
protected $allow_attachments_download;
|
protected $allow_attachments_download;
|
||||||
|
|
||||||
public function __construct(AttachmentManager $attachmentHelper, TranslatorInterface $trans,
|
public function __construct(AttachmentManager $attachmentHelper,
|
||||||
UrlGeneratorInterface $urlGenerator, bool $allow_attachments_downloads)
|
UrlGeneratorInterface $urlGenerator, bool $allow_attachments_downloads)
|
||||||
{
|
{
|
||||||
$this->attachment_helper = $attachmentHelper;
|
$this->attachment_helper = $attachmentHelper;
|
||||||
$this->trans = $trans;
|
|
||||||
$this->urlGenerator = $urlGenerator;
|
$this->urlGenerator = $urlGenerator;
|
||||||
$this->allow_attachments_download = $allow_attachments_downloads;
|
$this->allow_attachments_download = $allow_attachments_downloads;
|
||||||
}
|
}
|
||||||
|
@ -59,50 +57,50 @@ class AttachmentFormType extends AbstractType
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
$builder->add('name', TextType::class, [
|
$builder->add('name', TextType::class, [
|
||||||
'label' => $this->trans->trans('attachment.edit.name'),
|
'label' => 'attachment.edit.name',
|
||||||
])
|
])
|
||||||
->add('attachment_type', StructuralEntityType::class, [
|
->add('attachment_type', StructuralEntityType::class, [
|
||||||
'label' => $this->trans->trans('attachment.edit.attachment_type'),
|
'label' => 'attachment.edit.attachment_type',
|
||||||
'class' => AttachmentType::class,
|
'class' => AttachmentType::class,
|
||||||
'disable_not_selectable' => true,
|
'disable_not_selectable' => true,
|
||||||
'attr' => ['class' => 'attachment_type_selector'],
|
'attr' => ['class' => 'attachment_type_selector'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('showInTable', CheckboxType::class, ['required' => false,
|
$builder->add('showInTable', CheckboxType::class, ['required' => false,
|
||||||
'label' => $this->trans->trans('attachment.edit.show_in_table'),
|
'label' => 'attachment.edit.show_in_table',
|
||||||
'attr' => ['class' => 'form-control-sm'],
|
'attr' => ['class' => 'form-control-sm'],
|
||||||
'label_attr' => ['class' => 'checkbox-custom'], ]);
|
'label_attr' => ['class' => 'checkbox-custom'], ]);
|
||||||
|
|
||||||
$builder->add('secureFile', CheckboxType::class, ['required' => false,
|
$builder->add('secureFile', CheckboxType::class, ['required' => false,
|
||||||
'label' => $this->trans->trans('attachment.edit.secure_file'),
|
'label' => 'attachment.edit.secure_file',
|
||||||
'mapped' => false,
|
'mapped' => false,
|
||||||
'attr' => ['class' => 'form-control-sm'],
|
'attr' => ['class' => 'form-control-sm'],
|
||||||
'help' => $this->trans->trans('attachment.edit.secure_file.help'),
|
'help' => 'attachment.edit.secure_file.help',
|
||||||
'label_attr' => ['class' => 'checkbox-custom'], ]);
|
'label_attr' => ['class' => 'checkbox-custom'], ]);
|
||||||
|
|
||||||
$builder->add('url', TextType::class, [
|
$builder->add('url', TextType::class, [
|
||||||
'label' => $this->trans->trans('attachment.edit.url'),
|
'label' => 'attachment.edit.url',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'attr' => [
|
'attr' => [
|
||||||
'data-autocomplete' => $this->urlGenerator->generate('typeahead_builtInRessources', ['query' => 'QUERY']),
|
'data-autocomplete' => $this->urlGenerator->generate('typeahead_builtInRessources', ['query' => 'QUERY']),
|
||||||
//Disable browser autocomplete
|
//Disable browser autocomplete
|
||||||
'autocomplete' => 'off',
|
'autocomplete' => 'off',
|
||||||
],
|
],
|
||||||
'help' => $this->trans->trans('attachment.edit.url.help'),
|
'help' => 'attachment.edit.url.help',
|
||||||
'constraints' => [
|
'constraints' => [
|
||||||
$options['allow_builtins'] ? new UrlOrBuiltin() : new Url(),
|
$options['allow_builtins'] ? new UrlOrBuiltin() : new Url(),
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('downloadURL', CheckboxType::class, ['required' => false,
|
$builder->add('downloadURL', CheckboxType::class, ['required' => false,
|
||||||
'label' => $this->trans->trans('attachment.edit.download_url'),
|
'label' => 'attachment.edit.download_url',
|
||||||
'mapped' => false,
|
'mapped' => false,
|
||||||
'disabled' => !$this->allow_attachments_download,
|
'disabled' => !$this->allow_attachments_download,
|
||||||
'attr' => ['class' => 'form-control-sm'],
|
'attr' => ['class' => 'form-control-sm'],
|
||||||
'label_attr' => ['class' => 'checkbox-custom'], ]);
|
'label_attr' => ['class' => 'checkbox-custom'], ]);
|
||||||
|
|
||||||
$builder->add('file', FileType::class, [
|
$builder->add('file', FileType::class, [
|
||||||
'label' => $this->trans->trans('attachment.edit.file'),
|
'label' => 'attachment.edit.file',
|
||||||
'mapped' => false,
|
'mapped' => false,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'attr' => ['class' => 'file', 'data-show-preview' => 'false', 'data-show-upload' => 'false'],
|
'attr' => ['class' => 'file', 'data-show-preview' => 'false', 'data-show-upload' => 'false'],
|
||||||
|
|
|
@ -40,12 +40,10 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
class OrderdetailType extends AbstractType
|
class OrderdetailType extends AbstractType
|
||||||
{
|
{
|
||||||
protected $trans;
|
|
||||||
protected $security;
|
protected $security;
|
||||||
|
|
||||||
public function __construct(TranslatorInterface $trans, Security $security)
|
public function __construct( Security $security)
|
||||||
{
|
{
|
||||||
$this->trans = $trans;
|
|
||||||
$this->security = $security;
|
$this->security = $security;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,27 +53,27 @@ class OrderdetailType extends AbstractType
|
||||||
$orderdetail = $builder->getData();
|
$orderdetail = $builder->getData();
|
||||||
|
|
||||||
$builder->add('supplierpartnr', TextType::class, [
|
$builder->add('supplierpartnr', TextType::class, [
|
||||||
'label' => $this->trans->trans('orderdetails.edit.supplierpartnr'),
|
'label' => 'orderdetails.edit.supplierpartnr',
|
||||||
'attr' => ['placeholder' => $this->trans->trans('orderdetails.edit.supplierpartnr.placeholder')],
|
'attr' => ['placeholder' => 'orderdetails.edit.supplierpartnr.placeholder'],
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('supplier', StructuralEntityType::class, [
|
$builder->add('supplier', StructuralEntityType::class, [
|
||||||
'class' => Supplier::class, 'disable_not_selectable' => true,
|
'class' => Supplier::class, 'disable_not_selectable' => true,
|
||||||
'label' => $this->trans->trans('orderdetails.edit.supplier'),
|
'label' => 'orderdetails.edit.supplier',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('supplier_product_url', UrlType::class, [
|
$builder->add('supplier_product_url', UrlType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
'label' => $this->trans->trans('orderdetails.edit.url'),
|
'label' => 'orderdetails.edit.url',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('obsolete', CheckboxType::class, [
|
$builder->add('obsolete', CheckboxType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label_attr' => ['class' => 'checkbox-custom'],
|
'label_attr' => ['class' => 'checkbox-custom'],
|
||||||
'label' => $this->trans->trans('orderdetails.edit.obsolete'),
|
'label' => 'orderdetails.edit.obsolete',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//Add pricedetails after we know the data, so we can set the default currency
|
//Add pricedetails after we know the data, so we can set the default currency
|
||||||
|
|
|
@ -54,10 +54,9 @@ class PartBaseType extends AbstractType
|
||||||
protected $trans;
|
protected $trans;
|
||||||
protected $urlGenerator;
|
protected $urlGenerator;
|
||||||
|
|
||||||
public function __construct(Security $security, TranslatorInterface $trans, UrlGeneratorInterface $urlGenerator)
|
public function __construct(Security $security, UrlGeneratorInterface $urlGenerator)
|
||||||
{
|
{
|
||||||
$this->security = $security;
|
$this->security = $security;
|
||||||
$this->trans = $trans;
|
|
||||||
$this->urlGenerator = $urlGenerator;
|
$this->urlGenerator = $urlGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,52 +66,52 @@ class PartBaseType extends AbstractType
|
||||||
$part = $builder->getData();
|
$part = $builder->getData();
|
||||||
|
|
||||||
$status_choices = [
|
$status_choices = [
|
||||||
$this->trans->trans('m_status.unknown') => '',
|
'm_status.unknown' => '',
|
||||||
$this->trans->trans('m_status.announced') => 'announced',
|
'm_status.announced' => 'announced',
|
||||||
$this->trans->trans('m_status.active') => 'active',
|
'm_status.active' => 'active',
|
||||||
$this->trans->trans('m_status.nrfnd') => 'nrfnd',
|
'm_status.nrfnd' => 'nrfnd',
|
||||||
$this->trans->trans('m_status.eol') => 'eol',
|
'm_status.eol' => 'eol',
|
||||||
$this->trans->trans('m_status.discontinued') => 'discontinued',
|
'm_status.discontinued' => 'discontinued',
|
||||||
];
|
];
|
||||||
|
|
||||||
//Common section
|
//Common section
|
||||||
$builder
|
$builder
|
||||||
->add('name', TextType::class, [
|
->add('name', TextType::class, [
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
'label' => $this->trans->trans('part.edit.name'),
|
'label' => 'part.edit.name',
|
||||||
'attr' => ['placeholder' => $this->trans->trans('part.edit.name.placeholder')],
|
'attr' => ['placeholder' => 'part.edit.name.placeholder'],
|
||||||
'disabled' => !$this->security->isGranted('name.edit', $part),
|
'disabled' => !$this->security->isGranted('name.edit', $part),
|
||||||
])
|
])
|
||||||
->add('description', CKEditorType::class, [
|
->add('description', CKEditorType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
'label' => $this->trans->trans('part.edit.description'),
|
'label' => 'part.edit.description',
|
||||||
'config_name' => 'description_config',
|
'config_name' => 'description_config',
|
||||||
'attr' => ['placeholder' => $this->trans->trans('part.edit.description.placeholder'), 'rows' => 2],
|
'attr' => ['placeholder' => 'part.edit.description.placeholder', 'rows' => 2],
|
||||||
'disabled' => !$this->security->isGranted('description.edit', $part),
|
'disabled' => !$this->security->isGranted('description.edit', $part),
|
||||||
])
|
])
|
||||||
->add('minAmount', SIUnitType::class, [
|
->add('minAmount', SIUnitType::class, [
|
||||||
'attr' => ['min' => 0, 'placeholder' => $this->trans->trans('part.editmininstock.placeholder')],
|
'attr' => ['min' => 0, 'placeholder' => 'part.editmininstock.placeholder'],
|
||||||
'label' => $this->trans->trans('part.edit.mininstock'),
|
'label' => 'part.edit.mininstock',
|
||||||
'measurement_unit' => $part->getPartUnit(),
|
'measurement_unit' => $part->getPartUnit(),
|
||||||
'disabled' => !$this->security->isGranted('minamount.edit', $part),
|
'disabled' => !$this->security->isGranted('minamount.edit', $part),
|
||||||
])
|
])
|
||||||
->add('category', StructuralEntityType::class, [
|
->add('category', StructuralEntityType::class, [
|
||||||
'class' => Category::class,
|
'class' => Category::class,
|
||||||
'label' => $this->trans->trans('part.edit.category'),
|
'label' => 'part.edit.category',
|
||||||
'disable_not_selectable' => true,
|
'disable_not_selectable' => true,
|
||||||
'disabled' => !$this->security->isGranted('category.edit', $part),
|
'disabled' => !$this->security->isGranted('category.edit', $part),
|
||||||
])
|
])
|
||||||
->add('footprint', StructuralEntityType::class, [
|
->add('footprint', StructuralEntityType::class, [
|
||||||
'class' => Footprint::class,
|
'class' => Footprint::class,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('part.edit.footprint'),
|
'label' => 'part.edit.footprint',
|
||||||
'disable_not_selectable' => true,
|
'disable_not_selectable' => true,
|
||||||
'disabled' => !$this->security->isGranted('footprint.edit', $part),
|
'disabled' => !$this->security->isGranted('footprint.edit', $part),
|
||||||
])
|
])
|
||||||
->add('tags', TextType::class, [
|
->add('tags', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('part.edit.tags'),
|
'label' => 'part.edit.tags',
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
'attr' => [
|
'attr' => [
|
||||||
'class' => 'tagsinput',
|
'class' => 'tagsinput',
|
||||||
|
@ -124,23 +123,23 @@ class PartBaseType extends AbstractType
|
||||||
$builder->add('manufacturer', StructuralEntityType::class, [
|
$builder->add('manufacturer', StructuralEntityType::class, [
|
||||||
'class' => Manufacturer::class,
|
'class' => Manufacturer::class,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('part.edit.manufacturer.label'),
|
'label' => 'part.edit.manufacturer.label',
|
||||||
'disable_not_selectable' => true,
|
'disable_not_selectable' => true,
|
||||||
'disabled' => !$this->security->isGranted('manufacturer.edit', $part),
|
'disabled' => !$this->security->isGranted('manufacturer.edit', $part),
|
||||||
])
|
])
|
||||||
->add('manufacturer_product_url', UrlType::class, [
|
->add('manufacturer_product_url', UrlType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
'label' => $this->trans->trans('part.edit.manufacturer_url.label'),
|
'label' => 'part.edit.manufacturer_url.label',
|
||||||
'disabled' => !$this->security->isGranted('mpn.edit', $part),
|
'disabled' => !$this->security->isGranted('mpn.edit', $part),
|
||||||
])
|
])
|
||||||
->add('manufacturer_product_number', TextType::class, [
|
->add('manufacturer_product_number', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
'label' => $this->trans->trans('part.edit.mpn'),
|
'label' => 'part.edit.mpn',
|
||||||
'disabled' => !$this->security->isGranted('mpn.edit', $part), ])
|
'disabled' => !$this->security->isGranted('mpn.edit', $part), ])
|
||||||
->add('manufacturing_status', ChoiceType::class, [
|
->add('manufacturing_status', ChoiceType::class, [
|
||||||
'label' => $this->trans->trans('part.edit.manufacturing_status'),
|
'label' => 'part.edit.manufacturing_status',
|
||||||
'choices' => $status_choices,
|
'choices' => $status_choices,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'disabled' => !$this->security->isGranted('status.edit', $part),
|
'disabled' => !$this->security->isGranted('status.edit', $part),
|
||||||
|
@ -150,18 +149,18 @@ class PartBaseType extends AbstractType
|
||||||
$builder->add('needsReview', CheckboxType::class, [
|
$builder->add('needsReview', CheckboxType::class, [
|
||||||
'label_attr' => ['class' => 'checkbox-custom'],
|
'label_attr' => ['class' => 'checkbox-custom'],
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('part.edit.needs_review'),
|
'label' => 'part.edit.needs_review',
|
||||||
'disabled' => !$this->security->isGranted('edit', $part),
|
'disabled' => !$this->security->isGranted('edit', $part),
|
||||||
])
|
])
|
||||||
->add('favorite', CheckboxType::class, [
|
->add('favorite', CheckboxType::class, [
|
||||||
'label_attr' => ['class' => 'checkbox-custom'],
|
'label_attr' => ['class' => 'checkbox-custom'],
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('part.edit.is_favorite'),
|
'label' => 'part.edit.is_favorite',
|
||||||
'disabled' => !$this->security->isGranted('change_favorite', $part),
|
'disabled' => !$this->security->isGranted('change_favorite', $part),
|
||||||
])
|
])
|
||||||
->add('mass', SIUnitType::class, [
|
->add('mass', SIUnitType::class, [
|
||||||
'unit' => 'g',
|
'unit' => 'g',
|
||||||
'label' => $this->trans->trans('part.edit.mass'),
|
'label' => 'part.edit.mass',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'disabled' => !$this->security->isGranted('mass.edit', $part),
|
'disabled' => !$this->security->isGranted('mass.edit', $part),
|
||||||
])
|
])
|
||||||
|
@ -169,14 +168,14 @@ class PartBaseType extends AbstractType
|
||||||
'class' => MeasurementUnit::class,
|
'class' => MeasurementUnit::class,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'disable_not_selectable' => true,
|
'disable_not_selectable' => true,
|
||||||
'label' => $this->trans->trans('part.edit.partUnit'),
|
'label' => 'part.edit.partUnit',
|
||||||
'disabled' => !$this->security->isGranted('unit.edit', $part),
|
'disabled' => !$this->security->isGranted('unit.edit', $part),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//Comment section
|
//Comment section
|
||||||
$builder->add('comment', CKEditorType::class, [
|
$builder->add('comment', CKEditorType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('part.edit.comment'),
|
'label' => 'part.edit.comment',
|
||||||
'attr' => ['rows' => 4],
|
'attr' => ['rows' => 4],
|
||||||
'disabled' => !$this->security->isGranted('comment.edit', $part), 'empty_data' => '',
|
'disabled' => !$this->security->isGranted('comment.edit', $part), 'empty_data' => '',
|
||||||
]);
|
]);
|
||||||
|
@ -210,7 +209,7 @@ class PartBaseType extends AbstractType
|
||||||
$builder->add('master_picture_attachment', MasterPictureAttachmentType::class, [
|
$builder->add('master_picture_attachment', MasterPictureAttachmentType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'disabled' => !$this->security->isGranted('attachments.edit', $part),
|
'disabled' => !$this->security->isGranted('attachments.edit', $part),
|
||||||
'label' => $this->trans->trans('part.edit.master_attachment'),
|
'label' => 'part.edit.master_attachment',
|
||||||
'entity' => $part,
|
'entity' => $part,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -230,8 +229,8 @@ class PartBaseType extends AbstractType
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
//Buttons
|
//Buttons
|
||||||
->add('save', SubmitType::class, ['label' => $this->trans->trans('part.edit.save')])
|
->add('save', SubmitType::class, ['label' => 'part.edit.save'])
|
||||||
->add('reset', ResetType::class, ['label' => $this->trans->trans('part.edit.reset')]);
|
->add('reset', ResetType::class, ['label' => 'part.edit.reset']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
|
|
@ -37,26 +37,24 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
class PartLotType extends AbstractType
|
class PartLotType extends AbstractType
|
||||||
{
|
{
|
||||||
protected $trans;
|
|
||||||
protected $security;
|
protected $security;
|
||||||
|
|
||||||
public function __construct(TranslatorInterface $trans, Security $security)
|
public function __construct(Security $security)
|
||||||
{
|
{
|
||||||
$this->trans = $trans;
|
|
||||||
$this->security = $security;
|
$this->security = $security;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
$builder->add('description', TextType::class, [
|
$builder->add('description', TextType::class, [
|
||||||
'label' => $this->trans->trans('part_lot.edit.description'),
|
'label' => 'part_lot.edit.description',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
'attr' => ['class' => 'form-control-sm'],
|
'attr' => ['class' => 'form-control-sm'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('storage_location', StructuralEntityType::class, ['class' => Storelocation::class,
|
$builder->add('storage_location', StructuralEntityType::class, ['class' => Storelocation::class,
|
||||||
'label' => $this->trans->trans('part_lot.edit.location'),
|
'label' => 'part_lot.edit.location',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'disable_not_selectable' => true,
|
'disable_not_selectable' => true,
|
||||||
'attr' => ['class' => 'selectpicker form-control-sm', 'data-live-search' => true],
|
'attr' => ['class' => 'selectpicker form-control-sm', 'data-live-search' => true],
|
||||||
|
@ -64,29 +62,29 @@ class PartLotType extends AbstractType
|
||||||
|
|
||||||
$builder->add('amount', SIUnitType::class, [
|
$builder->add('amount', SIUnitType::class, [
|
||||||
'measurement_unit' => $options['measurement_unit'],
|
'measurement_unit' => $options['measurement_unit'],
|
||||||
'label' => $this->trans->trans('part_lot.edit.amount'),
|
'label' => 'part_lot.edit.amount',
|
||||||
'attr' => ['class' => 'form-control-sm'],
|
'attr' => ['class' => 'form-control-sm'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('instock_unknown', CheckboxType::class, ['required' => false,
|
$builder->add('instock_unknown', CheckboxType::class, ['required' => false,
|
||||||
'label' => $this->trans->trans('part_lot.edit.instock_unknown'),
|
'label' => 'part_lot.edit.instock_unknown',
|
||||||
'attr' => ['class' => 'form-control-sm'],
|
'attr' => ['class' => 'form-control-sm'],
|
||||||
'label_attr' => ['class' => 'checkbox-custom'],
|
'label_attr' => ['class' => 'checkbox-custom'],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('needs_refill', CheckboxType::class, ['label_attr' => ['class' => 'checkbox-custom'],
|
$builder->add('needs_refill', CheckboxType::class, ['label_attr' => ['class' => 'checkbox-custom'],
|
||||||
'label' => $this->trans->trans('part_lot.edit.needs_refill'),
|
'label' => 'part_lot.edit.needs_refill',
|
||||||
'attr' => ['class' => 'form-control-sm'],
|
'attr' => ['class' => 'form-control-sm'],
|
||||||
'required' => false,
|
'required' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('expirationDate', DateTimeType::class, [
|
$builder->add('expirationDate', DateTimeType::class, [
|
||||||
'label' => $this->trans->trans('part_lot.edit.expiration_date'),
|
'label' => 'part_lot.edit.expiration_date',
|
||||||
'attr' => [],
|
'attr' => [],
|
||||||
'required' => false, ]);
|
'required' => false, ]);
|
||||||
|
|
||||||
$builder->add('comment', TextType::class, [
|
$builder->add('comment', TextType::class, [
|
||||||
'label' => $this->trans->trans('part_lot.edit.comment'),
|
'label' => 'part_lot.edit.comment',
|
||||||
'attr' => ['class' => 'form-control-sm'],
|
'attr' => ['class' => 'form-control-sm'],
|
||||||
'required' => false, 'empty_data' => '',
|
'required' => false, 'empty_data' => '',
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -36,14 +36,17 @@ class PricedetailType extends AbstractType
|
||||||
{
|
{
|
||||||
//No labels needed, we define translation in templates
|
//No labels needed, we define translation in templates
|
||||||
$builder->add('min_discount_quantity', SIUnitType::class, [
|
$builder->add('min_discount_quantity', SIUnitType::class, [
|
||||||
|
'label' => false,
|
||||||
'measurement_unit' => $options['measurement_unit'],
|
'measurement_unit' => $options['measurement_unit'],
|
||||||
'attr' => ['class' => 'form-control-sm'],
|
'attr' => ['class' => 'form-control-sm'],
|
||||||
]);
|
]);
|
||||||
$builder->add('price_related_quantity', SIUnitType::class, [
|
$builder->add('price_related_quantity', SIUnitType::class, [
|
||||||
|
'label' => false,
|
||||||
'measurement_unit' => $options['measurement_unit'],
|
'measurement_unit' => $options['measurement_unit'],
|
||||||
'attr' => ['class' => 'form-control-sm'],
|
'attr' => ['class' => 'form-control-sm'],
|
||||||
]);
|
]);
|
||||||
$builder->add('price', NumberType::class, [
|
$builder->add('price', NumberType::class, [
|
||||||
|
'label' => false,
|
||||||
'scale' => 5,
|
'scale' => 5,
|
||||||
'html5' => true,
|
'html5' => true,
|
||||||
'attr' => ['min' => 0, 'step' => 'any'],
|
'attr' => ['min' => 0, 'step' => 'any'],
|
||||||
|
|
|
@ -102,6 +102,7 @@ class SIUnitType extends AbstractType implements DataMapperInterface
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('value', NumberType::class, [
|
->add('value', NumberType::class, [
|
||||||
|
'label' => false,
|
||||||
'html5' => $options['html5'],
|
'html5' => $options['html5'],
|
||||||
'attr' => [
|
'attr' => [
|
||||||
'min' => (string) $options['min'],
|
'min' => (string) $options['min'],
|
||||||
|
@ -112,6 +113,7 @@ class SIUnitType extends AbstractType implements DataMapperInterface
|
||||||
|
|
||||||
if ($options['show_prefix']) {
|
if ($options['show_prefix']) {
|
||||||
$builder->add('prefix', ChoiceType::class, [
|
$builder->add('prefix', ChoiceType::class, [
|
||||||
|
'label' => 'false',
|
||||||
'choices' => ['M' => 6, 'k' => 3, '' => 0, 'm' => -3, 'µ' => -6],
|
'choices' => ['M' => 6, 'k' => 3, '' => 0, 'm' => -3, 'µ' => -6],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,12 +49,10 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
class UserAdminForm extends AbstractType
|
class UserAdminForm extends AbstractType
|
||||||
{
|
{
|
||||||
protected $security;
|
protected $security;
|
||||||
protected $trans;
|
|
||||||
|
|
||||||
public function __construct(Security $security, TranslatorInterface $trans)
|
public function __construct(Security $security)
|
||||||
{
|
{
|
||||||
$this->security = $security;
|
$this->security = $security;
|
||||||
$this->trans = $trans;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function configureOptions(OptionsResolver $resolver)
|
public function configureOptions(OptionsResolver $resolver)
|
||||||
|
@ -72,44 +70,44 @@ class UserAdminForm extends AbstractType
|
||||||
$builder
|
$builder
|
||||||
->add('name', TextType::class, [
|
->add('name', TextType::class, [
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
'label' => $this->trans->trans('user.username.label'),
|
'label' => 'user.username.label',
|
||||||
'attr' => ['placeholder' => $this->trans->trans('user.username.placeholder')],
|
'attr' => ['placeholder' => 'user.username.placeholder'],
|
||||||
'disabled' => !$this->security->isGranted('edit_username', $entity),
|
'disabled' => !$this->security->isGranted('edit_username', $entity),
|
||||||
])
|
])
|
||||||
|
|
||||||
->add('group', StructuralEntityType::class, [
|
->add('group', StructuralEntityType::class, [
|
||||||
'class' => Group::class,
|
'class' => Group::class,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('group.label'),
|
'label' => 'group.label',
|
||||||
'disable_not_selectable' => true,
|
'disable_not_selectable' => true,
|
||||||
'disabled' => !$this->security->isGranted('change_group', $entity), ])
|
'disabled' => !$this->security->isGranted('change_group', $entity), ])
|
||||||
|
|
||||||
->add('first_name', TextType::class, [
|
->add('first_name', TextType::class, [
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
'label' => $this->trans->trans('user.firstName.label'),
|
'label' => 'user.firstName.label',
|
||||||
'attr' => ['placeholder' => $this->trans->trans('user.firstName.placeholder')], 'required' => false,
|
'attr' => ['placeholder' => 'user.firstName.placeholder'], 'required' => false,
|
||||||
'disabled' => !$this->security->isGranted('edit_infos', $entity),
|
'disabled' => !$this->security->isGranted('edit_infos', $entity),
|
||||||
])
|
])
|
||||||
|
|
||||||
->add('last_name', TextType::class, [
|
->add('last_name', TextType::class, [
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
'label' => $this->trans->trans('user.lastName.label'),
|
'label' => 'user.lastName.label',
|
||||||
'attr' => ['placeholder' => $this->trans->trans('user.lastName.placeholder')],
|
'attr' => ['placeholder' => 'user.lastName.placeholder'],
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'disabled' => !$this->security->isGranted('edit_infos', $entity),
|
'disabled' => !$this->security->isGranted('edit_infos', $entity),
|
||||||
])
|
])
|
||||||
|
|
||||||
->add('email', TextType::class, [
|
->add('email', TextType::class, [
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
'label' => $this->trans->trans('user.email.label'),
|
'label' => 'user.email.label',
|
||||||
'attr' => ['placeholder' => $this->trans->trans('user.email.placeholder')],
|
'attr' => ['placeholder' => 'user.email.placeholder'],
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'disabled' => !$this->security->isGranted('edit_infos', $entity), ])
|
'disabled' => !$this->security->isGranted('edit_infos', $entity), ])
|
||||||
|
|
||||||
->add('department', TextType::class, [
|
->add('department', TextType::class, [
|
||||||
'empty_data' => '',
|
'empty_data' => '',
|
||||||
'label' => $this->trans->trans('user.department.label'),
|
'label' => 'user.department.label',
|
||||||
'attr' => ['placeholder' => $this->trans->trans('user.department.placeholder')],
|
'attr' => ['placeholder' => 'user.department.placeholder'],
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'disabled' => !$this->security->isGranted('edit_infos', $entity),
|
'disabled' => !$this->security->isGranted('edit_infos', $entity),
|
||||||
])
|
])
|
||||||
|
@ -118,16 +116,16 @@ class UserAdminForm extends AbstractType
|
||||||
->add('language', LanguageType::class, [
|
->add('language', LanguageType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true],
|
'attr' => ['class' => 'selectpicker', 'data-live-search' => true],
|
||||||
'placeholder' => $this->trans->trans('user_settings.language.placeholder'),
|
'placeholder' => 'user_settings.language.placeholder',
|
||||||
'label' => $this->trans->trans('user.language_select'),
|
'label' => 'user.language_select',
|
||||||
'preferred_choices' => ['en', 'de'],
|
'preferred_choices' => ['en', 'de'],
|
||||||
'disabled' => !$this->security->isGranted('change_user_settings', $entity),
|
'disabled' => !$this->security->isGranted('change_user_settings', $entity),
|
||||||
])
|
])
|
||||||
->add('timezone', TimezoneType::class, [
|
->add('timezone', TimezoneType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true],
|
'attr' => ['class' => 'selectpicker', 'data-live-search' => true],
|
||||||
'placeholder' => $this->trans->trans('user_settings.timezone.placeholder'),
|
'placeholder' => 'user_settings.timezone.placeholder',
|
||||||
'label' => $this->trans->trans('user.timezone.label'),
|
'label' => 'user.timezone.label',
|
||||||
'preferred_choices' => ['Europe/Berlin'],
|
'preferred_choices' => ['Europe/Berlin'],
|
||||||
'disabled' => !$this->security->isGranted('change_user_settings', $entity),
|
'disabled' => !$this->security->isGranted('change_user_settings', $entity),
|
||||||
])
|
])
|
||||||
|
@ -138,20 +136,20 @@ class UserAdminForm extends AbstractType
|
||||||
return $value;
|
return $value;
|
||||||
},
|
},
|
||||||
'attr' => ['class' => 'selectpicker'],
|
'attr' => ['class' => 'selectpicker'],
|
||||||
'placeholder' => $this->trans->trans('user_settings.theme.placeholder'),
|
'placeholder' => 'user_settings.theme.placeholder',
|
||||||
'label' => $this->trans->trans('user.theme.label'),
|
'label' => 'user.theme.label',
|
||||||
'disabled' => !$this->security->isGranted('change_user_settings', $entity),
|
'disabled' => !$this->security->isGranted('change_user_settings', $entity),
|
||||||
])
|
])
|
||||||
->add('currency', CurrencyEntityType::class, [
|
->add('currency', CurrencyEntityType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('user.currency.label'),
|
'label' => 'user.currency.label',
|
||||||
'disabled' => !$this->security->isGranted('change_user_settings', $entity),
|
'disabled' => !$this->security->isGranted('change_user_settings', $entity),
|
||||||
])
|
])
|
||||||
|
|
||||||
->add('new_password', RepeatedType::class, [
|
->add('new_password', RepeatedType::class, [
|
||||||
'type' => PasswordType::class,
|
'type' => PasswordType::class,
|
||||||
'first_options' => ['label' => $this->trans->trans('user.settings.pw_new.label')],
|
'first_options' => ['label' => 'user.settings.pw_new.label'],
|
||||||
'second_options' => ['label' => $this->trans->trans('user.settings.pw_confirm.label')],
|
'second_options' => ['label' => 'user.settings.pw_confirm.label'],
|
||||||
'invalid_message' => 'password_must_match',
|
'invalid_message' => 'password_must_match',
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'mapped' => false,
|
'mapped' => false,
|
||||||
|
@ -165,14 +163,14 @@ class UserAdminForm extends AbstractType
|
||||||
->add('need_pw_change', CheckboxType::class, [
|
->add('need_pw_change', CheckboxType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label_attr' => ['class' => 'checkbox-custom'],
|
'label_attr' => ['class' => 'checkbox-custom'],
|
||||||
'label' => $this->trans->trans('user.edit.needs_pw_change'),
|
'label' => 'user.edit.needs_pw_change',
|
||||||
'disabled' => !$this->security->isGranted('set_password', $entity),
|
'disabled' => !$this->security->isGranted('set_password', $entity),
|
||||||
])
|
])
|
||||||
|
|
||||||
->add('disabled', CheckboxType::class, [
|
->add('disabled', CheckboxType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label_attr' => ['class' => 'checkbox-custom'],
|
'label_attr' => ['class' => 'checkbox-custom'],
|
||||||
'label' => $this->trans->trans('user.edit.user_disabled'),
|
'label' => 'user.edit.user_disabled',
|
||||||
'disabled' => !$this->security->isGranted('set_password', $entity)
|
'disabled' => !$this->security->isGranted('set_password', $entity)
|
||||||
|| $entity === $this->security->getUser(),
|
|| $entity === $this->security->getUser(),
|
||||||
])
|
])
|
||||||
|
@ -205,11 +203,11 @@ class UserAdminForm extends AbstractType
|
||||||
|
|
||||||
//Buttons
|
//Buttons
|
||||||
$builder->add('save', SubmitType::class, [
|
$builder->add('save', SubmitType::class, [
|
||||||
'label' => $is_new ? $this->trans->trans('user.create') : $this->trans->trans('user.edit.save'),
|
'label' => $is_new ? 'user.create' : 'user.edit.save',
|
||||||
'attr' => ['class' => $is_new ? 'btn-success' : ''],
|
'attr' => ['class' => $is_new ? 'btn-success' : ''],
|
||||||
])
|
])
|
||||||
->add('reset', ResetType::class, [
|
->add('reset', ResetType::class, [
|
||||||
'label' => $this->trans->trans('entity.edit.reset'),
|
'label' => 'entity.edit.reset',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,15 +39,11 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
class UserSettingsType extends AbstractType
|
class UserSettingsType extends AbstractType
|
||||||
{
|
{
|
||||||
protected $security;
|
protected $security;
|
||||||
|
|
||||||
protected $trans;
|
|
||||||
|
|
||||||
protected $demo_mode;
|
protected $demo_mode;
|
||||||
|
|
||||||
public function __construct(Security $security, TranslatorInterface $trans, bool $demo_mode)
|
public function __construct(Security $security, bool $demo_mode)
|
||||||
{
|
{
|
||||||
$this->security = $security;
|
$this->security = $security;
|
||||||
$this->trans = $trans;
|
|
||||||
$this->demo_mode = $demo_mode;
|
$this->demo_mode = $demo_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,43 +51,43 @@ class UserSettingsType extends AbstractType
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('name', TextType::class, [
|
->add('name', TextType::class, [
|
||||||
'label' => $this->trans->trans('user.username.label'),
|
'label' => 'user.username.label',
|
||||||
'disabled' => !$this->security->isGranted('edit_username', $options['data']) || $this->demo_mode,
|
'disabled' => !$this->security->isGranted('edit_username', $options['data']) || $this->demo_mode,
|
||||||
])
|
])
|
||||||
->add('first_name', TextType::class, [
|
->add('first_name', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('user.firstName.label'),
|
'label' => 'user.firstName.label',
|
||||||
'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode,
|
'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode,
|
||||||
])
|
])
|
||||||
->add('last_name', TextType::class, [
|
->add('last_name', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('user.lastName.label'),
|
'label' => 'user.lastName.label',
|
||||||
'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode,
|
'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode,
|
||||||
])
|
])
|
||||||
->add('department', TextType::class, [
|
->add('department', TextType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('user.department.label'),
|
'label' => 'user.department.label',
|
||||||
'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode,
|
'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode,
|
||||||
])
|
])
|
||||||
->add('email', EmailType::class, [
|
->add('email', EmailType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('user.email.label'),
|
'label' => 'user.email.label',
|
||||||
'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode,
|
'disabled' => !$this->security->isGranted('edit_infos', $options['data']) || $this->demo_mode,
|
||||||
])
|
])
|
||||||
->add('language', LanguageType::class, [
|
->add('language', LanguageType::class, [
|
||||||
'disabled' => $this->demo_mode,
|
'disabled' => $this->demo_mode,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true],
|
'attr' => ['class' => 'selectpicker', 'data-live-search' => true],
|
||||||
'placeholder' => $this->trans->trans('user_settings.language.placeholder'),
|
'placeholder' => 'user_settings.language.placeholder',
|
||||||
'label' => $this->trans->trans('user.language_select'),
|
'label' => 'user.language_select',
|
||||||
'preferred_choices' => ['en', 'de'],
|
'preferred_choices' => ['en', 'de'],
|
||||||
])
|
])
|
||||||
->add('timezone', TimezoneType::class, [
|
->add('timezone', TimezoneType::class, [
|
||||||
'disabled' => $this->demo_mode,
|
'disabled' => $this->demo_mode,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'attr' => ['class' => 'selectpicker', 'data-live-search' => true],
|
'attr' => ['class' => 'selectpicker', 'data-live-search' => true],
|
||||||
'placeholder' => $this->trans->trans('user_settings.timezone.placeholder'),
|
'placeholder' => 'user_settings.timezone.placeholder',
|
||||||
'label' => $this->trans->trans('user.timezone.label'),
|
'label' => 'user.timezone.label',
|
||||||
'preferred_choices' => ['Europe/Berlin'],
|
'preferred_choices' => ['Europe/Berlin'],
|
||||||
])
|
])
|
||||||
->add('theme', ChoiceType::class, [
|
->add('theme', ChoiceType::class, [
|
||||||
|
@ -102,13 +98,13 @@ class UserSettingsType extends AbstractType
|
||||||
'choice_label' => function ($entity, $key, $value) {
|
'choice_label' => function ($entity, $key, $value) {
|
||||||
return $value;
|
return $value;
|
||||||
},
|
},
|
||||||
'placeholder' => $this->trans->trans('user_settings.theme.placeholder'),
|
'placeholder' => 'user_settings.theme.placeholder',
|
||||||
'label' => $this->trans->trans('user.theme.label'),
|
'label' => 'user.theme.label',
|
||||||
])
|
])
|
||||||
->add('currency', CurrencyEntityType::class, [
|
->add('currency', CurrencyEntityType::class, [
|
||||||
'disabled' => $this->demo_mode,
|
'disabled' => $this->demo_mode,
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => $this->trans->trans('user.currency.label'),
|
'label' => 'user.currency.label',
|
||||||
])
|
])
|
||||||
|
|
||||||
//Buttons
|
//Buttons
|
||||||
|
|
|
@ -52,7 +52,7 @@ class GitVersionInfo
|
||||||
/**
|
/**
|
||||||
* Get hash of the last git commit (on remote "origin"!).
|
* Get hash of the last git commit (on remote "origin"!).
|
||||||
*
|
*
|
||||||
* @note If this method does not work, try to make a "git pull" first!
|
* If this method does not work, try to make a "git pull" first!
|
||||||
*
|
*
|
||||||
* @param int $length if this is smaller than 40, only the first $length characters will be returned
|
* @param int $length if this is smaller than 40, only the first $length characters will be returned
|
||||||
*
|
*
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="toast-body {{ flash_bg }}">
|
<div class="toast-body {{ flash_bg }}">
|
||||||
{{ message}}
|
{{ message | trans}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -20,7 +20,6 @@
|
||||||
<note category="file-source" priority="1">src\Entity\PriceInformations\Currency.php:0</note>
|
<note category="file-source" priority="1">src\Entity\PriceInformations\Currency.php:0</note>
|
||||||
<note category="file-source" priority="1">src\Entity\UserSystem\Group.php:0</note>
|
<note category="file-source" priority="1">src\Entity\UserSystem\Group.php:0</note>
|
||||||
<note category="file-source" priority="1">src\Entity\UserSystem\User.php:0</note>
|
<note category="file-source" priority="1">src\Entity\UserSystem\User.php:0</note>
|
||||||
<note category="state" priority="1">new</note>
|
|
||||||
</notes>
|
</notes>
|
||||||
<segment>
|
<segment>
|
||||||
<source>part.master_attachment.must_be_picture</source>
|
<source>part.master_attachment.must_be_picture</source>
|
||||||
|
@ -62,7 +61,6 @@
|
||||||
<unit id="isXL.ie" name="validator.user.username_already_used">
|
<unit id="isXL.ie" name="validator.user.username_already_used">
|
||||||
<notes>
|
<notes>
|
||||||
<note category="file-source" priority="1">src\Entity\UserSystem\User.php:0</note>
|
<note category="file-source" priority="1">src\Entity\UserSystem\User.php:0</note>
|
||||||
<note category="state" priority="1">new</note>
|
|
||||||
</notes>
|
</notes>
|
||||||
<segment>
|
<segment>
|
||||||
<source>validator.user.username_already_used</source>
|
<source>validator.user.username_already_used</source>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue