mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Fixed code style.
This commit is contained in:
parent
2853e471c4
commit
d0b1024d80
212 changed files with 495 additions and 1005 deletions
|
@ -123,7 +123,7 @@ class CleanAttachmentsCommand extends Command
|
||||||
|
|
||||||
$continue = $io->confirm(sprintf('Found %d abandoned files. Do you want to delete them? This can not be undone!', count($file_list)), false);
|
$continue = $io->confirm(sprintf('Found %d abandoned files. Do you want to delete them? This can not be undone!', count($file_list)), false);
|
||||||
|
|
||||||
if (! $continue) {
|
if (!$continue) {
|
||||||
//We are finished here, when no files should be deleted
|
//We are finished here, when no files should be deleted
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,14 +154,14 @@ class ConvertBBCodeCommand extends Command
|
||||||
foreach ($results as $result) {
|
foreach ($results as $result) {
|
||||||
/** @var AbstractNamedDBElement $result */
|
/** @var AbstractNamedDBElement $result */
|
||||||
$io->writeln(
|
$io->writeln(
|
||||||
'Convert entity: '.$result->getName().' (' . get_class($result) . ': ' . $result->getID() . ')',
|
'Convert entity: '.$result->getName().' ('.get_class($result).': '.$result->getID().')',
|
||||||
OutputInterface::VERBOSITY_VERBOSE
|
OutputInterface::VERBOSITY_VERBOSE
|
||||||
);
|
);
|
||||||
foreach ($properties as $property) {
|
foreach ($properties as $property) {
|
||||||
//Retrieve bbcode from entity
|
//Retrieve bbcode from entity
|
||||||
$bbcode = $this->propertyAccessor->getValue($result, $property);
|
$bbcode = $this->propertyAccessor->getValue($result, $property);
|
||||||
//Check if the current property really contains BBCode
|
//Check if the current property really contains BBCode
|
||||||
if (! preg_match(static::BBCODE_REGEX, $bbcode)) {
|
if (!preg_match(static::BBCODE_REGEX, $bbcode)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$io->writeln(
|
$io->writeln(
|
||||||
|
@ -182,7 +182,7 @@ class ConvertBBCodeCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
//If we are not in dry run, save changes to DB
|
//If we are not in dry run, save changes to DB
|
||||||
if (! $input->getOption('dry-run')) {
|
if (!$input->getOption('dry-run')) {
|
||||||
$this->em->flush();
|
$this->em->flush();
|
||||||
$io->success('Changes saved to DB successfully!');
|
$io->success('Changes saved to DB successfully!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,14 +102,14 @@ class SetPasswordCommand extends Command
|
||||||
sprintf('You are going to change the password of %s with ID %d. Proceed?',
|
sprintf('You are going to change the password of %s with ID %d. Proceed?',
|
||||||
$user->getFullName(true), $user->getID()));
|
$user->getFullName(true), $user->getID()));
|
||||||
|
|
||||||
if (! $proceed) {
|
if (!$proceed) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$success = false;
|
$success = false;
|
||||||
$new_password = '';
|
$new_password = '';
|
||||||
|
|
||||||
while (! $success) {
|
while (!$success) {
|
||||||
$pw1 = $io->askHidden('Please enter new password:');
|
$pw1 = $io->askHidden('Please enter new password:');
|
||||||
$pw2 = $io->askHidden('Please confirm:');
|
$pw2 = $io->askHidden('Please confirm:');
|
||||||
if ($pw1 !== $pw2) {
|
if ($pw1 !== $pw2) {
|
||||||
|
|
|
@ -97,7 +97,7 @@ class UpdateExchangeRatesCommand extends Command
|
||||||
$iso_code = $input->getArgument('iso_code');
|
$iso_code = $input->getArgument('iso_code');
|
||||||
$repo = $this->em->getRepository(Currency::class);
|
$repo = $this->em->getRepository(Currency::class);
|
||||||
|
|
||||||
if (! empty($iso_code)) {
|
if (!empty($iso_code)) {
|
||||||
$candidates = $repo->findBy(['iso_code' => $iso_code]);
|
$candidates = $repo->findBy(['iso_code' => $iso_code]);
|
||||||
} else {
|
} else {
|
||||||
$candidates = $repo->findAll();
|
$candidates = $repo->findAll();
|
||||||
|
|
|
@ -70,8 +70,6 @@ class AttachmentTypeController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}", name="attachment_type_delete", methods={"DELETE"})
|
* @Route("/{id}", name="attachment_type_delete", methods={"DELETE"})
|
||||||
*
|
|
||||||
* @return RedirectResponse
|
|
||||||
*/
|
*/
|
||||||
public function delete(Request $request, AttachmentType $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
|
public function delete(Request $request, AttachmentType $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
|
||||||
{
|
{
|
||||||
|
@ -81,8 +79,6 @@ class AttachmentTypeController extends BaseAdminController
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="attachment_type_edit")
|
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="attachment_type_edit")
|
||||||
* @Route("/{id}", requirements={"id"="\d+"})
|
* @Route("/{id}", requirements={"id"="\d+"})
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function edit(AttachmentType $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
public function edit(AttachmentType $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
||||||
{
|
{
|
||||||
|
@ -93,8 +89,6 @@ class AttachmentTypeController extends BaseAdminController
|
||||||
* @Route("/new", name="attachment_type_new")
|
* @Route("/new", name="attachment_type_new")
|
||||||
* @Route("/{id}/clone", name="attachment_type_clone")
|
* @Route("/{id}/clone", name="attachment_type_clone")
|
||||||
* @Route("/")
|
* @Route("/")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?AttachmentType $entity = null): Response
|
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?AttachmentType $entity = null): Response
|
||||||
{
|
{
|
||||||
|
@ -103,8 +97,6 @@ class AttachmentTypeController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/export", name="attachment_type_export_all")
|
* @Route("/export", name="attachment_type_export_all")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
@ -113,8 +105,6 @@ class AttachmentTypeController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/export", name="attachment_type_export")
|
* @Route("/{id}/export", name="attachment_type_export")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response
|
public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
@ -126,9 +116,11 @@ class AttachmentTypeController extends BaseAdminController
|
||||||
if ($entity instanceof AttachmentType) {
|
if ($entity instanceof AttachmentType) {
|
||||||
if ($entity->getAttachmentsForType()->count() > 0) {
|
if ($entity->getAttachmentsForType()->count() > 0) {
|
||||||
$this->addFlash('error', 'entity.delete.must_not_contain_attachments');
|
$this->addFlash('error', 'entity.delete.must_not_contain_attachments');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,18 +43,13 @@ declare(strict_types=1);
|
||||||
namespace App\Controller\AdminPages;
|
namespace App\Controller\AdminPages;
|
||||||
|
|
||||||
use App\DataTables\LogDataTable;
|
use App\DataTables\LogDataTable;
|
||||||
use App\Entity\Attachments\AttachmentType;
|
|
||||||
use App\Entity\Base\AbstractDBElement;
|
use App\Entity\Base\AbstractDBElement;
|
||||||
use App\Entity\Base\AbstractNamedDBElement;
|
use App\Entity\Base\AbstractNamedDBElement;
|
||||||
use App\Entity\Base\AbstractPartsContainingDBElement;
|
use App\Entity\Base\AbstractPartsContainingDBElement;
|
||||||
use App\Entity\Base\AbstractStructuralDBElement;
|
use App\Entity\Base\AbstractStructuralDBElement;
|
||||||
use App\Entity\Base\PartsContainingRepositoryInterface;
|
use App\Entity\Base\PartsContainingRepositoryInterface;
|
||||||
use App\Entity\LabelSystem\LabelProfile;
|
use App\Entity\LabelSystem\LabelProfile;
|
||||||
use App\Entity\PriceInformations\Currency;
|
|
||||||
use App\Entity\UserSystem\Group;
|
|
||||||
use App\Entity\UserSystem\User;
|
use App\Entity\UserSystem\User;
|
||||||
use App\Events\SecurityEvent;
|
|
||||||
use App\Events\SecurityEvents;
|
|
||||||
use App\Exceptions\AttachmentDownloadException;
|
use App\Exceptions\AttachmentDownloadException;
|
||||||
use App\Form\AdminPages\ImportType;
|
use App\Form\AdminPages\ImportType;
|
||||||
use App\Form\AdminPages\MassCreationForm;
|
use App\Form\AdminPages\MassCreationForm;
|
||||||
|
@ -156,12 +151,14 @@ abstract class BaseAdminController extends AbstractController
|
||||||
|
|
||||||
return $timeTravel_timestamp;
|
return $timeTravel_timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform some additional actions, when the form was valid, but before the entity is saved.
|
* Perform some additional actions, when the form was valid, but before the entity is saved.
|
||||||
* @return bool Return true, to save entity normally, return false, to abort saving.
|
*
|
||||||
|
* @return bool return true, to save entity normally, return false, to abort saving
|
||||||
*/
|
*/
|
||||||
protected function additionalActionEdit(FormInterface $form, AbstractNamedDBElement $entity): bool
|
protected function additionalActionEdit(FormInterface $form, AbstractNamedDBElement $entity): bool
|
||||||
{
|
{
|
||||||
|
@ -174,7 +171,6 @@ abstract class BaseAdminController extends AbstractController
|
||||||
|
|
||||||
$timeTravel_timestamp = $this->revertElementIfNeeded($entity, $timestamp);
|
$timeTravel_timestamp = $this->revertElementIfNeeded($entity, $timestamp);
|
||||||
|
|
||||||
|
|
||||||
if ($this->isGranted('show_history', $entity)) {
|
if ($this->isGranted('show_history', $entity)) {
|
||||||
$table = $this->dataTableFactory->createFromType(
|
$table = $this->dataTableFactory->createFromType(
|
||||||
LogDataTable::class,
|
LogDataTable::class,
|
||||||
|
@ -203,7 +199,7 @@ abstract class BaseAdminController extends AbstractController
|
||||||
if (
|
if (
|
||||||
$entity instanceof LabelProfile
|
$entity instanceof LabelProfile
|
||||||
&& 'twig' === $entity->getOptions()->getLinesMode()
|
&& 'twig' === $entity->getOptions()->getLinesMode()
|
||||||
&& ! $this->isGranted('@labels.use_twig')
|
&& !$this->isGranted('@labels.use_twig')
|
||||||
) {
|
) {
|
||||||
$form_options['disable_options'] = true;
|
$form_options['disable_options'] = true;
|
||||||
}
|
}
|
||||||
|
@ -251,7 +247,7 @@ abstract class BaseAdminController extends AbstractController
|
||||||
'attachment_class' => $this->attachment_class,
|
'attachment_class' => $this->attachment_class,
|
||||||
'parameter_class' => $this->parameter_class,
|
'parameter_class' => $this->parameter_class,
|
||||||
]);
|
]);
|
||||||
} elseif ($form->isSubmitted() && ! $form->isValid()) {
|
} elseif ($form->isSubmitted() && !$form->isValid()) {
|
||||||
$this->addFlash('error', 'entity.edit_flash.invalid');
|
$this->addFlash('error', 'entity.edit_flash.invalid');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +260,6 @@ abstract class BaseAdminController extends AbstractController
|
||||||
/** @var AbstractPartsContainingRepository $repo */
|
/** @var AbstractPartsContainingRepository $repo */
|
||||||
$repo = $this->entityManager->getRepository($this->entity_class);
|
$repo = $this->entityManager->getRepository($this->entity_class);
|
||||||
|
|
||||||
|
|
||||||
return $this->render($this->twig_template, [
|
return $this->render($this->twig_template, [
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
'form' => $form->createView(),
|
'form' => $form->createView(),
|
||||||
|
@ -279,7 +274,8 @@ abstract class BaseAdminController extends AbstractController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform some additional actions, when the form was valid, but before the entity is saved.
|
* Perform some additional actions, when the form was valid, but before the entity is saved.
|
||||||
* @return bool Return true, to save entity normally, return false, to abort saving.
|
*
|
||||||
|
* @return bool return true, to save entity normally, return false, to abort saving
|
||||||
*/
|
*/
|
||||||
protected function additionalActionNew(FormInterface $form, AbstractNamedDBElement $entity): bool
|
protected function additionalActionNew(FormInterface $form, AbstractNamedDBElement $entity): bool
|
||||||
{
|
{
|
||||||
|
@ -308,7 +304,6 @@ abstract class BaseAdminController extends AbstractController
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
|
|
||||||
//Perform additional actions
|
//Perform additional actions
|
||||||
if ($this->additionalActionNew($form, $new_entity)) {
|
if ($this->additionalActionNew($form, $new_entity)) {
|
||||||
//Upload passed files
|
//Upload passed files
|
||||||
|
@ -346,7 +341,7 @@ abstract class BaseAdminController extends AbstractController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($form->isSubmitted() && ! $form->isValid()) {
|
if ($form->isSubmitted() && !$form->isValid()) {
|
||||||
$this->addFlash('error', 'entity.created_flash.invalid');
|
$this->addFlash('error', 'entity.created_flash.invalid');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,7 +394,6 @@ abstract class BaseAdminController extends AbstractController
|
||||||
$em->flush();
|
$em->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $this->render($this->twig_template, [
|
return $this->render($this->twig_template, [
|
||||||
'entity' => $new_entity,
|
'entity' => $new_entity,
|
||||||
'form' => $form->createView(),
|
'form' => $form->createView(),
|
||||||
|
@ -411,7 +405,9 @@ abstract class BaseAdminController extends AbstractController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs checks if the element can be deleted safely. Otherwise an flash message is added.
|
* Performs checks if the element can be deleted safely. Otherwise an flash message is added.
|
||||||
* @param AbstractNamedDBElement $entity The element that should be checked.
|
*
|
||||||
|
* @param AbstractNamedDBElement $entity the element that should be checked
|
||||||
|
*
|
||||||
* @return bool True if the the element can be deleted, false if not
|
* @return bool True if the the element can be deleted, false if not
|
||||||
*/
|
*/
|
||||||
protected function deleteCheck(AbstractNamedDBElement $entity): bool
|
protected function deleteCheck(AbstractNamedDBElement $entity): bool
|
||||||
|
@ -421,9 +417,11 @@ abstract class BaseAdminController extends AbstractController
|
||||||
$repo = $this->entityManager->getRepository($this->entity_class);
|
$repo = $this->entityManager->getRepository($this->entity_class);
|
||||||
if ($repo->getPartsCount($entity) > 0) {
|
if ($repo->getPartsCount($entity) > 0) {
|
||||||
$this->addFlash('error', 'entity.delete.must_not_contain_parts');
|
$this->addFlash('error', 'entity.delete.must_not_contain_parts');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,12 +472,14 @@ abstract class BaseAdminController extends AbstractController
|
||||||
$entity = new $this->entity_class();
|
$entity = new $this->entity_class();
|
||||||
$this->denyAccessUnlessGranted('read', $entity);
|
$this->denyAccessUnlessGranted('read', $entity);
|
||||||
$entities = $em->getRepository($this->entity_class)->findAll();
|
$entities = $em->getRepository($this->entity_class)->findAll();
|
||||||
|
|
||||||
return $exporter->exportEntityFromRequest($entities, $request);
|
return $exporter->exportEntityFromRequest($entities, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _exportEntity(AbstractNamedDBElement $entity, EntityExporter $exporter, Request $request): \Symfony\Component\HttpFoundation\Response
|
protected function _exportEntity(AbstractNamedDBElement $entity, EntityExporter $exporter, Request $request): \Symfony\Component\HttpFoundation\Response
|
||||||
{
|
{
|
||||||
$this->denyAccessUnlessGranted('read', $entity);
|
$this->denyAccessUnlessGranted('read', $entity);
|
||||||
|
|
||||||
return $exporter->exportEntityFromRequest($entity, $request);
|
return $exporter->exportEntityFromRequest($entity, $request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,8 +69,6 @@ class CategoryController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}", name="category_delete", methods={"DELETE"})
|
* @Route("/{id}", name="category_delete", methods={"DELETE"})
|
||||||
*
|
|
||||||
* @return RedirectResponse
|
|
||||||
*/
|
*/
|
||||||
public function delete(Request $request, Category $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
|
public function delete(Request $request, Category $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
|
||||||
{
|
{
|
||||||
|
@ -80,8 +78,6 @@ class CategoryController extends BaseAdminController
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="category_edit")
|
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="category_edit")
|
||||||
* @Route("/{id}", requirements={"id"="\d+"})
|
* @Route("/{id}", requirements={"id"="\d+"})
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function edit(Category $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
public function edit(Category $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
||||||
{
|
{
|
||||||
|
@ -92,8 +88,6 @@ class CategoryController extends BaseAdminController
|
||||||
* @Route("/new", name="category_new")
|
* @Route("/new", name="category_new")
|
||||||
* @Route("/{id}/clone", name="category_clone")
|
* @Route("/{id}/clone", name="category_clone")
|
||||||
* @Route("/")
|
* @Route("/")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Category $entity = null): Response
|
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Category $entity = null): Response
|
||||||
{
|
{
|
||||||
|
@ -102,8 +96,6 @@ class CategoryController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/export", name="category_export_all")
|
* @Route("/export", name="category_export_all")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
@ -112,8 +104,6 @@ class CategoryController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/export", name="category_export")
|
* @Route("/{id}/export", name="category_export")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportEntity(Category $entity, EntityExporter $exporter, Request $request): Response
|
public function exportEntity(Category $entity, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,7 +59,6 @@ use App\Services\LogSystem\TimeTravel;
|
||||||
use App\Services\StructuralElementRecursionHelper;
|
use App\Services\StructuralElementRecursionHelper;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Exchanger\Exception\ChainException;
|
use Exchanger\Exception\ChainException;
|
||||||
use Exchanger\Exception\Exception;
|
|
||||||
use Exchanger\Exception\UnsupportedCurrencyPairException;
|
use Exchanger\Exception\UnsupportedCurrencyPairException;
|
||||||
use Omines\DataTablesBundle\DataTableFactory;
|
use Omines\DataTablesBundle\DataTableFactory;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||||
|
@ -100,7 +99,6 @@ class CurrencyController extends BaseAdminController
|
||||||
LabelGenerator $labelGenerator,
|
LabelGenerator $labelGenerator,
|
||||||
EntityManagerInterface $entityManager,
|
EntityManagerInterface $entityManager,
|
||||||
ExchangeRateUpdater $exchangeRateUpdater
|
ExchangeRateUpdater $exchangeRateUpdater
|
||||||
|
|
||||||
) {
|
) {
|
||||||
$this->exchangeRateUpdater = $exchangeRateUpdater;
|
$this->exchangeRateUpdater = $exchangeRateUpdater;
|
||||||
|
|
||||||
|
@ -121,8 +119,6 @@ class CurrencyController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}", name="currency_delete", methods={"DELETE"})
|
* @Route("/{id}", name="currency_delete", methods={"DELETE"})
|
||||||
*
|
|
||||||
* @return RedirectResponse
|
|
||||||
*/
|
*/
|
||||||
public function delete(Request $request, Currency $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
|
public function delete(Request $request, Currency $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
|
||||||
{
|
{
|
||||||
|
@ -143,7 +139,7 @@ class CurrencyController extends BaseAdminController
|
||||||
$this->addFlash('info', 'currency.edit.exchange_rate_updated.success');
|
$this->addFlash('info', 'currency.edit.exchange_rate_updated.success');
|
||||||
} catch (ChainException $exception) {
|
} catch (ChainException $exception) {
|
||||||
$exception = $exception->getExceptions()[0];
|
$exception = $exception->getExceptions()[0];
|
||||||
if ($exception instanceof UnsupportedCurrencyPairException || stripos($exception->getMessage(), "supported") !== false) {
|
if ($exception instanceof UnsupportedCurrencyPairException || false !== stripos($exception->getMessage(), 'supported')) {
|
||||||
$this->addFlash('error', 'currency.edit.exchange_rate_update.unsupported_currency');
|
$this->addFlash('error', 'currency.edit.exchange_rate_update.unsupported_currency');
|
||||||
} else {
|
} else {
|
||||||
$this->addFlash('error', 'currency.edit.exchange_rate_update.generic_error');
|
$this->addFlash('error', 'currency.edit.exchange_rate_update.generic_error');
|
||||||
|
@ -157,8 +153,6 @@ class CurrencyController extends BaseAdminController
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="currency_edit")
|
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="currency_edit")
|
||||||
* @Route("/{id}", requirements={"id"="\d+"})
|
* @Route("/{id}", requirements={"id"="\d+"})
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function edit(Currency $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
public function edit(Currency $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
||||||
{
|
{
|
||||||
|
@ -169,8 +163,6 @@ class CurrencyController extends BaseAdminController
|
||||||
* @Route("/new", name="currency_new")
|
* @Route("/new", name="currency_new")
|
||||||
* @Route("/{id}/clone", name="currency_clone")
|
* @Route("/{id}/clone", name="currency_clone")
|
||||||
* @Route("/")
|
* @Route("/")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Currency $entity = null): Response
|
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Currency $entity = null): Response
|
||||||
{
|
{
|
||||||
|
@ -179,8 +171,6 @@ class CurrencyController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/export", name="currency_export_all")
|
* @Route("/export", name="currency_export_all")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
@ -189,8 +179,6 @@ class CurrencyController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/export", name="currency_export")
|
* @Route("/{id}/export", name="currency_export")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportEntity(Currency $entity, EntityExporter $exporter, Request $request): Response
|
public function exportEntity(Currency $entity, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
@ -202,6 +190,7 @@ class CurrencyController extends BaseAdminController
|
||||||
if ($entity instanceof Currency) {
|
if ($entity instanceof Currency) {
|
||||||
if ($entity->getPricedetails()->count() > 0) {
|
if ($entity->getPricedetails()->count() > 0) {
|
||||||
$this->addFlash('error', 'entity.delete.must_not_contain_prices');
|
$this->addFlash('error', 'entity.delete.must_not_contain_prices');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,8 +69,6 @@ class DeviceController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}", name="device_delete", methods={"DELETE"})
|
* @Route("/{id}", name="device_delete", methods={"DELETE"})
|
||||||
*
|
|
||||||
* @return RedirectResponse
|
|
||||||
*/
|
*/
|
||||||
public function delete(Request $request, Device $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
|
public function delete(Request $request, Device $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
|
||||||
{
|
{
|
||||||
|
@ -80,8 +78,6 @@ class DeviceController extends BaseAdminController
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="device_edit")
|
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="device_edit")
|
||||||
* @Route("/{id}", requirements={"id"="\d+"})
|
* @Route("/{id}", requirements={"id"="\d+"})
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function edit(Device $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
public function edit(Device $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
||||||
{
|
{
|
||||||
|
@ -92,8 +88,6 @@ class DeviceController extends BaseAdminController
|
||||||
* @Route("/new", name="device_new")
|
* @Route("/new", name="device_new")
|
||||||
* @Route("/{id}/clone", name="device_clone")
|
* @Route("/{id}/clone", name="device_clone")
|
||||||
* @Route("/")
|
* @Route("/")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Device $entity = null): Response
|
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Device $entity = null): Response
|
||||||
{
|
{
|
||||||
|
@ -102,8 +96,6 @@ class DeviceController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/export", name="device_export_all")
|
* @Route("/export", name="device_export_all")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
@ -112,8 +104,6 @@ class DeviceController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/export", name="device_export")
|
* @Route("/{id}/export", name="device_export")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportEntity(Device $entity, EntityExporter $exporter, Request $request): Response
|
public function exportEntity(Device $entity, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,8 +69,6 @@ class FootprintController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}", name="footprint_delete", methods={"DELETE"})
|
* @Route("/{id}", name="footprint_delete", methods={"DELETE"})
|
||||||
*
|
|
||||||
* @return \Symfony\Component\HttpFoundation\RedirectResponse
|
|
||||||
*/
|
*/
|
||||||
public function delete(Request $request, Footprint $entity, StructuralElementRecursionHelper $recursionHelper): \Symfony\Component\HttpFoundation\RedirectResponse
|
public function delete(Request $request, Footprint $entity, StructuralElementRecursionHelper $recursionHelper): \Symfony\Component\HttpFoundation\RedirectResponse
|
||||||
{
|
{
|
||||||
|
@ -80,8 +78,6 @@ class FootprintController extends BaseAdminController
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="footprint_edit")
|
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="footprint_edit")
|
||||||
* @Route("/{id}", requirements={"id"="\d+"})
|
* @Route("/{id}", requirements={"id"="\d+"})
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function edit(Footprint $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
public function edit(Footprint $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
||||||
{
|
{
|
||||||
|
@ -92,8 +88,6 @@ class FootprintController extends BaseAdminController
|
||||||
* @Route("/new", name="footprint_new")
|
* @Route("/new", name="footprint_new")
|
||||||
* @Route("/{id}/clone", name="footprint_clone")
|
* @Route("/{id}/clone", name="footprint_clone")
|
||||||
* @Route("/")
|
* @Route("/")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Footprint $entity = null): Response
|
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Footprint $entity = null): Response
|
||||||
{
|
{
|
||||||
|
@ -102,8 +96,6 @@ class FootprintController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/export", name="footprint_export_all")
|
* @Route("/export", name="footprint_export_all")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
@ -112,8 +104,6 @@ class FootprintController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/export", name="footprint_export")
|
* @Route("/{id}/export", name="footprint_export")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response
|
public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,8 +69,6 @@ class LabelProfileController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}", name="label_profile_delete", methods={"DELETE"})
|
* @Route("/{id}", name="label_profile_delete", methods={"DELETE"})
|
||||||
*
|
|
||||||
* @return RedirectResponse
|
|
||||||
*/
|
*/
|
||||||
public function delete(Request $request, LabelProfile $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
|
public function delete(Request $request, LabelProfile $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
|
||||||
{
|
{
|
||||||
|
@ -80,8 +78,6 @@ class LabelProfileController extends BaseAdminController
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="label_profile_edit")
|
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="label_profile_edit")
|
||||||
* @Route("/{id}", requirements={"id"="\d+"})
|
* @Route("/{id}", requirements={"id"="\d+"})
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function edit(LabelProfile $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
public function edit(LabelProfile $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
||||||
{
|
{
|
||||||
|
@ -92,8 +88,6 @@ class LabelProfileController extends BaseAdminController
|
||||||
* @Route("/new", name="label_profile_new")
|
* @Route("/new", name="label_profile_new")
|
||||||
* @Route("/{id}/clone", name="label_profile_clone")
|
* @Route("/{id}/clone", name="label_profile_clone")
|
||||||
* @Route("/")
|
* @Route("/")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?AttachmentType $entity = null): Response
|
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?AttachmentType $entity = null): Response
|
||||||
{
|
{
|
||||||
|
@ -102,8 +96,6 @@ class LabelProfileController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/export", name="label_profile_export_all")
|
* @Route("/export", name="label_profile_export_all")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
@ -112,8 +104,6 @@ class LabelProfileController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/export", name="label_profile_export")
|
* @Route("/{id}/export", name="label_profile_export")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportEntity(LabelProfile $entity, EntityExporter $exporter, Request $request): Response
|
public function exportEntity(LabelProfile $entity, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
|
|
@ -91,8 +91,6 @@ class ManufacturerController extends BaseAdminController
|
||||||
* @Route("/new", name="manufacturer_new")
|
* @Route("/new", name="manufacturer_new")
|
||||||
* @Route("/{id}/clone", name="manufacturer_clone")
|
* @Route("/{id}/clone", name="manufacturer_clone")
|
||||||
* @Route("/")
|
* @Route("/")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Manufacturer $entity = null): Response
|
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Manufacturer $entity = null): Response
|
||||||
{
|
{
|
||||||
|
@ -101,8 +99,6 @@ class ManufacturerController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/export", name="manufacturer_export_all")
|
* @Route("/export", name="manufacturer_export_all")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
@ -111,8 +107,6 @@ class ManufacturerController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/export", name="manufacturer_export")
|
* @Route("/{id}/export", name="manufacturer_export")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportEntity(Manufacturer $entity, EntityExporter $exporter, Request $request): Response
|
public function exportEntity(Manufacturer $entity, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
|
|
@ -92,8 +92,6 @@ class MeasurementUnitController extends BaseAdminController
|
||||||
* @Route("/new", name="measurement_unit_new")
|
* @Route("/new", name="measurement_unit_new")
|
||||||
* @Route("/{id}/clone", name="measurement_unit_clone")
|
* @Route("/{id}/clone", name="measurement_unit_clone")
|
||||||
* @Route("/")
|
* @Route("/")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?MeasurementUnit $entity = null): Response
|
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?MeasurementUnit $entity = null): Response
|
||||||
{
|
{
|
||||||
|
@ -102,8 +100,6 @@ class MeasurementUnitController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/export", name="measurement_unit_export_all")
|
* @Route("/export", name="measurement_unit_export_all")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
@ -112,8 +108,6 @@ class MeasurementUnitController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/export", name="measurement_unit_export")
|
* @Route("/{id}/export", name="measurement_unit_export")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response
|
public function exportEntity(AttachmentType $entity, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
|
|
@ -90,8 +90,6 @@ class StorelocationController extends BaseAdminController
|
||||||
* @Route("/new", name="store_location_new")
|
* @Route("/new", name="store_location_new")
|
||||||
* @Route("/{id}/clone", name="store_location_clone")
|
* @Route("/{id}/clone", name="store_location_clone")
|
||||||
* @Route("/")
|
* @Route("/")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Storelocation $entity = null): Response
|
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Storelocation $entity = null): Response
|
||||||
{
|
{
|
||||||
|
@ -100,8 +98,6 @@ class StorelocationController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/export", name="store_location_export_all")
|
* @Route("/export", name="store_location_export_all")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
@ -110,8 +106,6 @@ class StorelocationController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/export", name="store_location_export")
|
* @Route("/{id}/export", name="store_location_export")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportEntity(Storelocation $entity, EntityExporter $exporter, Request $request): Response
|
public function exportEntity(Storelocation $entity, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
|
|
@ -91,8 +91,6 @@ class SupplierController extends BaseAdminController
|
||||||
* @Route("/new", name="supplier_new")
|
* @Route("/new", name="supplier_new")
|
||||||
* @Route("/{id}/clone", name="supplier_clone")
|
* @Route("/{id}/clone", name="supplier_clone")
|
||||||
* @Route("/")
|
* @Route("/")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Supplier $entity = null): Response
|
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Supplier $entity = null): Response
|
||||||
{
|
{
|
||||||
|
@ -101,8 +99,6 @@ class SupplierController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/export", name="supplier_export_all")
|
* @Route("/export", name="supplier_export_all")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
@ -111,8 +107,6 @@ class SupplierController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/export", name="supplier_export")
|
* @Route("/{id}/export", name="supplier_export")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportEntity(Supplier $entity, EntityExporter $exporter, Request $request): Response
|
public function exportEntity(Supplier $entity, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,8 +62,6 @@ class AttachmentFileController extends AbstractController
|
||||||
* Download the selected attachment.
|
* Download the selected attachment.
|
||||||
*
|
*
|
||||||
* @Route("/attachment/{id}/download", name="attachment_download")
|
* @Route("/attachment/{id}/download", name="attachment_download")
|
||||||
*
|
|
||||||
* @return BinaryFileResponse
|
|
||||||
*/
|
*/
|
||||||
public function download(Attachment $attachment, AttachmentManager $helper): BinaryFileResponse
|
public function download(Attachment $attachment, AttachmentManager $helper): BinaryFileResponse
|
||||||
{
|
{
|
||||||
|
@ -77,7 +75,7 @@ class AttachmentFileController extends AbstractController
|
||||||
throw new RuntimeException('You can not download external attachments!');
|
throw new RuntimeException('You can not download external attachments!');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $helper->isFileExisting($attachment)) {
|
if (!$helper->isFileExisting($attachment)) {
|
||||||
throw new RuntimeException('The file associated with the attachment is not existing!');
|
throw new RuntimeException('The file associated with the attachment is not existing!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,8 +92,6 @@ class AttachmentFileController extends AbstractController
|
||||||
* View the attachment.
|
* View the attachment.
|
||||||
*
|
*
|
||||||
* @Route("/attachment/{id}/view", name="attachment_view")
|
* @Route("/attachment/{id}/view", name="attachment_view")
|
||||||
*
|
|
||||||
* @return BinaryFileResponse
|
|
||||||
*/
|
*/
|
||||||
public function view(Attachment $attachment, AttachmentManager $helper): BinaryFileResponse
|
public function view(Attachment $attachment, AttachmentManager $helper): BinaryFileResponse
|
||||||
{
|
{
|
||||||
|
@ -109,7 +105,7 @@ class AttachmentFileController extends AbstractController
|
||||||
throw new RuntimeException('You can not download external attachments!');
|
throw new RuntimeException('You can not download external attachments!');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $helper->isFileExisting($attachment)) {
|
if (!$helper->isFileExisting($attachment)) {
|
||||||
throw new RuntimeException('The file associated with the attachment is not existing!');
|
throw new RuntimeException('The file associated with the attachment is not existing!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,8 +72,6 @@ class GroupController extends BaseAdminController
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="group_edit")
|
* @Route("/{id}/edit/{timestamp}", requirements={"id"="\d+"}, name="group_edit")
|
||||||
* @Route("/{id}/", requirements={"id"="\d+"})
|
* @Route("/{id}/", requirements={"id"="\d+"})
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function edit(Group $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
public function edit(Group $entity, Request $request, EntityManagerInterface $em, ?string $timestamp = null): Response
|
||||||
{
|
{
|
||||||
|
@ -84,8 +82,6 @@ class GroupController extends BaseAdminController
|
||||||
* @Route("/new", name="group_new")
|
* @Route("/new", name="group_new")
|
||||||
* @Route("/{id}/clone", name="group_clone")
|
* @Route("/{id}/clone", name="group_clone")
|
||||||
* @Route("/")
|
* @Route("/")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Group $entity = null): Response
|
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?Group $entity = null): Response
|
||||||
{
|
{
|
||||||
|
@ -94,8 +90,6 @@ class GroupController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}", name="group_delete", methods={"DELETE"})
|
* @Route("/{id}", name="group_delete", methods={"DELETE"})
|
||||||
*
|
|
||||||
* @return RedirectResponse
|
|
||||||
*/
|
*/
|
||||||
public function delete(Request $request, Group $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
|
public function delete(Request $request, Group $entity, StructuralElementRecursionHelper $recursionHelper): RedirectResponse
|
||||||
{
|
{
|
||||||
|
@ -104,8 +98,6 @@ class GroupController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/export", name="group_export_all")
|
* @Route("/export", name="group_export_all")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
@ -114,8 +106,6 @@ class GroupController extends BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/export", name="group_export")
|
* @Route("/{id}/export", name="group_export")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportEntity(Group $entity, EntityExporter $exporter, Request $request): Response
|
public function exportEntity(Group $entity, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
@ -127,6 +117,7 @@ class GroupController extends BaseAdminController
|
||||||
if ($entity instanceof Group) {
|
if ($entity instanceof Group) {
|
||||||
if ($entity->getUsers()->count() > 0) {
|
if ($entity->getUsers()->count() > 0) {
|
||||||
$this->addFlash('error', 'entity.delete.must_not_contain_users');
|
$this->addFlash('error', 'entity.delete.must_not_contain_users');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,8 +81,6 @@ class HomepageController extends AbstractController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/", name="homepage")
|
* @Route("/", name="homepage")
|
||||||
*
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
*/
|
||||||
public function homepage(Request $request, GitVersionInfo $versionInfo): Response
|
public function homepage(Request $request, GitVersionInfo $versionInfo): Response
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,7 +81,7 @@ class LabelController extends AbstractController
|
||||||
}
|
}
|
||||||
|
|
||||||
//We have to disable the options, if twig mode is selected and user is not allowed to use it.
|
//We have to disable the options, if twig mode is selected and user is not allowed to use it.
|
||||||
$disable_options = 'twig' === $label_options->getLinesMode() && ! $this->isGranted('@labels.use_twig');
|
$disable_options = 'twig' === $label_options->getLinesMode() && !$this->isGranted('@labels.use_twig');
|
||||||
|
|
||||||
$form = $this->createForm(LabelDialogType::class, null, [
|
$form = $this->createForm(LabelDialogType::class, null, [
|
||||||
'disable_options' => $disable_options,
|
'disable_options' => $disable_options,
|
||||||
|
@ -109,10 +109,10 @@ class LabelController extends AbstractController
|
||||||
$filename = 'invalid.pdf';
|
$filename = 'invalid.pdf';
|
||||||
|
|
||||||
//Generate PDF either when the form is submitted and valid, or the form was not submit yet, and generate is set
|
//Generate PDF either when the form is submitted and valid, or the form was not submit yet, and generate is set
|
||||||
if (($form->isSubmitted() && $form->isValid()) || ($generate && ! $form->isSubmitted() && null !== $profile)) {
|
if (($form->isSubmitted() && $form->isValid()) || ($generate && !$form->isSubmitted() && null !== $profile)) {
|
||||||
$target_id = (string) $form->get('target_id')->getData();
|
$target_id = (string) $form->get('target_id')->getData();
|
||||||
$targets = $this->findObjects($form_options->getSupportedElement(), $target_id);
|
$targets = $this->findObjects($form_options->getSupportedElement(), $target_id);
|
||||||
if (! empty($targets)) {
|
if (!empty($targets)) {
|
||||||
try {
|
try {
|
||||||
$pdf_data = $this->labelGenerator->generateLabel($form_options, $targets);
|
$pdf_data = $this->labelGenerator->generateLabel($form_options, $targets);
|
||||||
$filename = $this->getLabelName($targets[0], $profile);
|
$filename = $this->getLabelName($targets[0], $profile);
|
||||||
|
@ -145,7 +145,7 @@ class LabelController extends AbstractController
|
||||||
|
|
||||||
protected function findObjects(string $type, string $ids): array
|
protected function findObjects(string $type, string $ids): array
|
||||||
{
|
{
|
||||||
if (! isset(LabelGenerator::CLASS_SUPPORT_MAPPING[$type])) {
|
if (!isset(LabelGenerator::CLASS_SUPPORT_MAPPING[$type])) {
|
||||||
throw new \InvalidArgumentException('The given type is not known and can not be mapped to a class!');
|
throw new \InvalidArgumentException('The given type is not known and can not be mapped to a class!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,7 @@ class LogController extends AbstractController
|
||||||
$this->dbRepository->changeID($element, $logEntry->getTargetID());
|
$this->dbRepository->changeID($element, $logEntry->getTargetID());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $element instanceof AbstractDBElement) {
|
if (!$element instanceof AbstractDBElement) {
|
||||||
$this->addFlash('error', 'log.undo.target_not_found');
|
$this->addFlash('error', 'log.undo.target_not_found');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -91,8 +91,6 @@ class PartController extends AbstractController
|
||||||
* @Route("/{id}/info/{timestamp}", name="part_info")
|
* @Route("/{id}/info/{timestamp}", name="part_info")
|
||||||
* @Route("/{id}", requirements={"id"="\d+"})
|
* @Route("/{id}", requirements={"id"="\d+"})
|
||||||
*
|
*
|
||||||
* @return Response
|
|
||||||
*
|
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
public function show(Part $part, Request $request, TimeTravel $timeTravel, HistoryHelper $historyHelper,
|
public function show(Part $part, Request $request, TimeTravel $timeTravel, HistoryHelper $historyHelper,
|
||||||
|
@ -144,8 +142,6 @@ class PartController extends AbstractController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/edit", name="part_edit")
|
* @Route("/{id}/edit", name="part_edit")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function edit(Part $part, Request $request, EntityManagerInterface $em, TranslatorInterface $translator,
|
public function edit(Part $part, Request $request, EntityManagerInterface $em, TranslatorInterface $translator,
|
||||||
AttachmentSubmitHandler $attachmentSubmitHandler): Response
|
AttachmentSubmitHandler $attachmentSubmitHandler): Response
|
||||||
|
@ -183,13 +179,13 @@ class PartController extends AbstractController
|
||||||
|
|
||||||
//Redirect to clone page if user wished that...
|
//Redirect to clone page if user wished that...
|
||||||
//@phpstan-ignore-next-line
|
//@phpstan-ignore-next-line
|
||||||
if ("save_and_clone" === $form->getClickedButton()->getName()) {
|
if ('save_and_clone' === $form->getClickedButton()->getName()) {
|
||||||
return $this->redirectToRoute('part_clone', ['id' => $part->getID()]);
|
return $this->redirectToRoute('part_clone', ['id' => $part->getID()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//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', 'part.edited_flash.invalid');
|
$this->addFlash('error', 'part.edited_flash.invalid');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,8 +198,6 @@ class PartController extends AbstractController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/delete", name="part_delete", methods={"DELETE"})
|
* @Route("/{id}/delete", name="part_delete", methods={"DELETE"})
|
||||||
*
|
|
||||||
* @return RedirectResponse
|
|
||||||
*/
|
*/
|
||||||
public function delete(Request $request, Part $part): RedirectResponse
|
public function delete(Request $request, Part $part): RedirectResponse
|
||||||
{
|
{
|
||||||
|
@ -229,8 +223,6 @@ class PartController extends AbstractController
|
||||||
/**
|
/**
|
||||||
* @Route("/new", name="part_new")
|
* @Route("/new", name="part_new")
|
||||||
* @Route("/{id}/clone", name="part_clone")
|
* @Route("/{id}/clone", name="part_clone")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function new(Request $request, EntityManagerInterface $em, TranslatorInterface $translator,
|
public function new(Request $request, EntityManagerInterface $em, TranslatorInterface $translator,
|
||||||
AttachmentSubmitHandler $attachmentSubmitHandler, ?Part $part = null): Response
|
AttachmentSubmitHandler $attachmentSubmitHandler, ?Part $part = null): Response
|
||||||
|
@ -310,14 +302,14 @@ class PartController extends AbstractController
|
||||||
|
|
||||||
//Redirect to clone page if user wished that...
|
//Redirect to clone page if user wished that...
|
||||||
//@phpstan-ignore-next-line
|
//@phpstan-ignore-next-line
|
||||||
if ("save_and_clone" === $form->getClickedButton()->getName()) {
|
if ('save_and_clone' === $form->getClickedButton()->getName()) {
|
||||||
return $this->redirectToRoute('part_clone', ['id' => $new_part->getID()]);
|
return $this->redirectToRoute('part_clone', ['id' => $new_part->getID()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
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', 'part.created_flash.invalid');
|
$this->addFlash('error', 'part.created_flash.invalid');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,10 +78,11 @@ class PartListsController extends AbstractController
|
||||||
|
|
||||||
if (!$this->isCsrfTokenValid('table_action', $request->request->get('_token'))) {
|
if (!$this->isCsrfTokenValid('table_action', $request->request->get('_token'))) {
|
||||||
$this->addFlash('error', 'csfr_invalid');
|
$this->addFlash('error', 'csfr_invalid');
|
||||||
|
|
||||||
return $this->redirect($redirect);
|
return $this->redirect($redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action === null || $ids === null) {
|
if (null === $action || null === $ids) {
|
||||||
$this->addFlash('error', 'part.table.actions.no_params_given');
|
$this->addFlash('error', 'part.table.actions.no_params_given');
|
||||||
} else {
|
} else {
|
||||||
$parts = $actionHandler->idStringToArray($ids);
|
$parts = $actionHandler->idStringToArray($ids);
|
||||||
|
@ -93,7 +94,6 @@ class PartListsController extends AbstractController
|
||||||
$this->addFlash('success', 'part.table.actions.success');
|
$this->addFlash('success', 'part.table.actions.success');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return $this->redirect($redirect);
|
return $this->redirect($redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,8 +69,6 @@ class RedirectController extends AbstractController
|
||||||
/**
|
/**
|
||||||
* This function is called whenever a route was not matching the localized routes.
|
* This function is called whenever a route was not matching the localized routes.
|
||||||
* The purpose is to redirect the user to the localized version of the page.
|
* The purpose is to redirect the user to the localized version of the page.
|
||||||
*
|
|
||||||
* @return RedirectResponse
|
|
||||||
*/
|
*/
|
||||||
public function addLocalePart(Request $request): RedirectResponse
|
public function addLocalePart(Request $request): RedirectResponse
|
||||||
{
|
{
|
||||||
|
@ -79,7 +77,7 @@ class RedirectController extends AbstractController
|
||||||
|
|
||||||
//Check if a user has set a preferred language setting:
|
//Check if a user has set a preferred language setting:
|
||||||
$user = $this->getUser();
|
$user = $this->getUser();
|
||||||
if (($user instanceof User) && ! empty($user->getLanguage())) {
|
if (($user instanceof User) && !empty($user->getLanguage())) {
|
||||||
$locale = $user->getLanguage();
|
$locale = $user->getLanguage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +85,7 @@ class RedirectController extends AbstractController
|
||||||
$new_url = $request->getUriForPath('/'.$locale.$request->getPathInfo());
|
$new_url = $request->getUriForPath('/'.$locale.$request->getPathInfo());
|
||||||
|
|
||||||
//If either mod_rewrite is not enabled or the index.php version is enforced, add index.php to the string
|
//If either mod_rewrite is not enabled or the index.php version is enforced, add index.php to the string
|
||||||
if (($this->enforce_index_php || ! $this->checkIfModRewriteAvailable())
|
if (($this->enforce_index_php || !$this->checkIfModRewriteAvailable())
|
||||||
&& false === strpos($new_url, 'index.php')) {
|
&& false === strpos($new_url, 'index.php')) {
|
||||||
//Like Request::getUriForPath only with index.php
|
//Like Request::getUriForPath only with index.php
|
||||||
$new_url = $request->getSchemeAndHttpHost().$request->getBaseUrl().'/index.php/'.$locale.$request->getPathInfo();
|
$new_url = $request->getSchemeAndHttpHost().$request->getBaseUrl().'/index.php/'.$locale.$request->getPathInfo();
|
||||||
|
@ -100,12 +98,10 @@ class RedirectController extends AbstractController
|
||||||
* Check if mod_rewrite is available (URL rewriting is possible).
|
* Check if mod_rewrite is available (URL rewriting is possible).
|
||||||
* If this is true, we can redirect to /en, otherwise we have to redirect to index.php/en.
|
* If this is true, we can redirect to /en, otherwise we have to redirect to index.php/en.
|
||||||
* When the PHP is not used via Apache SAPI, we just assume that URL rewriting is available.
|
* When the PHP is not used via Apache SAPI, we just assume that URL rewriting is available.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function checkIfModRewriteAvailable(): bool
|
public function checkIfModRewriteAvailable(): bool
|
||||||
{
|
{
|
||||||
if (! function_exists('apache_get_modules')) {
|
if (!function_exists('apache_get_modules')) {
|
||||||
//If we can not check for apache modules, we just hope for the best and assume url rewriting is available
|
//If we can not check for apache modules, we just hope for the best and assume url rewriting is available
|
||||||
//If you want to enforce index.php versions of the url, you can override this via ENV vars.
|
//If you want to enforce index.php versions of the url, you can override this via ENV vars.
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -77,8 +77,6 @@ class SecurityController extends AbstractController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/login", name="login", methods={"GET", "POST"})
|
* @Route("/login", name="login", methods={"GET", "POST"})
|
||||||
*
|
|
||||||
* @return \Symfony\Component\HttpFoundation\Response
|
|
||||||
*/
|
*/
|
||||||
public function login(AuthenticationUtils $authenticationUtils): \Symfony\Component\HttpFoundation\Response
|
public function login(AuthenticationUtils $authenticationUtils): \Symfony\Component\HttpFoundation\Response
|
||||||
{
|
{
|
||||||
|
@ -101,7 +99,7 @@ class SecurityController extends AbstractController
|
||||||
*/
|
*/
|
||||||
public function requestPwReset(PasswordResetManager $passwordReset, Request $request)
|
public function requestPwReset(PasswordResetManager $passwordReset, Request $request)
|
||||||
{
|
{
|
||||||
if (! $this->allow_email_pw_reset) {
|
if (!$this->allow_email_pw_reset) {
|
||||||
throw new AccessDeniedHttpException('The password reset via email is disabled!');
|
throw new AccessDeniedHttpException('The password reset via email is disabled!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +143,7 @@ class SecurityController extends AbstractController
|
||||||
*/
|
*/
|
||||||
public function pwResetNewPw(PasswordResetManager $passwordReset, Request $request, EntityManagerInterface $em, EventDispatcherInterface $eventDispatcher, ?string $user = null, ?string $token = null)
|
public function pwResetNewPw(PasswordResetManager $passwordReset, Request $request, EntityManagerInterface $em, EventDispatcherInterface $eventDispatcher, ?string $user = null, ?string $token = null)
|
||||||
{
|
{
|
||||||
if (! $this->allow_email_pw_reset) {
|
if (!$this->allow_email_pw_reset) {
|
||||||
throw new AccessDeniedHttpException('The password reset via email is disabled!');
|
throw new AccessDeniedHttpException('The password reset via email is disabled!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,7 +188,7 @@ class SecurityController extends AbstractController
|
||||||
$data = $form->getData();
|
$data = $form->getData();
|
||||||
//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', 'pw_reset.new_pw.error');
|
$this->addFlash('error', 'pw_reset.new_pw.error');
|
||||||
} else {
|
} else {
|
||||||
$this->addFlash('success', 'pw_reset.new_pw.success');
|
$this->addFlash('success', 'pw_reset.new_pw.success');
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
|
|
||||||
use App\Entity\Base\AbstractStructuralDBElement;
|
use App\Entity\Base\AbstractStructuralDBElement;
|
||||||
use App\Entity\Parts\Category;
|
use App\Entity\Parts\Category;
|
||||||
use App\Entity\Parts\Footprint;
|
use App\Entity\Parts\Footprint;
|
||||||
|
@ -29,13 +28,11 @@ use App\Entity\Parts\MeasurementUnit;
|
||||||
use App\Services\Trees\NodesListBuilder;
|
use App\Services\Trees\NodesListBuilder;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\Event\ResponseEvent;
|
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/select_api")
|
* @Route("/select_api")
|
||||||
* @package App\Controller
|
|
||||||
*/
|
*/
|
||||||
class SelectAPIController extends AbstractController
|
class SelectAPIController extends AbstractController
|
||||||
{
|
{
|
||||||
|
@ -82,7 +79,7 @@ class SelectAPIController extends AbstractController
|
||||||
|
|
||||||
protected function getResponseForClass(string $class, bool $include_empty = false): Response
|
protected function getResponseForClass(string $class, bool $include_empty = false): Response
|
||||||
{
|
{
|
||||||
$test_obj = new $class;
|
$test_obj = new $class();
|
||||||
$this->denyAccessUnlessGranted('read', $test_obj);
|
$this->denyAccessUnlessGranted('read', $test_obj);
|
||||||
|
|
||||||
$nodes = $this->nodesListBuilder->typeToNodesList($class);
|
$nodes = $this->nodesListBuilder->typeToNodesList($class);
|
||||||
|
@ -107,14 +104,14 @@ class SelectAPIController extends AbstractController
|
||||||
foreach ($nodes_list as $node) {
|
foreach ($nodes_list as $node) {
|
||||||
/** @var AbstractStructuralDBElement $node */
|
/** @var AbstractStructuralDBElement $node */
|
||||||
$entry = [
|
$entry = [
|
||||||
'text' => str_repeat(' ', $node->getLevel()) . htmlspecialchars($node->getName()),
|
'text' => str_repeat(' ', $node->getLevel()).htmlspecialchars($node->getName()),
|
||||||
'value' => $node->getID(),
|
'value' => $node->getID(),
|
||||||
'data-subtext' => $node->getParent() ? $node->getParent()->getFullPath() : null,
|
'data-subtext' => $node->getParent() ? $node->getParent()->getFullPath() : null,
|
||||||
];
|
];
|
||||||
|
|
||||||
$entries[] = $entry;
|
$entries[] = $entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $entries;
|
return $entries;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,6 @@ class StatisticsController extends AbstractController
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @Route("/statistics", name="statistics_view")
|
* @Route("/statistics", name="statistics_view")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function showStatistics(StatisticsHelper $helper): Response
|
public function showStatistics(StatisticsHelper $helper): Response
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,28 +1,23 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Annotation\Route;
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/tools")
|
* @Route("/tools")
|
||||||
* @package App\Controller
|
|
||||||
*/
|
*/
|
||||||
class ToolsController extends AbstractController
|
class ToolsController extends AbstractController
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/reel_calc", name="tools_reel_calculator")
|
* @Route("/reel_calc", name="tools_reel_calculator")
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function reelCalculator() : Response
|
public function reelCalculator(): Response
|
||||||
{
|
{
|
||||||
$this->denyAccessUnlessGranted('@tools.reel_calculator');
|
$this->denyAccessUnlessGranted('@tools.reel_calculator');
|
||||||
|
|
||||||
return $this->render("Tools/ReelCalculator/main.html.twig");
|
return $this->render('Tools/ReelCalculator/main.html.twig');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,8 +70,6 @@ class TreeController extends AbstractController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/tools", name="tree_tools")
|
* @Route("/tools", name="tree_tools")
|
||||||
*
|
|
||||||
* @return JsonResponse
|
|
||||||
*/
|
*/
|
||||||
public function tools(ToolsTreeBuilder $builder): JsonResponse
|
public function tools(ToolsTreeBuilder $builder): JsonResponse
|
||||||
{
|
{
|
||||||
|
@ -83,8 +81,6 @@ class TreeController extends AbstractController
|
||||||
/**
|
/**
|
||||||
* @Route("/category/{id}", name="tree_category")
|
* @Route("/category/{id}", name="tree_category")
|
||||||
* @Route("/categories")
|
* @Route("/categories")
|
||||||
*
|
|
||||||
* @return JsonResponse
|
|
||||||
*/
|
*/
|
||||||
public function categoryTree(?Category $category = null): JsonResponse
|
public function categoryTree(?Category $category = null): JsonResponse
|
||||||
{
|
{
|
||||||
|
@ -96,8 +92,6 @@ class TreeController extends AbstractController
|
||||||
/**
|
/**
|
||||||
* @Route("/footprint/{id}", name="tree_footprint")
|
* @Route("/footprint/{id}", name="tree_footprint")
|
||||||
* @Route("/footprints")
|
* @Route("/footprints")
|
||||||
*
|
|
||||||
* @return JsonResponse
|
|
||||||
*/
|
*/
|
||||||
public function footprintTree(?Footprint $footprint = null): JsonResponse
|
public function footprintTree(?Footprint $footprint = null): JsonResponse
|
||||||
{
|
{
|
||||||
|
@ -109,8 +103,6 @@ class TreeController extends AbstractController
|
||||||
/**
|
/**
|
||||||
* @Route("/location/{id}", name="tree_location")
|
* @Route("/location/{id}", name="tree_location")
|
||||||
* @Route("/locations")
|
* @Route("/locations")
|
||||||
*
|
|
||||||
* @return JsonResponse
|
|
||||||
*/
|
*/
|
||||||
public function locationTree(?Storelocation $location = null): JsonResponse
|
public function locationTree(?Storelocation $location = null): JsonResponse
|
||||||
{
|
{
|
||||||
|
@ -122,8 +114,6 @@ class TreeController extends AbstractController
|
||||||
/**
|
/**
|
||||||
* @Route("/manufacturer/{id}", name="tree_manufacturer")
|
* @Route("/manufacturer/{id}", name="tree_manufacturer")
|
||||||
* @Route("/manufacturers")
|
* @Route("/manufacturers")
|
||||||
*
|
|
||||||
* @return JsonResponse
|
|
||||||
*/
|
*/
|
||||||
public function manufacturerTree(?Manufacturer $manufacturer = null): JsonResponse
|
public function manufacturerTree(?Manufacturer $manufacturer = null): JsonResponse
|
||||||
{
|
{
|
||||||
|
@ -135,8 +125,6 @@ class TreeController extends AbstractController
|
||||||
/**
|
/**
|
||||||
* @Route("/supplier/{id}", name="tree_supplier")
|
* @Route("/supplier/{id}", name="tree_supplier")
|
||||||
* @Route("/suppliers")
|
* @Route("/suppliers")
|
||||||
*
|
|
||||||
* @return JsonResponse
|
|
||||||
*/
|
*/
|
||||||
public function supplierTree(?Supplier $supplier = null): JsonResponse
|
public function supplierTree(?Supplier $supplier = null): JsonResponse
|
||||||
{
|
{
|
||||||
|
@ -148,8 +136,6 @@ class TreeController extends AbstractController
|
||||||
/**
|
/**
|
||||||
* @Route("/device/{id}", name="tree_device")
|
* @Route("/device/{id}", name="tree_device")
|
||||||
* @Route("/devices")
|
* @Route("/devices")
|
||||||
*
|
|
||||||
* @return JsonResponse
|
|
||||||
*/
|
*/
|
||||||
public function deviceTree(?Device $device = null): JsonResponse
|
public function deviceTree(?Device $device = null): JsonResponse
|
||||||
{
|
{
|
||||||
|
|
|
@ -88,6 +88,7 @@ class UserController extends AdminPages\BaseAdminController
|
||||||
$event = new SecurityEvent($entity);
|
$event = new SecurityEvent($entity);
|
||||||
$this->eventDispatcher->dispatch($event, SecurityEvents::PASSWORD_CHANGED);
|
$this->eventDispatcher->dispatch($event, SecurityEvents::PASSWORD_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +133,7 @@ class UserController extends AdminPages\BaseAdminController
|
||||||
|
|
||||||
protected function additionalActionNew(FormInterface $form, AbstractNamedDBElement $entity): bool
|
protected function additionalActionNew(FormInterface $form, AbstractNamedDBElement $entity): bool
|
||||||
{
|
{
|
||||||
if ($entity instanceof User && ! empty($form['new_password']->getData())) {
|
if ($entity instanceof User && !empty($form['new_password']->getData())) {
|
||||||
$password = $this->passwordEncoder->encodePassword($entity, $form['new_password']->getData());
|
$password = $this->passwordEncoder->encodePassword($entity, $form['new_password']->getData());
|
||||||
$entity->setPassword($password);
|
$entity->setPassword($password);
|
||||||
//By default the user must change the password afterwards
|
//By default the user must change the password afterwards
|
||||||
|
@ -146,8 +147,6 @@ class UserController extends AdminPages\BaseAdminController
|
||||||
* @Route("/new", name="user_new")
|
* @Route("/new", name="user_new")
|
||||||
* @Route("/{id}/clone", name="user_clone")
|
* @Route("/{id}/clone", name="user_clone")
|
||||||
* @Route("/")
|
* @Route("/")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?User $entity = null): Response
|
public function new(Request $request, EntityManagerInterface $em, EntityImporter $importer, ?User $entity = null): Response
|
||||||
{
|
{
|
||||||
|
@ -159,6 +158,7 @@ class UserController extends AdminPages\BaseAdminController
|
||||||
if ($entity instanceof User) {
|
if ($entity instanceof User) {
|
||||||
//TODO: Find a better solution
|
//TODO: Find a better solution
|
||||||
$this->addFlash('error', 'Currently it is not possible to delete a user, as this would break the log... This will be implemented later...');
|
$this->addFlash('error', 'Currently it is not possible to delete a user, as this would break the log... This will be implemented later...');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,8 +181,6 @@ class UserController extends AdminPages\BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/export", name="user_export_all")
|
* @Route("/export", name="user_export_all")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
public function exportAll(EntityManagerInterface $em, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
@ -191,8 +189,6 @@ class UserController extends AdminPages\BaseAdminController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/{id}/export", name="user_export")
|
* @Route("/{id}/export", name="user_export")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function exportEntity(User $entity, EntityExporter $exporter, Request $request): Response
|
public function exportEntity(User $entity, EntityExporter $exporter, Request $request): Response
|
||||||
{
|
{
|
||||||
|
@ -202,15 +198,13 @@ class UserController extends AdminPages\BaseAdminController
|
||||||
/**
|
/**
|
||||||
* @Route("/info", name="user_info_self")
|
* @Route("/info", name="user_info_self")
|
||||||
* @Route("/{id}/info", name="user_info")
|
* @Route("/{id}/info", name="user_info")
|
||||||
*
|
|
||||||
* @return Response
|
|
||||||
*/
|
*/
|
||||||
public function userInfo(?User $user, Packages $packages, Request $request, DataTableFactory $dataTableFactory): Response
|
public function userInfo(?User $user, Packages $packages, Request $request, DataTableFactory $dataTableFactory): Response
|
||||||
{
|
{
|
||||||
//If no user id was passed, then we show info about the current user
|
//If no user id was passed, then we show info about the current user
|
||||||
if (null === $user) {
|
if (null === $user) {
|
||||||
$tmp = $this->getUser();
|
$tmp = $this->getUser();
|
||||||
if (! $tmp instanceof User) {
|
if (!$tmp instanceof User) {
|
||||||
throw new InvalidArgumentException('Userinfo only works for database users!');
|
throw new InvalidArgumentException('Userinfo only works for database users!');
|
||||||
}
|
}
|
||||||
$user = $tmp;
|
$user = $tmp;
|
||||||
|
|
|
@ -93,7 +93,7 @@ class UserSettingsController extends AbstractController
|
||||||
//When user change its settings, he should be logged in fully.
|
//When user change its settings, he should be logged in fully.
|
||||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
|
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
|
||||||
|
|
||||||
if (! $user instanceof User) {
|
if (!$user instanceof User) {
|
||||||
return new RuntimeException('This controller only works only for Part-DB User objects!');
|
return new RuntimeException('This controller only works only for Part-DB User objects!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,8 +110,6 @@ class UserSettingsController extends AbstractController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/u2f_delete", name="u2f_delete", methods={"DELETE"})
|
* @Route("/u2f_delete", name="u2f_delete", methods={"DELETE"})
|
||||||
*
|
|
||||||
* @return RedirectResponse
|
|
||||||
*/
|
*/
|
||||||
public function removeU2FToken(Request $request, EntityManagerInterface $entityManager, BackupCodeManager $backupCodeManager): RedirectResponse
|
public function removeU2FToken(Request $request, EntityManagerInterface $entityManager, BackupCodeManager $backupCodeManager): RedirectResponse
|
||||||
{
|
{
|
||||||
|
@ -124,7 +122,7 @@ class UserSettingsController extends AbstractController
|
||||||
//When user change its settings, he should be logged in fully.
|
//When user change its settings, he should be logged in fully.
|
||||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
|
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
|
||||||
|
|
||||||
if (! $user instanceof User) {
|
if (!$user instanceof User) {
|
||||||
throw new RuntimeException('This controller only works only for Part-DB User objects!');
|
throw new RuntimeException('This controller only works only for Part-DB User objects!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +176,7 @@ class UserSettingsController extends AbstractController
|
||||||
//When user change its settings, he should be logged in fully.
|
//When user change its settings, he should be logged in fully.
|
||||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
|
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
|
||||||
|
|
||||||
if (! $user instanceof User) {
|
if (!$user instanceof User) {
|
||||||
return new RuntimeException('This controller only works only for Part-DB User objects!');
|
return new RuntimeException('This controller only works only for Part-DB User objects!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +209,7 @@ class UserSettingsController extends AbstractController
|
||||||
//When user change its settings, he should be logged in fully.
|
//When user change its settings, he should be logged in fully.
|
||||||
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
|
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
|
||||||
|
|
||||||
if (! $user instanceof User) {
|
if (!$user instanceof User) {
|
||||||
throw new RuntimeException('This controller only works only for Part-DB User objects!');
|
throw new RuntimeException('This controller only works only for Part-DB User objects!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +223,7 @@ class UserSettingsController extends AbstractController
|
||||||
|
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
if (! $this->demo_mode && $form->isSubmitted() && $form->isValid()) {
|
if (!$this->demo_mode && $form->isSubmitted() && $form->isValid()) {
|
||||||
//Check if user theme setting has changed
|
//Check if user theme setting has changed
|
||||||
if ($user->getTheme() !== $em->getUnitOfWork()->getOriginalEntityData($user)['theme']) {
|
if ($user->getTheme() !== $em->getUnitOfWork()->getOriginalEntityData($user)['theme']) {
|
||||||
$page_need_reload = true;
|
$page_need_reload = true;
|
||||||
|
@ -285,7 +283,7 @@ class UserSettingsController extends AbstractController
|
||||||
$pw_form->handleRequest($request);
|
$pw_form->handleRequest($request);
|
||||||
|
|
||||||
//Check if password if everything was correct, then save it to User and DB
|
//Check if password if everything was correct, then save it to User and DB
|
||||||
if (! $this->demo_mode && $pw_form->isSubmitted() && $pw_form->isValid()) {
|
if (!$this->demo_mode && $pw_form->isSubmitted() && $pw_form->isValid()) {
|
||||||
$password = $passwordEncoder->encodePassword($user, $pw_form['new_password']->getData());
|
$password = $passwordEncoder->encodePassword($user, $pw_form['new_password']->getData());
|
||||||
$user->setPassword($password);
|
$user->setPassword($password);
|
||||||
|
|
||||||
|
@ -301,14 +299,14 @@ class UserSettingsController extends AbstractController
|
||||||
//Handle 2FA things
|
//Handle 2FA things
|
||||||
$google_form = $this->createForm(TFAGoogleSettingsType::class, $user);
|
$google_form = $this->createForm(TFAGoogleSettingsType::class, $user);
|
||||||
$google_enabled = $user->isGoogleAuthenticatorEnabled();
|
$google_enabled = $user->isGoogleAuthenticatorEnabled();
|
||||||
if (! $google_enabled && ! $form->isSubmitted()) {
|
if (!$google_enabled && !$form->isSubmitted()) {
|
||||||
$user->setGoogleAuthenticatorSecret($googleAuthenticator->generateSecret());
|
$user->setGoogleAuthenticatorSecret($googleAuthenticator->generateSecret());
|
||||||
$google_form->get('googleAuthenticatorSecret')->setData($user->getGoogleAuthenticatorSecret());
|
$google_form->get('googleAuthenticatorSecret')->setData($user->getGoogleAuthenticatorSecret());
|
||||||
}
|
}
|
||||||
$google_form->handleRequest($request);
|
$google_form->handleRequest($request);
|
||||||
|
|
||||||
if (! $this->demo_mode && $google_form->isSubmitted() && $google_form->isValid()) {
|
if (!$this->demo_mode && $google_form->isSubmitted() && $google_form->isValid()) {
|
||||||
if (! $google_enabled) {
|
if (!$google_enabled) {
|
||||||
//Save 2FA settings (save secrets)
|
//Save 2FA settings (save secrets)
|
||||||
$user->setGoogleAuthenticatorSecret($google_form->get('googleAuthenticatorSecret')->getData());
|
$user->setGoogleAuthenticatorSecret($google_form->get('googleAuthenticatorSecret')->getData());
|
||||||
$backupCodeManager->enableBackupCodes($user);
|
$backupCodeManager->enableBackupCodes($user);
|
||||||
|
@ -340,7 +338,7 @@ class UserSettingsController extends AbstractController
|
||||||
])->getForm();
|
])->getForm();
|
||||||
|
|
||||||
$backup_form->handleRequest($request);
|
$backup_form->handleRequest($request);
|
||||||
if (! $this->demo_mode && $backup_form->isSubmitted() && $backup_form->isValid()) {
|
if (!$this->demo_mode && $backup_form->isSubmitted() && $backup_form->isValid()) {
|
||||||
$backupCodeManager->regenerateBackupCodes($user);
|
$backupCodeManager->regenerateBackupCodes($user);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
$this->addFlash('success', 'user.settings.2fa.backup_codes.regenerated');
|
$this->addFlash('success', 'user.settings.2fa.backup_codes.regenerated');
|
||||||
|
|
|
@ -89,7 +89,7 @@ class DataStructureFixtures extends Fixture
|
||||||
*/
|
*/
|
||||||
public function createNodesForClass(string $class, ObjectManager $manager): void
|
public function createNodesForClass(string $class, ObjectManager $manager): void
|
||||||
{
|
{
|
||||||
if (! new $class() instanceof AbstractStructuralDBElement) {
|
if (!new $class() instanceof AbstractStructuralDBElement) {
|
||||||
throw new InvalidArgumentException('$class must be a StructuralDBElement!');
|
throw new InvalidArgumentException('$class must be a StructuralDBElement!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -234,7 +234,7 @@ class ORMAdapter extends AbstractAdapter
|
||||||
|
|
||||||
$qb->resetDQLPart('orderBy');
|
$qb->resetDQLPart('orderBy');
|
||||||
$gb = $qb->getDQLPart('groupBy');
|
$gb = $qb->getDQLPart('groupBy');
|
||||||
if (empty($gb) || ! $this->hasGroupByPart($identifier, $gb)) {
|
if (empty($gb) || !$this->hasGroupByPart($identifier, $gb)) {
|
||||||
$qb->select($qb->expr()->count($identifier));
|
$qb->select($qb->expr()->count($identifier));
|
||||||
|
|
||||||
return (int) $qb->getQuery()->getSingleScalarResult();
|
return (int) $qb->getQuery()->getSingleScalarResult();
|
||||||
|
|
|
@ -81,12 +81,11 @@ final class AttachmentDataTable implements DataTableTypeInterface
|
||||||
'label' => '',
|
'label' => '',
|
||||||
'render' => function ($value, Attachment $context) {
|
'render' => function ($value, Attachment $context) {
|
||||||
if ($context->isPicture()
|
if ($context->isPicture()
|
||||||
&& ! $context->isExternal()
|
&& !$context->isExternal()
|
||||||
&& $this->attachmentHelper->isFileExisting($context)) {
|
&& $this->attachmentHelper->isFileExisting($context)) {
|
||||||
|
|
||||||
$title = htmlspecialchars($context->getName());
|
$title = htmlspecialchars($context->getName());
|
||||||
if ($context->getFilename()) {
|
if ($context->getFilename()) {
|
||||||
$title .= ' (' . htmlspecialchars($context->getFilename()) . ')';
|
$title .= ' ('.htmlspecialchars($context->getFilename()).')';
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf(
|
return sprintf(
|
||||||
|
|
|
@ -66,8 +66,6 @@ class EntityColumn extends AbstractColumn
|
||||||
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
|
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
|
||||||
*
|
*
|
||||||
* @param mixed $value The single value of the column
|
* @param mixed $value The single value of the column
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function normalize($value)
|
public function normalize($value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,7 +59,7 @@ class LocaleDateTimeColumn extends AbstractColumn
|
||||||
{
|
{
|
||||||
if (null === $value) {
|
if (null === $value) {
|
||||||
return $this->options['nullValue'];
|
return $this->options['nullValue'];
|
||||||
} elseif (! $value instanceof DateTimeInterface) {
|
} elseif (!$value instanceof DateTimeInterface) {
|
||||||
$value = new DateTime((string) $value);
|
$value = new DateTime((string) $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ class LogEntryTargetColumn extends AbstractColumn
|
||||||
$tmp = '';
|
$tmp = '';
|
||||||
|
|
||||||
//The element is existing
|
//The element is existing
|
||||||
if ($target instanceof NamedElementInterface && ! empty($target->getName())) {
|
if ($target instanceof NamedElementInterface && !empty($target->getName())) {
|
||||||
try {
|
try {
|
||||||
$tmp = sprintf(
|
$tmp = sprintf(
|
||||||
'<a href="%s">%s</a>',
|
'<a href="%s">%s</a>',
|
||||||
|
|
|
@ -58,8 +58,6 @@ class MarkdownColumn extends AbstractColumn
|
||||||
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
|
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
|
||||||
*
|
*
|
||||||
* @param mixed $value The single value of the column
|
* @param mixed $value The single value of the column
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function normalize($value)
|
public function normalize($value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -68,8 +68,6 @@ class PartAttachmentsColumn extends AbstractColumn
|
||||||
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
|
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
|
||||||
*
|
*
|
||||||
* @param mixed $value The single value of the column
|
* @param mixed $value The single value of the column
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function normalize($value)
|
public function normalize($value)
|
||||||
{
|
{
|
||||||
|
@ -78,7 +76,7 @@ class PartAttachmentsColumn extends AbstractColumn
|
||||||
|
|
||||||
public function render($value, $context)
|
public function render($value, $context)
|
||||||
{
|
{
|
||||||
if (! $context instanceof Part) {
|
if (!$context instanceof Part) {
|
||||||
throw new RuntimeException('$context must be a Part object!');
|
throw new RuntimeException('$context must be a Part object!');
|
||||||
}
|
}
|
||||||
$tmp = '';
|
$tmp = '';
|
||||||
|
|
|
@ -65,7 +65,7 @@ class RevertLogColumn extends AbstractColumn
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$disabled = ! $this->security->isGranted('revert_element', $context->getTargetClass());
|
$disabled = !$this->security->isGranted('revert_element', $context->getTargetClass());
|
||||||
|
|
||||||
$tmp = '<div class="btn-group btn-group-sm">';
|
$tmp = '<div class="btn-group btn-group-sm">';
|
||||||
$tmp .= sprintf(
|
$tmp .= sprintf(
|
||||||
|
|
|
@ -58,8 +58,6 @@ class TagsColumn extends AbstractColumn
|
||||||
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
|
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
|
||||||
*
|
*
|
||||||
* @param mixed $value The single value of the column
|
* @param mixed $value The single value of the column
|
||||||
*
|
|
||||||
* @return mixed
|
|
||||||
*/
|
*/
|
||||||
public function normalize($value)
|
public function normalize($value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,7 +103,7 @@ class LogDataTable implements DataTableTypeInterface
|
||||||
$optionsResolver->setAllowedTypes('mode', 'string');
|
$optionsResolver->setAllowedTypes('mode', 'string');
|
||||||
|
|
||||||
$optionsResolver->setNormalizer('filter_elements', function (Options $options, $value) {
|
$optionsResolver->setNormalizer('filter_elements', function (Options $options, $value) {
|
||||||
if (! is_array($value)) {
|
if (!is_array($value)) {
|
||||||
return [$value];
|
return [$value];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,8 +254,8 @@ class LogDataTable implements DataTableTypeInterface
|
||||||
},
|
},
|
||||||
'disabled' => function ($value, AbstractLogEntry $context) {
|
'disabled' => function ($value, AbstractLogEntry $context) {
|
||||||
return
|
return
|
||||||
! $this->security->isGranted('@tools.timetravel')
|
!$this->security->isGranted('@tools.timetravel')
|
||||||
|| ! $this->security->isGranted('show_history', $context->getTargetClass());
|
|| !$this->security->isGranted('show_history', $context->getTargetClass());
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ class LogDataTable implements DataTableTypeInterface
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($options['filter_elements'])) {
|
if (!empty($options['filter_elements'])) {
|
||||||
foreach ($options['filter_elements'] as $element) {
|
foreach ($options['filter_elements'] as $element) {
|
||||||
/** @var AbstractDBElement $element */
|
/** @var AbstractDBElement $element */
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,6 @@ use App\DataTables\Column\LocaleDateTimeColumn;
|
||||||
use App\DataTables\Column\MarkdownColumn;
|
use App\DataTables\Column\MarkdownColumn;
|
||||||
use App\DataTables\Column\PartAttachmentsColumn;
|
use App\DataTables\Column\PartAttachmentsColumn;
|
||||||
use App\DataTables\Column\TagsColumn;
|
use App\DataTables\Column\TagsColumn;
|
||||||
use App\Entity\LogSystem\AbstractLogEntry;
|
|
||||||
use App\Entity\Parts\Category;
|
use App\Entity\Parts\Category;
|
||||||
use App\Entity\Parts\Footprint;
|
use App\Entity\Parts\Footprint;
|
||||||
use App\Entity\Parts\Manufacturer;
|
use App\Entity\Parts\Manufacturer;
|
||||||
|
@ -163,7 +162,7 @@ final class PartsDataTable implements DataTableTypeInterface
|
||||||
|
|
||||||
$title = htmlspecialchars($preview_attachment->getName());
|
$title = htmlspecialchars($preview_attachment->getName());
|
||||||
if ($preview_attachment->getFilename()) {
|
if ($preview_attachment->getFilename()) {
|
||||||
$title .= ' (' . htmlspecialchars($preview_attachment->getFilename()) . ')';
|
$title .= ' ('.htmlspecialchars($preview_attachment->getFilename()).')';
|
||||||
}
|
}
|
||||||
|
|
||||||
return sprintf(
|
return sprintf(
|
||||||
|
@ -396,8 +395,8 @@ final class PartsDataTable implements DataTableTypeInterface
|
||||||
$builder->andWhere('part.tags LIKE :tag')->setParameter('tag', '%'.$options['tag'].'%');
|
$builder->andWhere('part.tags LIKE :tag')->setParameter('tag', '%'.$options['tag'].'%');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($options['search'])) {
|
if (!empty($options['search'])) {
|
||||||
if (! $options['search_options']['regex']) {
|
if (!$options['search_options']['regex']) {
|
||||||
//Dont show results, if no things are selected
|
//Dont show results, if no things are selected
|
||||||
$builder->andWhere('0=1');
|
$builder->andWhere('0=1');
|
||||||
$defined = false;
|
$defined = false;
|
||||||
|
|
|
@ -68,7 +68,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
||||||
public const INTERNAL_PLACEHOLDER = ['%BASE%', '%MEDIA%', '%SECURE%'];
|
public const INTERNAL_PLACEHOLDER = ['%BASE%', '%MEDIA%', '%SECURE%'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array Placeholders for attachments which using built in files.
|
* @var array placeholders for attachments which using built in files
|
||||||
*/
|
*/
|
||||||
public const BUILTIN_PLACEHOLDER = ['%FOOTPRINTS%', '%FOOTPRINTS3D%'];
|
public const BUILTIN_PLACEHOLDER = ['%FOOTPRINTS%', '%FOOTPRINTS3D%'];
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ! in_array($tmp[0], array_merge(static::INTERNAL_PLACEHOLDER, static::BUILTIN_PLACEHOLDER), false);
|
return !in_array($tmp[0], array_merge(static::INTERNAL_PLACEHOLDER, static::BUILTIN_PLACEHOLDER), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -233,7 +233,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($this->original_filename)) {
|
if (!empty($this->original_filename)) {
|
||||||
return strtolower(pathinfo($this->original_filename, PATHINFO_EXTENSION));
|
return strtolower(pathinfo($this->original_filename, PATHINFO_EXTENSION));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
||||||
*/
|
*/
|
||||||
public function getURL(): ?string
|
public function getURL(): ?string
|
||||||
{
|
{
|
||||||
if (! $this->isExternal() && ! $this->isBuiltIn()) {
|
if (!$this->isExternal() && !$this->isBuiltIn()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
||||||
*/
|
*/
|
||||||
public function getHost(): ?string
|
public function getHost(): ?string
|
||||||
{
|
{
|
||||||
if (! $this->isExternal()) {
|
if (!$this->isExternal()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
||||||
}
|
}
|
||||||
|
|
||||||
//If we have a stored original filename, then use it
|
//If we have a stored original filename, then use it
|
||||||
if (! empty($this->original_filename)) {
|
if (!empty($this->original_filename)) {
|
||||||
return $this->original_filename;
|
return $this->original_filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -345,7 +345,6 @@ abstract class Attachment extends AbstractNamedDBElement
|
||||||
return $this->attachment_type;
|
return $this->attachment_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************************************
|
/*****************************************************************************************************
|
||||||
* Setters
|
* Setters
|
||||||
***************************************************************************************************
|
***************************************************************************************************
|
||||||
|
@ -367,7 +366,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
||||||
*/
|
*/
|
||||||
public function setElement(AttachmentContainingDBElement $element): self
|
public function setElement(AttachmentContainingDBElement $element): self
|
||||||
{
|
{
|
||||||
if (! is_a($element, static::ALLOWED_ELEMENT_CLASS)) {
|
if (!is_a($element, static::ALLOWED_ELEMENT_CLASS)) {
|
||||||
throw new InvalidArgumentException(sprintf('The element associated with a %s must be a %s!', static::class, static::ALLOWED_ELEMENT_CLASS));
|
throw new InvalidArgumentException(sprintf('The element associated with a %s must be a %s!', static::class, static::ALLOWED_ELEMENT_CLASS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,7 +408,7 @@ abstract class Attachment extends AbstractNamedDBElement
|
||||||
public function setURL(?string $url): self
|
public function setURL(?string $url): self
|
||||||
{
|
{
|
||||||
//Only set if the URL is not empty
|
//Only set if the URL is not empty
|
||||||
if (! empty($url)) {
|
if (!empty($url)) {
|
||||||
if (false !== strpos($url, '%BASE%') || false !== strpos($url, '%MEDIA%')) {
|
if (false !== strpos($url, '%BASE%') || false !== strpos($url, '%MEDIA%')) {
|
||||||
throw new InvalidArgumentException('You can not reference internal files via the url field! But nice try!');
|
throw new InvalidArgumentException('You can not reference internal files via the url field! But nice try!');
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,5 +118,4 @@ class AttachmentType extends AbstractStructuralDBElement
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ abstract class AbstractNamedDBElement extends AbstractDBElement implements Named
|
||||||
use TimestampTrait;
|
use TimestampTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string The name of this element.
|
* @var string the name of this element
|
||||||
* @ORM\Column(type="string")
|
* @ORM\Column(type="string")
|
||||||
* @Assert\NotBlank()
|
* @Assert\NotBlank()
|
||||||
* @Groups({"simple", "extended", "full"})
|
* @Groups({"simple", "extended", "full"})
|
||||||
|
@ -92,8 +92,6 @@ abstract class AbstractNamedDBElement extends AbstractDBElement implements Named
|
||||||
* Change the name of this element.
|
* Change the name of this element.
|
||||||
*
|
*
|
||||||
* @param string $new_name the new name
|
* @param string $new_name the new name
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
*/
|
||||||
public function setName(string $new_name): self
|
public function setName(string $new_name): self
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,9 +22,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Entity\Base;
|
namespace App\Entity\Base;
|
||||||
|
|
||||||
use App\Entity\Parts\Part;
|
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -34,5 +31,4 @@ use Doctrine\ORM\Mapping as ORM;
|
||||||
*/
|
*/
|
||||||
abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement
|
abstract class AbstractPartsContainingDBElement extends AbstractStructuralDBElement
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
||||||
* @param AbstractStructuralDBElement $another_element the object to compare
|
* @param AbstractStructuralDBElement $another_element the object to compare
|
||||||
* IMPORTANT: both objects to compare must be from the same class (for example two "Device" objects)!
|
* IMPORTANT: both objects to compare must be from the same class (for example two "Device" objects)!
|
||||||
*
|
*
|
||||||
* @return bool True, if this element is child of $another_element.
|
* @return bool true, if this element is child of $another_element
|
||||||
*
|
*
|
||||||
* @throws InvalidArgumentException if there was an error
|
* @throws InvalidArgumentException if there was an error
|
||||||
*/
|
*/
|
||||||
|
@ -140,7 +140,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
||||||
|
|
||||||
//Check if both elements compared, are from the same type
|
//Check if both elements compared, are from the same type
|
||||||
// (we have to check inheritance, or we get exceptions when using doctrine entities (they have a proxy type):
|
// (we have to check inheritance, or we get exceptions when using doctrine entities (they have a proxy type):
|
||||||
if (! is_a($another_element, $class_name) && ! is_a($this, get_class($another_element))) {
|
if (!is_a($another_element, $class_name) && !is_a($this, get_class($another_element))) {
|
||||||
throw new InvalidArgumentException('isChildOf() only works for objects of the same type!');
|
throw new InvalidArgumentException('isChildOf() only works for objects of the same type!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
||||||
/**
|
/**
|
||||||
* Checks if this element is an root element (has no parent).
|
* Checks if this element is an root element (has no parent).
|
||||||
*
|
*
|
||||||
* @return bool True if the this element is an root element.
|
* @return bool true if the this element is an root element
|
||||||
*/
|
*/
|
||||||
public function isRoot(): bool
|
public function isRoot(): bool
|
||||||
{
|
{
|
||||||
|
@ -256,7 +256,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
||||||
$tmp[] = $this;
|
$tmp[] = $this;
|
||||||
|
|
||||||
//We only allow 20 levels depth
|
//We only allow 20 levels depth
|
||||||
while (! end($tmp)->isRoot() && count($tmp) < 20) {
|
while (!end($tmp)->isRoot() && count($tmp) < 20) {
|
||||||
$tmp[] = end($tmp)->parent;
|
$tmp[] = end($tmp)->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -283,9 +283,6 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
||||||
return $this->children;
|
return $this->children;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function isNotSelectable(): bool
|
public function isNotSelectable(): bool
|
||||||
{
|
{
|
||||||
return $this->not_selectable;
|
return $this->not_selectable;
|
||||||
|
@ -337,7 +334,7 @@ abstract class AbstractStructuralDBElement extends AttachmentContainingDBElement
|
||||||
*/
|
*/
|
||||||
public function setChildren($elements): self
|
public function setChildren($elements): self
|
||||||
{
|
{
|
||||||
if (! is_array($elements) && ! $elements instanceof Collection) {
|
if (!is_array($elements) && !$elements instanceof Collection) {
|
||||||
throw new InvalidArgumentException('$elements must be an array or Collection!');
|
throw new InvalidArgumentException('$elements must be an array or Collection!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,24 +20,24 @@
|
||||||
|
|
||||||
namespace App\Entity\Base;
|
namespace App\Entity\Base;
|
||||||
|
|
||||||
|
|
||||||
use App\Entity\Parts\Part;
|
use App\Entity\Parts\Part;
|
||||||
use Doctrine\Common\Collections\Collection;
|
|
||||||
|
|
||||||
interface PartsContainingRepositoryInterface
|
interface PartsContainingRepositoryInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns all parts associated with this element.
|
* Returns all parts associated with this element.
|
||||||
* @param object $element The element for which the parts should be determined.
|
*
|
||||||
* @param array $order_by The order of the parts. Format ['name' => 'ASC']
|
* @param object $element the element for which the parts should be determined
|
||||||
|
* @param array $order_by The order of the parts. Format ['name' => 'ASC']
|
||||||
|
*
|
||||||
* @return Part[]
|
* @return Part[]
|
||||||
*/
|
*/
|
||||||
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array;
|
public function getParts(object $element, array $order_by = ['name' => 'ASC']): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the count of the parts associated with this element.
|
* Gets the count of the parts associated with this element.
|
||||||
* @param object $element The element for which the parts should be determined.
|
*
|
||||||
* @return int
|
* @param object $element the element for which the parts should be determined
|
||||||
*/
|
*/
|
||||||
public function getPartsCount(object $element): int;
|
public function getPartsCount(object $element): int;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,16 +27,12 @@ interface LogWithCommentInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Checks if this log entry has a user provided comment.
|
* Checks if this log entry has a user provided comment.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function hasComment(): bool;
|
public function hasComment(): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the user provided comment associated with this log entry.
|
* Gets the user provided comment associated with this log entry.
|
||||||
* Returns null if not comment was set.
|
* Returns null if not comment was set.
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
public function getComment(): ?string;
|
public function getComment(): ?string;
|
||||||
|
|
||||||
|
|
|
@ -29,15 +29,11 @@ interface LogWithEventUndoInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Checks if this element undoes another event.
|
* Checks if this element undoes another event.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function isUndoEvent(): bool;
|
public function isUndoEvent(): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ID of the undone event or null if no event is undone.
|
* Returns the ID of the undone event or null if no event is undone.
|
||||||
*
|
|
||||||
* @return int|null
|
|
||||||
*/
|
*/
|
||||||
public function getUndoEventID(): ?int;
|
public function getUndoEventID(): ?int;
|
||||||
|
|
||||||
|
@ -52,8 +48,6 @@ interface LogWithEventUndoInterface
|
||||||
* Returns the mode how the event was undone:
|
* Returns the mode how the event was undone:
|
||||||
* "undo" = Only a single event was applied to element
|
* "undo" = Only a single event was applied to element
|
||||||
* "revert" = Element was reverted to the state it was to the timestamp of the log.
|
* "revert" = Element was reverted to the state it was to the timestamp of the log.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getUndoMode(): string;
|
public function getUndoMode(): string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ interface TimeTravelInterface
|
||||||
/**
|
/**
|
||||||
* Checks if this entry has informations which data has changed.
|
* Checks if this entry has informations which data has changed.
|
||||||
*
|
*
|
||||||
* @return bool True if this entry has informations about the changed data.
|
* @return bool true if this entry has informations about the changed data
|
||||||
*/
|
*/
|
||||||
public function hasOldDataInformations(): bool;
|
public function hasOldDataInformations(): bool;
|
||||||
|
|
||||||
|
@ -40,8 +40,6 @@ interface TimeTravelInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the the timestamp associated with this change.
|
* Returns the the timestamp associated with this change.
|
||||||
*
|
|
||||||
* @return \DateTime
|
|
||||||
*/
|
*/
|
||||||
public function getTimestamp(): \DateTime;
|
public function getTimestamp(): \DateTime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,12 +73,12 @@ class LabelOptions
|
||||||
protected $supported_element = 'part';
|
protected $supported_element = 'part';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string Any additional CSS for the label.
|
* @var string any additional CSS for the label
|
||||||
* @ORM\Column(type="text")
|
* @ORM\Column(type="text")
|
||||||
*/
|
*/
|
||||||
protected $additional_css = '';
|
protected $additional_css = '';
|
||||||
|
|
||||||
/** @var string The mode that will be used to interpret the lines.
|
/** @var string The mode that will be used to interpret the lines
|
||||||
* @Assert\Choice(choices=LabelOptions::LINES_MODES)
|
* @Assert\Choice(choices=LabelOptions::LINES_MODES)
|
||||||
* @ORM\Column(type="string")
|
* @ORM\Column(type="string")
|
||||||
*/
|
*/
|
||||||
|
@ -90,9 +90,6 @@ class LabelOptions
|
||||||
*/
|
*/
|
||||||
protected $lines = '';
|
protected $lines = '';
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getWidth(): float
|
public function getWidth(): float
|
||||||
{
|
{
|
||||||
return $this->width;
|
return $this->width;
|
||||||
|
@ -108,9 +105,6 @@ class LabelOptions
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getHeight(): float
|
public function getHeight(): float
|
||||||
{
|
{
|
||||||
return $this->height;
|
return $this->height;
|
||||||
|
@ -126,9 +120,6 @@ class LabelOptions
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getBarcodeType(): string
|
public function getBarcodeType(): string
|
||||||
{
|
{
|
||||||
return $this->barcode_type;
|
return $this->barcode_type;
|
||||||
|
@ -144,9 +135,6 @@ class LabelOptions
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getPictureType(): string
|
public function getPictureType(): string
|
||||||
{
|
{
|
||||||
return $this->picture_type;
|
return $this->picture_type;
|
||||||
|
@ -162,9 +150,6 @@ class LabelOptions
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getSupportedElement(): string
|
public function getSupportedElement(): string
|
||||||
{
|
{
|
||||||
return $this->supported_element;
|
return $this->supported_element;
|
||||||
|
@ -180,9 +165,6 @@ class LabelOptions
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getLines(): string
|
public function getLines(): string
|
||||||
{
|
{
|
||||||
return $this->lines;
|
return $this->lines;
|
||||||
|
@ -200,8 +182,6 @@ class LabelOptions
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets additional CSS (it will simply be attached.
|
* Gets additional CSS (it will simply be attached.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getAdditionalCss(): string
|
public function getAdditionalCss(): string
|
||||||
{
|
{
|
||||||
|
@ -218,9 +198,6 @@ class LabelOptions
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getLinesMode(): string
|
public function getLinesMode(): string
|
||||||
{
|
{
|
||||||
return $this->lines_mode;
|
return $this->lines_mode;
|
||||||
|
|
|
@ -59,7 +59,7 @@ class LabelProfile extends AttachmentContainingDBElement
|
||||||
protected $comment = '';
|
protected $comment = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool Determines, if this label profile should be shown in the dropdown quick menu.
|
* @var bool determines, if this label profile should be shown in the dropdown quick menu
|
||||||
* @ORM\Column(type="boolean")
|
* @ORM\Column(type="boolean")
|
||||||
*/
|
*/
|
||||||
protected $show_in_dropdown = true;
|
protected $show_in_dropdown = true;
|
||||||
|
@ -101,8 +101,6 @@ class LabelProfile extends AttachmentContainingDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true, if this label profile should be shown in label generator quick menu.
|
* Returns true, if this label profile should be shown in label generator quick menu.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function isShowInDropdown(): bool
|
public function isShowInDropdown(): bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -162,7 +162,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
||||||
*/
|
*/
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
/** @var DateTime The datetime the event associated with this log entry has occured.
|
/** @var DateTime The datetime the event associated with this log entry has occured
|
||||||
* @ORM\Column(type="datetime", name="datetime")
|
* @ORM\Column(type="datetime", name="datetime")
|
||||||
*/
|
*/
|
||||||
protected $timestamp;
|
protected $timestamp;
|
||||||
|
@ -223,8 +223,6 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the timestamp when the event that caused this log entry happened.
|
* Returns the timestamp when the event that caused this log entry happened.
|
||||||
*
|
|
||||||
* @return DateTime
|
|
||||||
*/
|
*/
|
||||||
public function getTimestamp(): DateTime
|
public function getTimestamp(): DateTime
|
||||||
{
|
{
|
||||||
|
@ -246,8 +244,6 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
||||||
/**
|
/**
|
||||||
* Get the priority level of this log entry. 0 is highest and 7 lowest level.
|
* Get the priority level of this log entry. 0 is highest and 7 lowest level.
|
||||||
* See LEVEL_* consts in this class for more info.
|
* See LEVEL_* consts in this class for more info.
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
*/
|
||||||
public function getLevel(): int
|
public function getLevel(): int
|
||||||
{
|
{
|
||||||
|
@ -276,8 +272,6 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the priority level of this log entry as PSR3 compatible string.
|
* Get the priority level of this log entry as PSR3 compatible string.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getLevelString(): string
|
public function getLevelString(): string
|
||||||
{
|
{
|
||||||
|
@ -298,8 +292,6 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the type of the event this log entry is associated with.
|
* Returns the type of the event this log entry is associated with.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getType(): string
|
public function getType(): string
|
||||||
{
|
{
|
||||||
|
@ -310,7 +302,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
||||||
* Returns the class name of the target element associated with this log entry.
|
* Returns the class name of the target element associated with this log entry.
|
||||||
* Returns null, if this log entry is not associated with an log entry.
|
* Returns null, if this log entry is not associated with an log entry.
|
||||||
*
|
*
|
||||||
* @return string|null The class name of the target class.
|
* @return string|null the class name of the target class
|
||||||
*/
|
*/
|
||||||
public function getTargetClass(): ?string
|
public function getTargetClass(): ?string
|
||||||
{
|
{
|
||||||
|
@ -325,7 +317,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
||||||
* Returns the ID of the target element associated with this log entry.
|
* Returns the ID of the target element associated with this log entry.
|
||||||
* Returns null, if this log entry is not associated with an log entry.
|
* Returns null, if this log entry is not associated with an log entry.
|
||||||
*
|
*
|
||||||
* @return int|null The ID of the associated element.
|
* @return int|null the ID of the associated element
|
||||||
*/
|
*/
|
||||||
public function getTargetID(): ?int
|
public function getTargetID(): ?int
|
||||||
{
|
{
|
||||||
|
@ -339,7 +331,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
||||||
/**
|
/**
|
||||||
* Checks if this log entry is associated with an element.
|
* Checks if this log entry is associated with an element.
|
||||||
*
|
*
|
||||||
* @return bool True if this log entry is associated with an element, false otherwise.
|
* @return bool true if this log entry is associated with an element, false otherwise
|
||||||
*/
|
*/
|
||||||
public function hasTarget(): bool
|
public function hasTarget(): bool
|
||||||
{
|
{
|
||||||
|
@ -349,7 +341,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
||||||
/**
|
/**
|
||||||
* Sets the target element associated with this element.
|
* Sets the target element associated with this element.
|
||||||
*
|
*
|
||||||
* @param AbstractDBElement $element The element that should be associated with this element.
|
* @param AbstractDBElement $element the element that should be associated with this element
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
@ -394,7 +386,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
||||||
*/
|
*/
|
||||||
final public static function levelIntToString(int $level): string
|
final public static function levelIntToString(int $level): string
|
||||||
{
|
{
|
||||||
if (! isset(self::LEVEL_ID_TO_STRING[$level])) {
|
if (!isset(self::LEVEL_ID_TO_STRING[$level])) {
|
||||||
throw new \InvalidArgumentException('No level with this int is existing!');
|
throw new \InvalidArgumentException('No level with this int is existing!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,12 +398,12 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
||||||
*
|
*
|
||||||
* @param string $level the PSR3 compatible string that should be converted
|
* @param string $level the PSR3 compatible string that should be converted
|
||||||
*
|
*
|
||||||
* @return int The internal int representation.
|
* @return int the internal int representation
|
||||||
*/
|
*/
|
||||||
final public static function levelStringToInt(string $level): int
|
final public static function levelStringToInt(string $level): int
|
||||||
{
|
{
|
||||||
$tmp = array_flip(self::LEVEL_ID_TO_STRING);
|
$tmp = array_flip(self::LEVEL_ID_TO_STRING);
|
||||||
if (! isset($tmp[$level])) {
|
if (!isset($tmp[$level])) {
|
||||||
throw new \InvalidArgumentException('No level with this string is existing!');
|
throw new \InvalidArgumentException('No level with this string is existing!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,12 +414,10 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
||||||
* Converts an target type id to an full qualified class name.
|
* Converts an target type id to an full qualified class name.
|
||||||
*
|
*
|
||||||
* @param int $type_id The target type ID
|
* @param int $type_id The target type ID
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
final public static function targetTypeIdToClass(int $type_id): string
|
final public static function targetTypeIdToClass(int $type_id): string
|
||||||
{
|
{
|
||||||
if (! isset(self::TARGET_CLASS_MAPPING[$type_id])) {
|
if (!isset(self::TARGET_CLASS_MAPPING[$type_id])) {
|
||||||
throw new \InvalidArgumentException('No target type with this ID is existing!');
|
throw new \InvalidArgumentException('No target type with this ID is existing!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,7 +429,7 @@ abstract class AbstractLogEntry extends AbstractDBElement
|
||||||
*
|
*
|
||||||
* @param string $class The name of the class (FQN) that should be converted to id
|
* @param string $class The name of the class (FQN) that should be converted to id
|
||||||
*
|
*
|
||||||
* @return int The ID of the associated target type ID.
|
* @return int the ID of the associated target type ID
|
||||||
*/
|
*/
|
||||||
final public static function targetTypeClassToID(string $class): int
|
final public static function targetTypeClassToID(string $class): int
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,8 +54,6 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of the collection (on target element) that was changed.
|
* Get the name of the collection (on target element) that was changed.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getCollectionName(): string
|
public function getCollectionName(): string
|
||||||
{
|
{
|
||||||
|
@ -65,8 +63,6 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
|
||||||
/**
|
/**
|
||||||
* Gets the name of the element that was deleted.
|
* Gets the name of the element that was deleted.
|
||||||
* Return null, if the element did not have a name.
|
* Return null, if the element did not have a name.
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
public function getOldName(): ?string
|
public function getOldName(): ?string
|
||||||
{
|
{
|
||||||
|
@ -75,8 +71,6 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the class of the deleted element.
|
* Returns the class of the deleted element.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getDeletedElementClass(): string
|
public function getDeletedElementClass(): string
|
||||||
{
|
{
|
||||||
|
@ -85,8 +79,6 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the ID of the deleted element.
|
* Returns the ID of the deleted element.
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
*/
|
||||||
public function getDeletedElementID(): int
|
public function getDeletedElementID(): int
|
||||||
{
|
{
|
||||||
|
|
|
@ -60,8 +60,6 @@ class DatabaseUpdatedLogEntry extends AbstractLogEntry
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the database update was successful.
|
* Checks if the database update was successful.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function isSuccessful(): bool
|
public function isSuccessful(): bool
|
||||||
{
|
{
|
||||||
|
@ -71,8 +69,6 @@ class DatabaseUpdatedLogEntry extends AbstractLogEntry
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the database version before update.
|
* Gets the database version before update.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getOldVersion(): string
|
public function getOldVersion(): string
|
||||||
{
|
{
|
||||||
|
@ -81,8 +77,6 @@ class DatabaseUpdatedLogEntry extends AbstractLogEntry
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the (target) database version after update.
|
* Gets the (target) database version after update.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getNewVersion(): string
|
public function getNewVersion(): string
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,8 +70,6 @@ class ElementCreatedLogEntry extends AbstractLogEntry implements LogWithCommentI
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the instock when the part was created.
|
* Gets the instock when the part was created.
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
public function getCreationInstockValue(): ?string
|
public function getCreationInstockValue(): ?string
|
||||||
{
|
{
|
||||||
|
@ -80,8 +78,6 @@ class ElementCreatedLogEntry extends AbstractLogEntry implements LogWithCommentI
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a creation instock value was saved with this entry.
|
* Checks if a creation instock value was saved with this entry.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function hasCreationInstockValue(): bool
|
public function hasCreationInstockValue(): bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -109,7 +109,7 @@ class ElementDeletedLogEntry extends AbstractLogEntry implements TimeTravelInter
|
||||||
|
|
||||||
public function hasOldDataInformations(): bool
|
public function hasOldDataInformations(): bool
|
||||||
{
|
{
|
||||||
return ! empty($this->extra['o']);
|
return !empty($this->extra['o']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOldData(): array
|
public function getOldData(): array
|
||||||
|
|
|
@ -65,8 +65,6 @@ class ElementEditedLogEntry extends AbstractLogEntry implements TimeTravelInterf
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if this log contains infos about which fields has changed.
|
* Checks if this log contains infos about which fields has changed.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function hasChangedFieldsInfo(): bool
|
public function hasChangedFieldsInfo(): bool
|
||||||
{
|
{
|
||||||
|
@ -115,7 +113,7 @@ class ElementEditedLogEntry extends AbstractLogEntry implements TimeTravelInterf
|
||||||
|
|
||||||
public function hasOldDataInformations(): bool
|
public function hasOldDataInformations(): bool
|
||||||
{
|
{
|
||||||
return ! empty($this->extra['d']);
|
return !empty($this->extra['d']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOldData(): array
|
public function getOldData(): array
|
||||||
|
|
|
@ -61,8 +61,6 @@ class ExceptionLogEntry extends AbstractLogEntry
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class name of the exception that caused this log entry.
|
* The class name of the exception that caused this log entry.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getExceptionClass(): string
|
public function getExceptionClass(): string
|
||||||
{
|
{
|
||||||
|
@ -71,8 +69,6 @@ class ExceptionLogEntry extends AbstractLogEntry
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the file where the exception happened.
|
* Returns the file where the exception happened.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getFile(): string
|
public function getFile(): string
|
||||||
{
|
{
|
||||||
|
@ -81,8 +77,6 @@ class ExceptionLogEntry extends AbstractLogEntry
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the line where the exception happened.
|
* Returns the line where the exception happened.
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
*/
|
||||||
public function getLine(): int
|
public function getLine(): int
|
||||||
{
|
{
|
||||||
|
@ -91,8 +85,6 @@ class ExceptionLogEntry extends AbstractLogEntry
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the message of the exception.
|
* Return the message of the exception.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getMessage(): string
|
public function getMessage(): string
|
||||||
{
|
{
|
||||||
|
|
|
@ -53,8 +53,6 @@ class InstockChangedLogEntry extends AbstractLogEntry
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the old instock.
|
* Get the old instock.
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
*/
|
||||||
public function getOldInstock(): int
|
public function getOldInstock(): int
|
||||||
{
|
{
|
||||||
|
@ -63,8 +61,6 @@ class InstockChangedLogEntry extends AbstractLogEntry
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the new instock.
|
* Get the new instock.
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
*/
|
||||||
public function getNewInstock(): int
|
public function getNewInstock(): int
|
||||||
{
|
{
|
||||||
|
@ -73,8 +69,6 @@ class InstockChangedLogEntry extends AbstractLogEntry
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the comment associated with the instock change.
|
* Gets the comment associated with the instock change.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getComment(): string
|
public function getComment(): string
|
||||||
{
|
{
|
||||||
|
@ -85,8 +79,6 @@ class InstockChangedLogEntry extends AbstractLogEntry
|
||||||
* Returns the price that has to be payed for the change (in the base currency).
|
* Returns the price that has to be payed for the change (in the base currency).
|
||||||
*
|
*
|
||||||
* @param bool $absolute Set this to true, if you want only get the absolute value of the price (without minus)
|
* @param bool $absolute Set this to true, if you want only get the absolute value of the price (without minus)
|
||||||
*
|
|
||||||
* @return float
|
|
||||||
*/
|
*/
|
||||||
public function getPrice(bool $absolute = false): float
|
public function getPrice(bool $absolute = false): float
|
||||||
{
|
{
|
||||||
|
@ -100,9 +92,9 @@ class InstockChangedLogEntry extends AbstractLogEntry
|
||||||
/**
|
/**
|
||||||
* Returns the difference value of the change ($new_instock - $old_instock).
|
* Returns the difference value of the change ($new_instock - $old_instock).
|
||||||
*
|
*
|
||||||
* @param bool $absolute Set this to true if you want only the absolute value of the difference.
|
* @param bool $absolute set this to true if you want only the absolute value of the difference
|
||||||
*
|
*
|
||||||
* @return int Difference is positive if instock has increased, negative if decreased.
|
* @return int difference is positive if instock has increased, negative if decreased
|
||||||
*/
|
*/
|
||||||
public function getDifference(bool $absolute = false): int
|
public function getDifference(bool $absolute = false): int
|
||||||
{
|
{
|
||||||
|
@ -122,7 +114,7 @@ class InstockChangedLogEntry extends AbstractLogEntry
|
||||||
/**
|
/**
|
||||||
* Checks if the Change was an withdrawal of parts.
|
* Checks if the Change was an withdrawal of parts.
|
||||||
*
|
*
|
||||||
* @return bool True if the change was an withdrawal, false if not.
|
* @return bool true if the change was an withdrawal, false if not
|
||||||
*/
|
*/
|
||||||
public function isWithdrawal(): bool
|
public function isWithdrawal(): bool
|
||||||
{
|
{
|
||||||
|
|
|
@ -59,7 +59,7 @@ class SecurityEventLogEntry extends AbstractLogEntry
|
||||||
|
|
||||||
public function setTargetElement(?AbstractDBElement $element): AbstractLogEntry
|
public function setTargetElement(?AbstractDBElement $element): AbstractLogEntry
|
||||||
{
|
{
|
||||||
if (! $element instanceof User) {
|
if (!$element instanceof User) {
|
||||||
throw new \InvalidArgumentException('Target element must be a User object!');
|
throw new \InvalidArgumentException('Target element must be a User object!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,8 +89,6 @@ class SecurityEventLogEntry extends AbstractLogEntry
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return what event this log entry represents (e.g. password_reset).
|
* Return what event this log entry represents (e.g. password_reset).
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getEventType(): string
|
public function getEventType(): string
|
||||||
{
|
{
|
||||||
|
@ -104,8 +102,6 @@ class SecurityEventLogEntry extends AbstractLogEntry
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the (anonymized) IP address used to login the user.
|
* Return the (anonymized) IP address used to login the user.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getIPAddress(): string
|
public function getIPAddress(): string
|
||||||
{
|
{
|
||||||
|
@ -115,7 +111,7 @@ class SecurityEventLogEntry extends AbstractLogEntry
|
||||||
/**
|
/**
|
||||||
* Sets the IP address used to login the user.
|
* Sets the IP address used to login the user.
|
||||||
*
|
*
|
||||||
* @param string $ip The IP address used to login the user.
|
* @param string $ip the IP address used to login the user
|
||||||
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
|
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
|
|
|
@ -63,8 +63,6 @@ class UserLoginLogEntry extends AbstractLogEntry
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the (anonymized) IP address used to login the user.
|
* Return the (anonymized) IP address used to login the user.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getIPAddress(): string
|
public function getIPAddress(): string
|
||||||
{
|
{
|
||||||
|
@ -74,7 +72,7 @@ class UserLoginLogEntry extends AbstractLogEntry
|
||||||
/**
|
/**
|
||||||
* Sets the IP address used to login the user.
|
* Sets the IP address used to login the user.
|
||||||
*
|
*
|
||||||
* @param string $ip The IP address used to login the user.
|
* @param string $ip the IP address used to login the user
|
||||||
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
|
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
|
|
|
@ -61,8 +61,6 @@ class UserLogoutLogEntry extends AbstractLogEntry
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the (anonymized) IP address used to login the user.
|
* Return the (anonymized) IP address used to login the user.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getIPAddress(): string
|
public function getIPAddress(): string
|
||||||
{
|
{
|
||||||
|
@ -72,7 +70,7 @@ class UserLogoutLogEntry extends AbstractLogEntry
|
||||||
/**
|
/**
|
||||||
* Sets the IP address used to login the user.
|
* Sets the IP address used to login the user.
|
||||||
*
|
*
|
||||||
* @param string $ip The IP address used to login the user.
|
* @param string $ip the IP address used to login the user
|
||||||
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
|
* @param bool $anonymize Anonymize the IP address (remove last block) to be GPDR compliant
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
|
|
|
@ -61,8 +61,6 @@ class UserNotAllowedLogEntry extends AbstractLogEntry
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the path the user tried to accessed and what was denied.
|
* Returns the path the user tried to accessed and what was denied.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getPath(): string
|
public function getPath(): string
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,7 +64,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
protected $symbol = '';
|
protected $symbol = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float|null The guaranteed minimum value of this property.
|
* @var float|null the guaranteed minimum value of this property
|
||||||
* @Assert\Type({"float","null"})
|
* @Assert\Type({"float","null"})
|
||||||
* @Assert\LessThanOrEqual(propertyPath="value_typical", message="parameters.validator.min_lesser_typical")
|
* @Assert\LessThanOrEqual(propertyPath="value_typical", message="parameters.validator.min_lesser_typical")
|
||||||
* @Assert\LessThan(propertyPath="value_max", message="parameters.validator.min_lesser_max")
|
* @Assert\LessThan(propertyPath="value_max", message="parameters.validator.min_lesser_max")
|
||||||
|
@ -73,14 +73,14 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
protected $value_min;
|
protected $value_min;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float|null The typical value of this property.
|
* @var float|null the typical value of this property
|
||||||
* @Assert\Type({"null", "float"})
|
* @Assert\Type({"null", "float"})
|
||||||
* @ORM\Column(type="float", nullable=true)
|
* @ORM\Column(type="float", nullable=true)
|
||||||
*/
|
*/
|
||||||
protected $value_typical;
|
protected $value_typical;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var float|null The maximum value of this property.
|
* @var float|null the maximum value of this property
|
||||||
* @Assert\Type({"float", "null"})
|
* @Assert\Type({"float", "null"})
|
||||||
* @Assert\GreaterThanOrEqual(propertyPath="value_typical", message="parameters.validator.max_greater_typical")
|
* @Assert\GreaterThanOrEqual(propertyPath="value_typical", message="parameters.validator.max_greater_typical")
|
||||||
* @ORM\Column(type="float", nullable=true)
|
* @ORM\Column(type="float", nullable=true)
|
||||||
|
@ -95,13 +95,13 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
protected $unit = '';
|
protected $unit = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string A text value for the given property.
|
* @var string a text value for the given property
|
||||||
* @ORM\Column(type="string", nullable=false)
|
* @ORM\Column(type="string", nullable=false)
|
||||||
*/
|
*/
|
||||||
protected $value_text = '';
|
protected $value_text = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string The group this parameter belongs to.
|
* @var string the group this parameter belongs to
|
||||||
* @ORM\Column(type="string", nullable=false, name="param_group")
|
* @ORM\Column(type="string", nullable=false, name="param_group")
|
||||||
*/
|
*/
|
||||||
protected $group = '';
|
protected $group = '';
|
||||||
|
@ -109,7 +109,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
/**
|
/**
|
||||||
* Mapping is done in sub classes.
|
* Mapping is done in sub classes.
|
||||||
*
|
*
|
||||||
* @var AbstractDBElement|null The element to which this parameter belongs to.
|
* @var AbstractDBElement|null the element to which this parameter belongs to
|
||||||
*/
|
*/
|
||||||
protected $element;
|
protected $element;
|
||||||
|
|
||||||
|
@ -130,8 +130,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the element this parameter belongs to.
|
* Returns the element this parameter belongs to.
|
||||||
*
|
|
||||||
* @return AbstractDBElement|null
|
|
||||||
*/
|
*/
|
||||||
public function getElement(): ?AbstractDBElement
|
public function getElement(): ?AbstractDBElement
|
||||||
{
|
{
|
||||||
|
@ -141,8 +139,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
/**
|
/**
|
||||||
* Return a formatted string version of the values of the string.
|
* Return a formatted string version of the values of the string.
|
||||||
* Based on the set values it can return something like this: 34 V (12 V ... 50 V) [Text].
|
* Based on the set values it can return something like this: 34 V (12 V ... 50 V) [Text].
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getFormattedValue(): string
|
public function getFormattedValue(): string
|
||||||
{
|
{
|
||||||
|
@ -188,7 +184,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
*/
|
*/
|
||||||
public function setElement(AbstractDBElement $element): self
|
public function setElement(AbstractDBElement $element): self
|
||||||
{
|
{
|
||||||
if (! is_a($element, static::ALLOWED_ELEMENT_CLASS)) {
|
if (!is_a($element, static::ALLOWED_ELEMENT_CLASS)) {
|
||||||
throw new InvalidArgumentException(sprintf('The element associated with a %s must be a %s!', static::class, static::ALLOWED_ELEMENT_CLASS));
|
throw new InvalidArgumentException(sprintf('The element associated with a %s must be a %s!', static::class, static::ALLOWED_ELEMENT_CLASS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,8 +207,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the name of the group this parameter is associated to (e.g. Technical Parameters).
|
* Returns the name of the group this parameter is associated to (e.g. Technical Parameters).
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getGroup(): string
|
public function getGroup(): string
|
||||||
{
|
{
|
||||||
|
@ -233,8 +227,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the mathematical symbol for this specification (e.g. "V_CB").
|
* Returns the mathematical symbol for this specification (e.g. "V_CB").
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getSymbol(): string
|
public function getSymbol(): string
|
||||||
{
|
{
|
||||||
|
@ -255,8 +247,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns The guaranteed minimum value of this property.
|
* Returns The guaranteed minimum value of this property.
|
||||||
*
|
|
||||||
* @return float|null
|
|
||||||
*/
|
*/
|
||||||
public function getValueMin(): ?float
|
public function getValueMin(): ?float
|
||||||
{
|
{
|
||||||
|
@ -277,8 +267,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the typical value of this property.
|
* Returns the typical value of this property.
|
||||||
*
|
|
||||||
* @return float|null
|
|
||||||
*/
|
*/
|
||||||
public function getValueTypical(): ?float
|
public function getValueTypical(): ?float
|
||||||
{
|
{
|
||||||
|
@ -287,8 +275,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a formatted version with the minimum value with the unit of this parameter.
|
* Return a formatted version with the minimum value with the unit of this parameter.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getValueTypicalWithUnit(): string
|
public function getValueTypicalWithUnit(): string
|
||||||
{
|
{
|
||||||
|
@ -297,8 +283,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a formatted version with the maximum value with the unit of this parameter.
|
* Return a formatted version with the maximum value with the unit of this parameter.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getValueMaxWithUnit(): string
|
public function getValueMaxWithUnit(): string
|
||||||
{
|
{
|
||||||
|
@ -307,8 +291,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a formatted version with the typical value with the unit of this parameter.
|
* Return a formatted version with the typical value with the unit of this parameter.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getValueMinWithUnit(): string
|
public function getValueMinWithUnit(): string
|
||||||
{
|
{
|
||||||
|
@ -331,8 +313,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the guaranteed maximum value.
|
* Returns the guaranteed maximum value.
|
||||||
*
|
|
||||||
* @return float|null
|
|
||||||
*/
|
*/
|
||||||
public function getValueMax(): ?float
|
public function getValueMax(): ?float
|
||||||
{
|
{
|
||||||
|
@ -353,8 +333,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the unit used by the value (e.g. "V").
|
* Returns the unit used by the value (e.g. "V").
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getUnit(): string
|
public function getUnit(): string
|
||||||
{
|
{
|
||||||
|
@ -375,8 +353,6 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the text value.
|
* Returns the text value.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getValueText(): string
|
public function getValueText(): string
|
||||||
{
|
{
|
||||||
|
@ -397,13 +373,11 @@ abstract class AbstractParameter extends AbstractNamedDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a string representation and (if possible) with its unit.
|
* Return a string representation and (if possible) with its unit.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
protected function formatWithUnit(float $value, string $format = '%g'): string
|
protected function formatWithUnit(float $value, string $format = '%g'): string
|
||||||
{
|
{
|
||||||
$str = \sprintf($format, $value);
|
$str = \sprintf($format, $value);
|
||||||
if (! empty($this->unit)) {
|
if (!empty($this->unit)) {
|
||||||
return $str.' '.$this->unit;
|
return $str.' '.$this->unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,6 @@ trait ParametersTrait
|
||||||
/**
|
/**
|
||||||
* Return all associated specifications.
|
* Return all associated specifications.
|
||||||
*
|
*
|
||||||
* @return Collection
|
|
||||||
*
|
|
||||||
* @psalm-return Collection<int, PartParameter>
|
* @psalm-return Collection<int, PartParameter>
|
||||||
*/
|
*/
|
||||||
public function getParameters(): \Doctrine\Common\Collections\Collection
|
public function getParameters(): \Doctrine\Common\Collections\Collection
|
||||||
|
|
|
@ -111,7 +111,6 @@ class Category extends AbstractPartsContainingDBElement
|
||||||
*/
|
*/
|
||||||
protected $parameters;
|
protected $parameters;
|
||||||
|
|
||||||
|
|
||||||
public function getPartnameHint(): string
|
public function getPartnameHint(): string
|
||||||
{
|
{
|
||||||
return $this->partname_hint;
|
return $this->partname_hint;
|
||||||
|
|
|
@ -99,7 +99,6 @@ class Footprint extends AbstractPartsContainingDBElement
|
||||||
*/
|
*/
|
||||||
protected $parameters;
|
protected $parameters;
|
||||||
|
|
||||||
|
|
||||||
/****************************************
|
/****************************************
|
||||||
* Getters
|
* Getters
|
||||||
****************************************/
|
****************************************/
|
||||||
|
|
|
@ -109,7 +109,6 @@ class MeasurementUnit extends AbstractPartsContainingDBElement
|
||||||
*/
|
*/
|
||||||
protected $parameters;
|
protected $parameters;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -176,7 +176,6 @@ class Part extends AttachmentContainingDBElement
|
||||||
parent::__clone();
|
parent::__clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all devices which uses this part.
|
* Get all devices which uses this part.
|
||||||
*
|
*
|
||||||
|
|
|
@ -73,7 +73,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
||||||
protected $description = '';
|
protected $description = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string A comment stored with this lot.
|
* @var string a comment stored with this lot
|
||||||
* @ORM\Column(type="text")
|
* @ORM\Column(type="text")
|
||||||
*/
|
*/
|
||||||
protected $comment = '';
|
protected $comment = '';
|
||||||
|
@ -107,7 +107,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
||||||
protected $amount = 0;
|
protected $amount = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool Determines if this lot was manually marked for refilling.
|
* @var bool determines if this lot was manually marked for refilling
|
||||||
* @ORM\Column(type="boolean")
|
* @ORM\Column(type="boolean")
|
||||||
*/
|
*/
|
||||||
protected $needs_refill = false;
|
protected $needs_refill = false;
|
||||||
|
@ -128,7 +128,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
||||||
parent::__clone();
|
parent::__clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the current part lot is expired.
|
* Check if the current part lot is expired.
|
||||||
* This is the case, if the expiration date is greater the the current date.
|
* This is the case, if the expiration date is greater the the current date.
|
||||||
|
@ -149,8 +148,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the description of the part lot. Similar to a "name" of the part lot.
|
* Gets the description of the part lot. Similar to a "name" of the part lot.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getDescription(): string
|
public function getDescription(): string
|
||||||
{
|
{
|
||||||
|
@ -171,8 +168,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the comment for this part lot.
|
* Gets the comment for this part lot.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getComment(): string
|
public function getComment(): string
|
||||||
{
|
{
|
||||||
|
@ -193,8 +188,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the expiration date for the part lot. Returns null, if no expiration date was set.
|
* Gets the expiration date for the part lot. Returns null, if no expiration date was set.
|
||||||
*
|
|
||||||
* @return DateTime|null
|
|
||||||
*/
|
*/
|
||||||
public function getExpirationDate(): ?DateTime
|
public function getExpirationDate(): ?DateTime
|
||||||
{
|
{
|
||||||
|
@ -239,8 +232,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the part that is stored in this part lot.
|
* Return the part that is stored in this part lot.
|
||||||
*
|
|
||||||
* @return Part
|
|
||||||
*/
|
*/
|
||||||
public function getPart(): Part
|
public function getPart(): Part
|
||||||
{
|
{
|
||||||
|
@ -261,8 +252,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the instock value in the part lot is unknown.
|
* Checks if the instock value in the part lot is unknown.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function isInstockUnknown(): bool
|
public function isInstockUnknown(): bool
|
||||||
{
|
{
|
||||||
|
@ -281,12 +270,9 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return float
|
|
||||||
*/
|
|
||||||
public function getAmount(): float
|
public function getAmount(): float
|
||||||
{
|
{
|
||||||
if ($this->part instanceof Part && ! $this->part->useFloatAmount()) {
|
if ($this->part instanceof Part && !$this->part->useFloatAmount()) {
|
||||||
return round($this->amount);
|
return round($this->amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,9 +298,6 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function isNeedsRefill(): bool
|
public function isNeedsRefill(): bool
|
||||||
{
|
{
|
||||||
return $this->needs_refill;
|
return $this->needs_refill;
|
||||||
|
|
|
@ -162,7 +162,7 @@ trait InstockTrait
|
||||||
public function useFloatAmount(): bool
|
public function useFloatAmount(): bool
|
||||||
{
|
{
|
||||||
if ($this->partUnit instanceof MeasurementUnit) {
|
if ($this->partUnit instanceof MeasurementUnit) {
|
||||||
return ! $this->partUnit->isInteger();
|
return !$this->partUnit->isInteger();
|
||||||
}
|
}
|
||||||
|
|
||||||
//When no part unit is set, treat it as part count, and so use the integer value.
|
//When no part unit is set, treat it as part count, and so use the integer value.
|
||||||
|
|
|
@ -213,7 +213,7 @@ trait OrderTrait
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($all_orderdetails as $orderdetails) {
|
foreach ($all_orderdetails as $orderdetails) {
|
||||||
if (! $orderdetails->getObsolete()) {
|
if (!$orderdetails->getObsolete()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,8 +136,6 @@ class Storelocation extends AbstractPartsContainingDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When this property is set, only one part (but many instock) is allowed to be stored in this store location.
|
* When this property is set, only one part (but many instock) is allowed to be stored in this store location.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function isOnlySinglePart(): bool
|
public function isOnlySinglePart(): bool
|
||||||
{
|
{
|
||||||
|
@ -156,8 +154,6 @@ class Storelocation extends AbstractPartsContainingDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When this property is set, it is only possible to increase the instock of parts, that are already stored here.
|
* When this property is set, it is only possible to increase the instock of parts, that are already stored here.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function isLimitToExistingParts(): bool
|
public function isLimitToExistingParts(): bool
|
||||||
{
|
{
|
||||||
|
@ -174,9 +170,6 @@ class Storelocation extends AbstractPartsContainingDBElement
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return MeasurementUnit|null
|
|
||||||
*/
|
|
||||||
public function getStorageType(): ?MeasurementUnit
|
public function getStorageType(): ?MeasurementUnit
|
||||||
{
|
{
|
||||||
return $this->storage_type;
|
return $this->storage_type;
|
||||||
|
|
|
@ -57,7 +57,6 @@ use App\Entity\PriceInformations\Currency;
|
||||||
use App\Validator\Constraints\BigDecimal\BigDecimalPositiveOrZero;
|
use App\Validator\Constraints\BigDecimal\BigDecimalPositiveOrZero;
|
||||||
use App\Validator\Constraints\Selectable;
|
use App\Validator\Constraints\Selectable;
|
||||||
use Brick\Math\BigDecimal;
|
use Brick\Math\BigDecimal;
|
||||||
use Brick\Math\BigNumber;
|
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
@ -120,8 +119,6 @@ class Supplier extends AbstractCompany
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the currency that should be used by default, when creating a orderdetail with this supplier.
|
* Gets the currency that should be used by default, when creating a orderdetail with this supplier.
|
||||||
*
|
|
||||||
* @return Currency|null
|
|
||||||
*/
|
*/
|
||||||
public function getDefaultCurrency(): ?Currency
|
public function getDefaultCurrency(): ?Currency
|
||||||
{
|
{
|
||||||
|
@ -159,7 +156,7 @@ class Supplier extends AbstractCompany
|
||||||
*/
|
*/
|
||||||
public function setShippingCosts(?BigDecimal $shipping_costs): self
|
public function setShippingCosts(?BigDecimal $shipping_costs): self
|
||||||
{
|
{
|
||||||
if ($shipping_costs === null) {
|
if (null === $shipping_costs) {
|
||||||
$this->shipping_costs = null;
|
$this->shipping_costs = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@ use Brick\Math\RoundingMode;
|
||||||
use Doctrine\Common\Collections\ArrayCollection;
|
use Doctrine\Common\Collections\ArrayCollection;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use DoctrineExtensions\Query\Mysql\Round;
|
|
||||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
|
|
||||||
|
@ -68,7 +67,7 @@ class Currency extends AbstractStructuralDBElement
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var BigDecimal|null The exchange rate between this currency and the base currency
|
* @var BigDecimal|null The exchange rate between this currency and the base currency
|
||||||
* (how many base units the current currency is worth)
|
* (how many base units the current currency is worth)
|
||||||
* @ORM\Column(type="big_decimal", precision=11, scale=5, nullable=true)
|
* @ORM\Column(type="big_decimal", precision=11, scale=5, nullable=true)
|
||||||
* @BigDecimalPositive()
|
* @BigDecimalPositive()
|
||||||
*/
|
*/
|
||||||
|
@ -119,9 +118,6 @@ class Currency extends AbstractStructuralDBElement
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return Collection
|
|
||||||
*/
|
|
||||||
public function getPricedetails(): Collection
|
public function getPricedetails(): Collection
|
||||||
{
|
{
|
||||||
return $this->pricedetails;
|
return $this->pricedetails;
|
||||||
|
@ -176,13 +172,13 @@ class Currency extends AbstractStructuralDBElement
|
||||||
* Sets the exchange rate of the currency.
|
* Sets the exchange rate of the currency.
|
||||||
*
|
*
|
||||||
* @param BigDecimal|null $exchange_rate The new exchange rate of the currency.
|
* @param BigDecimal|null $exchange_rate The new exchange rate of the currency.
|
||||||
* Set to null, if the exchange rate is unknown.
|
* Set to null, if the exchange rate is unknown.
|
||||||
*
|
*
|
||||||
* @return Currency
|
* @return Currency
|
||||||
*/
|
*/
|
||||||
public function setExchangeRate(?BigDecimal $exchange_rate): self
|
public function setExchangeRate(?BigDecimal $exchange_rate): self
|
||||||
{
|
{
|
||||||
if ($exchange_rate === null) {
|
if (null === $exchange_rate) {
|
||||||
$this->exchange_rate = null;
|
$this->exchange_rate = null;
|
||||||
}
|
}
|
||||||
$tmp = $exchange_rate->toScale(self::PRICE_SCALE, RoundingMode::HALF_UP);
|
$tmp = $exchange_rate->toScale(self::PRICE_SCALE, RoundingMode::HALF_UP);
|
||||||
|
|
|
@ -209,7 +209,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
||||||
*/
|
*/
|
||||||
public function getPriceRelatedQuantity(): float
|
public function getPriceRelatedQuantity(): float
|
||||||
{
|
{
|
||||||
if ($this->orderdetail && $this->orderdetail->getPart() && ! $this->orderdetail->getPart()->useFloatAmount()) {
|
if ($this->orderdetail && $this->orderdetail->getPart() && !$this->orderdetail->getPart()->useFloatAmount()) {
|
||||||
$tmp = round($this->price_related_quantity);
|
$tmp = round($this->price_related_quantity);
|
||||||
|
|
||||||
return $tmp < 1 ? 1 : $tmp;
|
return $tmp < 1 ? 1 : $tmp;
|
||||||
|
@ -232,7 +232,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
||||||
*/
|
*/
|
||||||
public function getMinDiscountQuantity(): float
|
public function getMinDiscountQuantity(): float
|
||||||
{
|
{
|
||||||
if ($this->orderdetail && $this->orderdetail->getPart() && ! $this->orderdetail->getPart()->useFloatAmount()) {
|
if ($this->orderdetail && $this->orderdetail->getPart() && !$this->orderdetail->getPart()->useFloatAmount()) {
|
||||||
$tmp = round($this->min_discount_quantity);
|
$tmp = round($this->min_discount_quantity);
|
||||||
|
|
||||||
return $tmp < 1 ? 1 : $tmp;
|
return $tmp < 1 ? 1 : $tmp;
|
||||||
|
@ -299,6 +299,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface
|
||||||
if ((string) $tmp !== (string) $this->price) {
|
if ((string) $tmp !== (string) $this->price) {
|
||||||
$this->price = $tmp;
|
$this->price = $tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,6 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
||||||
*/
|
*/
|
||||||
protected $parameters;
|
protected $parameters;
|
||||||
|
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
@ -113,8 +112,6 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the users of this group are enforced to have two factor authentification (2FA) enabled.
|
* Check if the users of this group are enforced to have two factor authentification (2FA) enabled.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function isEnforce2FA(): bool
|
public function isEnforce2FA(): bool
|
||||||
{
|
{
|
||||||
|
@ -124,7 +121,7 @@ class Group extends AbstractStructuralDBElement implements HasPermissionsInterfa
|
||||||
/**
|
/**
|
||||||
* Sets if the user of this group are enforced to have two factor authentification enabled.
|
* Sets if the user of this group are enforced to have two factor authentification enabled.
|
||||||
*
|
*
|
||||||
* @param bool $enforce2FA True, if the users of this group are enforced to have 2FA enabled.
|
* @param bool $enforce2FA true, if the users of this group are enforced to have 2FA enabled
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -340,7 +340,7 @@ class PermissionsEmbed
|
||||||
*/
|
*/
|
||||||
public function getBitValue(string $permission_name, int $bit_n): int
|
public function getBitValue(string $permission_name, int $bit_n): int
|
||||||
{
|
{
|
||||||
if (! $this->isValidPermissionName($permission_name)) {
|
if (!$this->isValidPermissionName($permission_name)) {
|
||||||
throw new InvalidArgumentException(sprintf('No permission with the name "%s" is existing!', $permission_name));
|
throw new InvalidArgumentException(sprintf('No permission with the name "%s" is existing!', $permission_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ class PermissionsEmbed
|
||||||
*/
|
*/
|
||||||
public function setBitValue(string $permission_name, int $bit_n, int $new_value): self
|
public function setBitValue(string $permission_name, int $bit_n, int $new_value): self
|
||||||
{
|
{
|
||||||
if (! $this->isValidPermissionName($permission_name)) {
|
if (!$this->isValidPermissionName($permission_name)) {
|
||||||
throw new InvalidArgumentException('No permission with the given name is existing!');
|
throw new InvalidArgumentException('No permission with the given name is existing!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,7 +429,7 @@ class PermissionsEmbed
|
||||||
*/
|
*/
|
||||||
public function getRawPermissionValue(string $permission_name): int
|
public function getRawPermissionValue(string $permission_name): int
|
||||||
{
|
{
|
||||||
if (! $this->isValidPermissionName($permission_name)) {
|
if (!$this->isValidPermissionName($permission_name)) {
|
||||||
throw new InvalidArgumentException('No permission with the given name is existing!');
|
throw new InvalidArgumentException('No permission with the given name is existing!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -446,7 +446,7 @@ class PermissionsEmbed
|
||||||
*/
|
*/
|
||||||
public function setRawPermissionValue(string $permission_name, int $value): self
|
public function setRawPermissionValue(string $permission_name, int $value): self
|
||||||
{
|
{
|
||||||
if (! $this->isValidPermissionName($permission_name)) {
|
if (!$this->isValidPermissionName($permission_name)) {
|
||||||
throw new InvalidArgumentException(sprintf('No permission with the given name %s is existing!', $permission_name));
|
throw new InvalidArgumentException(sprintf('No permission with the given name %s is existing!', $permission_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,7 +466,7 @@ class PermissionsEmbed
|
||||||
*/
|
*/
|
||||||
public function setRawPermissionValues(array $values, ?array $values2 = null): self
|
public function setRawPermissionValues(array $values, ?array $values2 = null): self
|
||||||
{
|
{
|
||||||
if (! empty($values2)) {
|
if (!empty($values2)) {
|
||||||
$values = array_combine($values, $values2);
|
$values = array_combine($values, $values2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -493,6 +493,7 @@ class PermissionsEmbed
|
||||||
}
|
}
|
||||||
|
|
||||||
$mask = 0b11 << $n; //Create a mask for the data
|
$mask = 0b11 << $n; //Create a mask for the data
|
||||||
|
|
||||||
return ($data & $mask) >> $n; //Apply mask and shift back
|
return ($data & $mask) >> $n; //Apply mask and shift back
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -180,8 +180,6 @@ class U2FKey implements TwoFactorKeyInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the user, this U2F key belongs to.
|
* Gets the user, this U2F key belongs to.
|
||||||
*
|
|
||||||
* @return User
|
|
||||||
*/
|
*/
|
||||||
public function getUser(): User
|
public function getUser(): User
|
||||||
{
|
{
|
||||||
|
@ -190,8 +188,6 @@ class U2FKey implements TwoFactorKeyInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The primary key ID of this key.
|
* The primary key ID of this key.
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
*/
|
||||||
public function getID(): int
|
public function getID(): int
|
||||||
{
|
{
|
||||||
|
|
|
@ -110,7 +110,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
protected $theme = '';
|
protected $theme = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string|null The hash of a token the user must provide when he wants to reset his password.
|
* @var string|null the hash of a token the user must provide when he wants to reset his password
|
||||||
* @ORM\Column(type="string", nullable=true)
|
* @ORM\Column(type="string", nullable=true)
|
||||||
*/
|
*/
|
||||||
protected $pw_reset_token;
|
protected $pw_reset_token;
|
||||||
|
@ -261,7 +261,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
protected $permissions;
|
protected $permissions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var DateTime The time until the password reset token is valid.
|
* @var DateTime the time until the password reset token is valid
|
||||||
* @ORM\Column(type="datetime", nullable=true)
|
* @ORM\Column(type="datetime", nullable=true)
|
||||||
*/
|
*/
|
||||||
protected $pw_reset_expires;
|
protected $pw_reset_expires;
|
||||||
|
@ -367,7 +367,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
/**
|
/**
|
||||||
* Gets the currency the user prefers when showing him prices.
|
* Gets the currency the user prefers when showing him prices.
|
||||||
*
|
*
|
||||||
* @return Currency|null The currency the user prefers, or null if the global currency should be used.
|
* @return Currency|null the currency the user prefers, or null if the global currency should be used
|
||||||
*/
|
*/
|
||||||
public function getCurrency(): ?Currency
|
public function getCurrency(): ?Currency
|
||||||
{
|
{
|
||||||
|
@ -389,7 +389,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
/**
|
/**
|
||||||
* Checks if this user is disabled (user cannot login any more).
|
* Checks if this user is disabled (user cannot login any more).
|
||||||
*
|
*
|
||||||
* @return bool True, if the user is disabled.
|
* @return bool true, if the user is disabled
|
||||||
*/
|
*/
|
||||||
public function isDisabled(): bool
|
public function isDisabled(): bool
|
||||||
{
|
{
|
||||||
|
@ -399,7 +399,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
/**
|
/**
|
||||||
* Sets the status if a user is disabled.
|
* Sets the status if a user is disabled.
|
||||||
*
|
*
|
||||||
* @param bool $disabled True if the user should be disabled.
|
* @param bool $disabled true if the user should be disabled
|
||||||
*
|
*
|
||||||
* @return User
|
* @return User
|
||||||
*/
|
*/
|
||||||
|
@ -410,7 +410,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function getPermissions(): PermissionsEmbed
|
public function getPermissions(): PermissionsEmbed
|
||||||
{
|
{
|
||||||
return $this->permissions;
|
return $this->permissions;
|
||||||
|
@ -418,8 +417,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the user needs a password change.
|
* Check if the user needs a password change.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function isNeedPwChange(): bool
|
public function isNeedPwChange(): bool
|
||||||
{
|
{
|
||||||
|
@ -440,8 +437,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the encrypted password reset token.
|
* Returns the encrypted password reset token.
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
public function getPwResetToken(): ?string
|
public function getPwResetToken(): ?string
|
||||||
{
|
{
|
||||||
|
@ -462,8 +457,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the datetime when the password reset token expires.
|
* Gets the datetime when the password reset token expires.
|
||||||
*
|
|
||||||
* @return DateTime
|
|
||||||
*/
|
*/
|
||||||
public function getPwResetExpires(): DateTime
|
public function getPwResetExpires(): DateTime
|
||||||
{
|
{
|
||||||
|
@ -498,7 +491,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
{
|
{
|
||||||
$tmp = $this->getFirstName();
|
$tmp = $this->getFirstName();
|
||||||
//Dont add a space, if the name has only one part (it would look strange)
|
//Dont add a space, if the name has only one part (it would look strange)
|
||||||
if (! empty($this->getFirstName()) && ! empty($this->getLastName())) {
|
if (!empty($this->getFirstName()) && !empty($this->getLastName())) {
|
||||||
$tmp .= ' ';
|
$tmp .= ' ';
|
||||||
}
|
}
|
||||||
$tmp .= $this->getLastName();
|
$tmp .= $this->getLastName();
|
||||||
|
@ -513,14 +506,14 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
/**
|
/**
|
||||||
* Change the username of this user.
|
* Change the username of this user.
|
||||||
*
|
*
|
||||||
* @param string $new_name The new username.
|
* @param string $new_name the new username
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setName(string $new_name): AbstractNamedDBElement
|
public function setName(string $new_name): AbstractNamedDBElement
|
||||||
{
|
{
|
||||||
// Anonymous user is not allowed to change its username
|
// Anonymous user is not allowed to change its username
|
||||||
if (! $this->isAnonymousUser()) {
|
if (!$this->isAnonymousUser()) {
|
||||||
$this->name = $new_name;
|
$this->name = $new_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,8 +522,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the first name of the user.
|
* Get the first name of the user.
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
public function getFirstName(): ?string
|
public function getFirstName(): ?string
|
||||||
{
|
{
|
||||||
|
@ -553,8 +544,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the last name of the user.
|
* Get the last name of the user.
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
public function getLastName(): ?string
|
public function getLastName(): ?string
|
||||||
{
|
{
|
||||||
|
@ -675,7 +664,7 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
/**
|
/**
|
||||||
* Gets the theme the users wants to see. See self::AVAILABLE_THEMES for valid values.
|
* Gets the theme the users wants to see. See self::AVAILABLE_THEMES for valid values.
|
||||||
*
|
*
|
||||||
* @return string|null The name of the theme the user wants to see, or null if the system wide should be used.
|
* @return string|null the name of the theme the user wants to see, or null if the system wide should be used
|
||||||
*/
|
*/
|
||||||
public function getTheme(): ?string
|
public function getTheme(): ?string
|
||||||
{
|
{
|
||||||
|
@ -723,8 +712,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return true if the user should do two-factor authentication.
|
* Return true if the user should do two-factor authentication.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function isGoogleAuthenticatorEnabled(): bool
|
public function isGoogleAuthenticatorEnabled(): bool
|
||||||
{
|
{
|
||||||
|
@ -733,8 +720,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the user name that should be shown in Google Authenticator.
|
* Return the user name that should be shown in Google Authenticator.
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
*/
|
||||||
public function getGoogleAuthenticatorUsername(): string
|
public function getGoogleAuthenticatorUsername(): string
|
||||||
{
|
{
|
||||||
|
@ -744,8 +729,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
/**
|
/**
|
||||||
* Return the Google Authenticator secret
|
* Return the Google Authenticator secret
|
||||||
* When an empty string is returned, the Google authentication is disabled.
|
* When an empty string is returned, the Google authentication is disabled.
|
||||||
*
|
|
||||||
* @return string|null
|
|
||||||
*/
|
*/
|
||||||
public function getGoogleAuthenticatorSecret(): ?string
|
public function getGoogleAuthenticatorSecret(): ?string
|
||||||
{
|
{
|
||||||
|
@ -767,9 +750,9 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
/**
|
/**
|
||||||
* Check if the given code is a valid backup code.
|
* Check if the given code is a valid backup code.
|
||||||
*
|
*
|
||||||
* @param string $code The code that should be checked.
|
* @param string $code the code that should be checked
|
||||||
*
|
*
|
||||||
* @return bool True if the backup code is valid.
|
* @return bool true if the backup code is valid
|
||||||
*/
|
*/
|
||||||
public function isBackupCode(string $code): bool
|
public function isBackupCode(string $code): bool
|
||||||
{
|
{
|
||||||
|
@ -822,8 +805,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the date when the backup codes were generated.
|
* Return the date when the backup codes were generated.
|
||||||
*
|
|
||||||
* @return DateTime|null
|
|
||||||
*/
|
*/
|
||||||
public function getBackupCodesGenerationDate(): ?DateTime
|
public function getBackupCodesGenerationDate(): ?DateTime
|
||||||
{
|
{
|
||||||
|
@ -851,8 +832,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if U2F is enabled.
|
* Check if U2F is enabled.
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function isU2FAuthEnabled(): bool
|
public function isU2FAuthEnabled(): bool
|
||||||
{
|
{
|
||||||
|
@ -862,8 +841,6 @@ class User extends AttachmentContainingDBElement implements UserInterface, HasPe
|
||||||
/**
|
/**
|
||||||
* Get all U2F Keys that are associated with this user.
|
* Get all U2F Keys that are associated with this user.
|
||||||
*
|
*
|
||||||
* @return Collection
|
|
||||||
*
|
|
||||||
* @psalm-return Collection<int, TwoFactorKeyInterface>
|
* @psalm-return Collection<int, TwoFactorKeyInterface>
|
||||||
*/
|
*/
|
||||||
public function getU2FKeys(): Collection
|
public function getU2FKeys(): Collection
|
||||||
|
|
|
@ -99,6 +99,7 @@ class AttachmentDeleteListener
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ensure that attachments are not used in preview, so that they can be deleted (without integrity violation).
|
* Ensure that attachments are not used in preview, so that they can be deleted (without integrity violation).
|
||||||
|
*
|
||||||
* @ORM\PreRemove()
|
* @ORM\PreRemove()
|
||||||
*/
|
*/
|
||||||
public function preRemoveHandler(Attachment $attachment, LifecycleEventArgs $event): void
|
public function preRemoveHandler(Attachment $attachment, LifecycleEventArgs $event): void
|
||||||
|
@ -106,7 +107,7 @@ class AttachmentDeleteListener
|
||||||
//Ensure that the attachment that will be deleted, is not used as preview picture anymore...
|
//Ensure that the attachment that will be deleted, is not used as preview picture anymore...
|
||||||
$attachment_holder = $attachment->getElement();
|
$attachment_holder = $attachment->getElement();
|
||||||
|
|
||||||
if ($attachment_holder === null) {
|
if (null === $attachment_holder) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -200,8 +200,6 @@ class EventLoggerSubscriber implements EventSubscriber
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the field of the given element should be saved (if it is not blacklisted).
|
* Checks if the field of the given element should be saved (if it is not blacklisted).
|
||||||
*
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public function shouldFieldBeSaved(AbstractDBElement $element, string $field_name): bool
|
public function shouldFieldBeSaved(AbstractDBElement $element, string $field_name): bool
|
||||||
{
|
{
|
||||||
|
@ -297,14 +295,12 @@ class EventLoggerSubscriber implements EventSubscriber
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filter out every forbidden field and return the cleaned array.
|
* Filter out every forbidden field and return the cleaned array.
|
||||||
*
|
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
protected function filterFieldRestrictions(AbstractDBElement $element, array $fields): array
|
protected function filterFieldRestrictions(AbstractDBElement $element, array $fields): array
|
||||||
{
|
{
|
||||||
unset($fields['lastModified']);
|
unset($fields['lastModified']);
|
||||||
|
|
||||||
if (! $this->hasFieldRestrictions($element)) {
|
if (!$this->hasFieldRestrictions($element)) {
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -322,7 +318,7 @@ class EventLoggerSubscriber implements EventSubscriber
|
||||||
{
|
{
|
||||||
$uow = $em->getUnitOfWork();
|
$uow = $em->getUnitOfWork();
|
||||||
|
|
||||||
if (! $logEntry instanceof ElementEditedLogEntry && ! $logEntry instanceof ElementDeletedLogEntry) {
|
if (!$logEntry instanceof ElementEditedLogEntry && !$logEntry instanceof ElementDeletedLogEntry) {
|
||||||
throw new \InvalidArgumentException('$logEntry must be ElementEditedLogEntry or ElementDeletedLogEntry!');
|
throw new \InvalidArgumentException('$logEntry must be ElementEditedLogEntry or ElementDeletedLogEntry!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,12 +345,12 @@ class EventLoggerSubscriber implements EventSubscriber
|
||||||
/**
|
/**
|
||||||
* Check if the given entity can be logged.
|
* Check if the given entity can be logged.
|
||||||
*
|
*
|
||||||
* @return bool True, if the given entity can be logged.
|
* @return bool true, if the given entity can be logged
|
||||||
*/
|
*/
|
||||||
protected function validEntity(object $entity): bool
|
protected function validEntity(object $entity): bool
|
||||||
{
|
{
|
||||||
//Dont log logentries itself!
|
//Dont log logentries itself!
|
||||||
if ($entity instanceof AbstractDBElement && ! $entity instanceof AbstractLogEntry) {
|
if ($entity instanceof AbstractDBElement && !$entity instanceof AbstractLogEntry) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class LogAccessDeniedSubscriber implements EventSubscriberInterface
|
||||||
$throwable = $throwable->getPrevious();
|
$throwable = $throwable->getPrevious();
|
||||||
}
|
}
|
||||||
//Ignore everything except AccessDeniedExceptions
|
//Ignore everything except AccessDeniedExceptions
|
||||||
if (! $throwable instanceof AccessDeniedException) {
|
if (!$throwable instanceof AccessDeniedException) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,6 @@ use Doctrine\Common\EventSubscriber;
|
||||||
use Doctrine\Migrations\DependencyFactory;
|
use Doctrine\Migrations\DependencyFactory;
|
||||||
use Doctrine\Migrations\Event\MigrationsEventArgs;
|
use Doctrine\Migrations\Event\MigrationsEventArgs;
|
||||||
use Doctrine\Migrations\Events;
|
use Doctrine\Migrations\Events;
|
||||||
use Doctrine\Migrations\Version\AliasResolver;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This subscriber logs databaseMigrations to Event log.
|
* This subscriber logs databaseMigrations to Event log.
|
||||||
|
|
|
@ -45,11 +45,7 @@ namespace App\EventSubscriber\LogSystem;
|
||||||
use App\Entity\LogSystem\UserLogoutLogEntry;
|
use App\Entity\LogSystem\UserLogoutLogEntry;
|
||||||
use App\Entity\UserSystem\User;
|
use App\Entity\UserSystem\User;
|
||||||
use App\Services\LogSystem\EventLogger;
|
use App\Services\LogSystem\EventLogger;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
|
|
||||||
use Symfony\Component\Security\Http\Event\LogoutEvent;
|
use Symfony\Component\Security\Http\Event\LogoutEvent;
|
||||||
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This handler logs to event log, if a user logs out.
|
* This handler logs to event log, if a user logs out.
|
||||||
|
@ -65,13 +61,12 @@ class LogoutLoggerListener
|
||||||
$this->gpdr_compliance = $gpdr_compliance;
|
$this->gpdr_compliance = $gpdr_compliance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function __invoke(LogoutEvent $event)
|
public function __invoke(LogoutEvent $event)
|
||||||
{
|
{
|
||||||
$request = $event->getRequest();
|
$request = $event->getRequest();
|
||||||
$token = $event->getToken();
|
$token = $event->getToken();
|
||||||
|
|
||||||
if ($token === null) {
|
if (null === $token) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ final class SymfonyDebugToolbarSubscriber implements EventSubscriberInterface
|
||||||
|
|
||||||
public function onKernelResponse(ResponseEvent $event): void
|
public function onKernelResponse(ResponseEvent $event): void
|
||||||
{
|
{
|
||||||
if (! $this->kernel_debug) {
|
if (!$this->kernel_debug) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,6 @@ namespace App\EventSubscriber\UserSystem;
|
||||||
|
|
||||||
use App\Entity\UserSystem\User;
|
use App\Entity\UserSystem\User;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
|
|
||||||
use Symfony\Component\HttpFoundation\Session\Session;
|
use Symfony\Component\HttpFoundation\Session\Session;
|
||||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||||
use Symfony\Component\HttpKernel\Event\RequestEvent;
|
use Symfony\Component\HttpKernel\Event\RequestEvent;
|
||||||
|
@ -97,15 +96,15 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface
|
||||||
$user = $this->security->getUser();
|
$user = $this->security->getUser();
|
||||||
$request = $event->getRequest();
|
$request = $event->getRequest();
|
||||||
|
|
||||||
if (! $event->isMasterRequest()) {
|
if (!$event->isMasterRequest()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (! $user instanceof User) {
|
if (!$user instanceof User) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Abort if we dont need to redirect the user.
|
//Abort if we dont need to redirect the user.
|
||||||
if (! $user->isNeedPwChange() && ! static::TFARedirectNeeded($user)) {
|
if (!$user->isNeedPwChange() && !static::TFARedirectNeeded($user)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,15 +139,15 @@ final class PasswordChangeNeededSubscriber implements EventSubscriberInterface
|
||||||
* That is the case if the group of the user enforces 2FA, but the user has neither Google Authenticator nor an
|
* That is the case if the group of the user enforces 2FA, but the user has neither Google Authenticator nor an
|
||||||
* U2F key setup.
|
* U2F key setup.
|
||||||
*
|
*
|
||||||
* @param User $user The user for which should be checked if it needs to be redirected.
|
* @param User $user the user for which should be checked if it needs to be redirected
|
||||||
*
|
*
|
||||||
* @return bool True if the user needs to be redirected.
|
* @return bool true if the user needs to be redirected
|
||||||
*/
|
*/
|
||||||
public static function TFARedirectNeeded(User $user): bool
|
public static function TFARedirectNeeded(User $user): bool
|
||||||
{
|
{
|
||||||
$tfa_enabled = $user->isU2FAuthEnabled() || $user->isGoogleAuthenticatorEnabled();
|
$tfa_enabled = $user->isU2FAuthEnabled() || $user->isGoogleAuthenticatorEnabled();
|
||||||
|
|
||||||
if (null !== $user->getGroup() && $user->getGroup()->isEnforce2FA() && ! $tfa_enabled) {
|
if (null !== $user->getGroup() && $user->getGroup()->isEnforce2FA() && !$tfa_enabled) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@ use R\U2FTwoFactorBundle\Event\RegisterEvent;
|
||||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||||
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;
|
|
||||||
use Symfony\Component\HttpFoundation\Session\Session;
|
use Symfony\Component\HttpFoundation\Session\Session;
|
||||||
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
use Symfony\Component\HttpFoundation\Session\SessionInterface;
|
||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
@ -96,9 +95,9 @@ final class RegisterU2FSubscriber implements EventSubscriberInterface
|
||||||
public function onRegister(RegisterEvent $event): void
|
public function onRegister(RegisterEvent $event): void
|
||||||
{
|
{
|
||||||
//Skip adding of U2F key on demo mode
|
//Skip adding of U2F key on demo mode
|
||||||
if (! $this->demo_mode) {
|
if (!$this->demo_mode) {
|
||||||
$user = $event->getUser();
|
$user = $event->getUser();
|
||||||
if (! $user instanceof User) {
|
if (!$user instanceof User) {
|
||||||
throw new \InvalidArgumentException('Only User objects can be registered for U2F!');
|
throw new \InvalidArgumentException('Only User objects can be registered for U2F!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,12 +68,12 @@ final class SetUserTimezoneSubscriber implements EventSubscriberInterface
|
||||||
|
|
||||||
//Check if the user has set a timezone
|
//Check if the user has set a timezone
|
||||||
$user = $this->security->getUser();
|
$user = $this->security->getUser();
|
||||||
if ($user instanceof User && ! empty($user->getTimezone())) {
|
if ($user instanceof User && !empty($user->getTimezone())) {
|
||||||
$timezone = $user->getTimezone();
|
$timezone = $user->getTimezone();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Fill with default value if needed
|
//Fill with default value if needed
|
||||||
if (null === $timezone && ! empty($this->default_timezone)) {
|
if (null === $timezone && !empty($this->default_timezone)) {
|
||||||
$timezone = $this->default_timezone;
|
$timezone = $this->default_timezone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ class AttachmentTypeAdminForm extends BaseEntityAdminForm
|
||||||
'placeholder' => 'attachment_type.edit.filetype_filter.placeholder',
|
'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),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//Normalize data before writing it to database
|
//Normalize data before writing it to database
|
||||||
|
|
|
@ -90,7 +90,7 @@ class BaseEntityAdminForm extends AbstractType
|
||||||
'attr' => [
|
'attr' => [
|
||||||
'placeholder' => 'part.name.placeholder',
|
'placeholder' => 'part.name.placeholder',
|
||||||
],
|
],
|
||||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($entity instanceof AbstractStructuralDBElement) {
|
if ($entity instanceof AbstractStructuralDBElement) {
|
||||||
|
@ -101,7 +101,7 @@ class BaseEntityAdminForm extends AbstractType
|
||||||
'class' => get_class($entity),
|
'class' => get_class($entity),
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'label' => 'parent.label',
|
'label' => 'parent.label',
|
||||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'move', $entity),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
->add(
|
->add(
|
||||||
|
@ -114,7 +114,7 @@ class BaseEntityAdminForm extends AbstractType
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'class' => 'checkbox-custom',
|
'class' => 'checkbox-custom',
|
||||||
],
|
],
|
||||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ class BaseEntityAdminForm extends AbstractType
|
||||||
'rows' => 4,
|
'rows' => 4,
|
||||||
],
|
],
|
||||||
'help' => 'bbcode.hint',
|
'help' => 'bbcode.hint',
|
||||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ class BaseEntityAdminForm extends AbstractType
|
||||||
'allow_delete' => true,
|
'allow_delete' => true,
|
||||||
'label' => false,
|
'label' => false,
|
||||||
'reindex_enable' => true,
|
'reindex_enable' => true,
|
||||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||||
'entry_options' => [
|
'entry_options' => [
|
||||||
'data_class' => $options['attachment_class'],
|
'data_class' => $options['attachment_class'],
|
||||||
],
|
],
|
||||||
|
@ -153,7 +153,7 @@ 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' => 'part.edit.master_attachment',
|
'label' => 'part.edit.master_attachment',
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
]);
|
]);
|
||||||
|
@ -173,7 +173,7 @@ class BaseEntityAdminForm extends AbstractType
|
||||||
'entry_type' => ParameterType::class,
|
'entry_type' => ParameterType::class,
|
||||||
'allow_add' => $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
'allow_add' => $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||||
'allow_delete' => $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,
|
'reindex_enable' => true,
|
||||||
'label' => false,
|
'label' => false,
|
||||||
'by_reference' => false,
|
'by_reference' => false,
|
||||||
|
@ -191,11 +191,11 @@ class BaseEntityAdminForm extends AbstractType
|
||||||
'attr' => [
|
'attr' => [
|
||||||
'class' => $is_new ? 'btn-success' : '',
|
'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, [
|
->add('reset', ResetType::class, [
|
||||||
'label' => 'entity.edit.reset',
|
'label' => 'entity.edit.reset',
|
||||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'class' => 'checkbox-custom',
|
'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, [
|
$builder->add('disable_manufacturers', CheckboxType::class, [
|
||||||
|
@ -70,7 +70,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'class' => 'checkbox-custom',
|
'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, [
|
$builder->add('disable_autodatasheets', CheckboxType::class, [
|
||||||
|
@ -80,7 +80,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'class' => 'checkbox-custom',
|
'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, [
|
$builder->add('disable_properties', CheckboxType::class, [
|
||||||
|
@ -90,7 +90,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'class' => 'checkbox-custom',
|
'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, [
|
$builder->add('partname_hint', TextType::class, [
|
||||||
|
@ -100,7 +100,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
||||||
'attr' => [
|
'attr' => [
|
||||||
'placeholder' => 'category.edit.partname_hint.placeholder',
|
'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, [
|
$builder->add('partname_regex', TextType::class, [
|
||||||
|
@ -110,7 +110,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
||||||
'attr' => [
|
'attr' => [
|
||||||
'placeholder' => 'category.edit.partname_regex.placeholder',
|
'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, [
|
$builder->add('default_description', TextType::class, [
|
||||||
|
@ -120,7 +120,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
||||||
'attr' => [
|
'attr' => [
|
||||||
'placeholder' => 'category.edit.default_description.placeholder',
|
'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, [
|
$builder->add('default_comment', TextType::class, [
|
||||||
|
@ -130,7 +130,7 @@ class CategoryAdminForm extends BaseEntityAdminForm
|
||||||
'attr' => [
|
'attr' => [
|
||||||
'placeholder' => 'category.edit.default_comment.placeholder',
|
'placeholder' => 'category.edit.default_comment.placeholder',
|
||||||
],
|
],
|
||||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ class CompanyForm extends BaseEntityAdminForm
|
||||||
|
|
||||||
$builder->add('address', TextareaType::class, [
|
$builder->add('address', TextareaType::class, [
|
||||||
'label' => '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' => [
|
'attr' => [
|
||||||
'placeholder' => 'company.edit.address.placeholder',
|
'placeholder' => 'company.edit.address.placeholder',
|
||||||
],
|
],
|
||||||
|
@ -67,7 +67,7 @@ class CompanyForm extends BaseEntityAdminForm
|
||||||
|
|
||||||
$builder->add('phone_number', TelType::class, [
|
$builder->add('phone_number', TelType::class, [
|
||||||
'label' => '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' => [
|
'attr' => [
|
||||||
'placeholder' => 'company.edit.phone_number.placeholder',
|
'placeholder' => 'company.edit.phone_number.placeholder',
|
||||||
],
|
],
|
||||||
|
@ -77,7 +77,7 @@ class CompanyForm extends BaseEntityAdminForm
|
||||||
|
|
||||||
$builder->add('fax_number', TelType::class, [
|
$builder->add('fax_number', TelType::class, [
|
||||||
'label' => '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' => [
|
'attr' => [
|
||||||
'placeholder' => 'company.fax_number.placeholder',
|
'placeholder' => 'company.fax_number.placeholder',
|
||||||
],
|
],
|
||||||
|
@ -87,7 +87,7 @@ class CompanyForm extends BaseEntityAdminForm
|
||||||
|
|
||||||
$builder->add('email_address', EmailType::class, [
|
$builder->add('email_address', EmailType::class, [
|
||||||
'label' => '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' => [
|
'attr' => [
|
||||||
'placeholder' => 'company.edit.email.placeholder',
|
'placeholder' => 'company.edit.email.placeholder',
|
||||||
],
|
],
|
||||||
|
@ -97,7 +97,7 @@ class CompanyForm extends BaseEntityAdminForm
|
||||||
|
|
||||||
$builder->add('website', UrlType::class, [
|
$builder->add('website', UrlType::class, [
|
||||||
'label' => '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' => [
|
'attr' => [
|
||||||
'placeholder' => 'company.edit.website.placeholder',
|
'placeholder' => 'company.edit.website.placeholder',
|
||||||
],
|
],
|
||||||
|
@ -108,7 +108,7 @@ class CompanyForm extends BaseEntityAdminForm
|
||||||
$builder->add('auto_product_url', UrlType::class, [
|
$builder->add('auto_product_url', UrlType::class, [
|
||||||
'label' => 'company.edit.auto_product_url',
|
'label' => 'company.edit.auto_product_url',
|
||||||
'help' => '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' => [
|
'attr' => [
|
||||||
'placeholder' => 'company.edit.auto_product_url.placeholder',
|
'placeholder' => 'company.edit.auto_product_url.placeholder',
|
||||||
],
|
],
|
||||||
|
|
|
@ -45,7 +45,6 @@ namespace App\Form\AdminPages;
|
||||||
use App\Entity\Base\AbstractNamedDBElement;
|
use App\Entity\Base\AbstractNamedDBElement;
|
||||||
use App\Form\Type\BigDecimalMoneyType;
|
use App\Form\Type\BigDecimalMoneyType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\CurrencyType;
|
use Symfony\Component\Form\Extension\Core\Type\CurrencyType;
|
||||||
use Symfony\Component\Form\Extension\Core\Type\MoneyType;
|
|
||||||
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\Security\Core\Security;
|
use Symfony\Component\Security\Core\Security;
|
||||||
|
@ -73,7 +72,7 @@ class CurrencyAdminForm extends BaseEntityAdminForm
|
||||||
'title' => 'selectpicker.nothing_selected',
|
'title' => 'selectpicker.nothing_selected',
|
||||||
'data-live-search' => true,
|
'data-live-search' => true,
|
||||||
],
|
],
|
||||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('exchange_rate', BigDecimalMoneyType::class, [
|
$builder->add('exchange_rate', BigDecimalMoneyType::class, [
|
||||||
|
@ -81,16 +80,16 @@ class CurrencyAdminForm extends BaseEntityAdminForm
|
||||||
'label' => 'currency.edit.exchange_rate',
|
'label' => 'currency.edit.exchange_rate',
|
||||||
'currency' => $this->default_currency,
|
'currency' => $this->default_currency,
|
||||||
'scale' => 6,
|
'scale' => 6,
|
||||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if(!$is_new) {
|
if (!$is_new) {
|
||||||
$builder->add(
|
$builder->add(
|
||||||
'update_exchange_rate',
|
'update_exchange_rate',
|
||||||
SubmitType::class,
|
SubmitType::class,
|
||||||
[
|
[
|
||||||
'label' => 'currency.edit.update_rate',
|
'label' => 'currency.edit.update_rate',
|
||||||
'disabled' => ! $this->security->isGranted('edit', $entity)
|
'disabled' => !$this->security->isGranted('edit', $entity),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ class FootprintAdminForm extends BaseEntityAdminForm
|
||||||
{
|
{
|
||||||
$builder->add('footprint_3d', MasterPictureAttachmentType::class, [
|
$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' => 'footprint.edit.3d_model',
|
'label' => 'footprint.edit.3d_model',
|
||||||
'filter' => '3d_model',
|
'filter' => '3d_model',
|
||||||
'entity' => $entity,
|
'entity' => $entity,
|
||||||
|
|
|
@ -60,13 +60,13 @@ class GroupAdminForm extends BaseEntityAdminForm
|
||||||
'label_attr' => [
|
'label_attr' => [
|
||||||
'class' => 'checkbox-custom',
|
'class' => 'checkbox-custom',
|
||||||
],
|
],
|
||||||
'disabled' => ! $this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$builder->add('permissions', PermissionsType::class, [
|
$builder->add('permissions', PermissionsType::class, [
|
||||||
'mapped' => false,
|
'mapped' => false,
|
||||||
'data' => $builder->getData(),
|
'data' => $builder->getData(),
|
||||||
'disabled' => ! $this->security->isGranted('edit_permissions', $entity),
|
'disabled' => !$this->security->isGranted('edit_permissions', $entity),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ class ImportType extends AbstractType
|
||||||
//Disable import if user is not allowed to create elements.
|
//Disable import if user is not allowed to create elements.
|
||||||
$entity = new $data['entity_class']();
|
$entity = new $data['entity_class']();
|
||||||
$perm_name = 'create';
|
$perm_name = 'create';
|
||||||
$disabled = ! $this->security->isGranted($perm_name, $entity);
|
$disabled = !$this->security->isGranted($perm_name, $entity);
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ class MassCreationForm extends AbstractType
|
||||||
//Disable import if user is not allowed to create elements.
|
//Disable import if user is not allowed to create elements.
|
||||||
$entity = new $data['entity_class']();
|
$entity = new $data['entity_class']();
|
||||||
$perm_name = 'create';
|
$perm_name = 'create';
|
||||||
$disabled = ! $this->security->isGranted($perm_name, $entity);
|
$disabled = !$this->security->isGranted($perm_name, $entity);
|
||||||
|
|
||||||
$builder
|
$builder
|
||||||
->add('lines', TextareaType::class, [
|
->add('lines', TextareaType::class, [
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue