mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-01-14 14:19:33 +00:00
Merge remote-tracking branch 'upstream/master' into Buerklin-provider
This commit is contained in:
commit
b8638b6390
185 changed files with 23450 additions and 15606 deletions
|
|
@ -30,6 +30,7 @@ use App\Entity\Attachments\AttachmentUpload;
|
|||
use App\Entity\Attachments\CategoryAttachment;
|
||||
use App\Entity\Attachments\CurrencyAttachment;
|
||||
use App\Entity\Attachments\LabelAttachment;
|
||||
use App\Entity\Attachments\PartCustomStateAttachment;
|
||||
use App\Entity\Attachments\ProjectAttachment;
|
||||
use App\Entity\Attachments\FootprintAttachment;
|
||||
use App\Entity\Attachments\GroupAttachment;
|
||||
|
|
@ -80,6 +81,7 @@ class AttachmentSubmitHandler
|
|||
//The mapping used to determine which folder will be used for an attachment type
|
||||
$this->folder_mapping = [
|
||||
PartAttachment::class => 'part',
|
||||
PartCustomStateAttachment::class => 'part_custom_state',
|
||||
AttachmentTypeAttachment::class => 'attachment_type',
|
||||
CategoryAttachment::class => 'category',
|
||||
CurrencyAttachment::class => 'currency',
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ declare(strict_types=1);
|
|||
namespace App\Services\Attachments;
|
||||
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\PartCustomState;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\StorageLocation;
|
||||
|
|
|
|||
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2022 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Closure;
|
||||
use Symfony\Component\DependencyInjection\EnvVarProcessorInterface;
|
||||
use Symfony\Component\DependencyInjection\Exception\EnvNotFoundException;
|
||||
|
||||
final class CustomEnvVarProcessor implements EnvVarProcessorInterface
|
||||
{
|
||||
public function getEnv($prefix, $name, Closure $getEnv): bool
|
||||
{
|
||||
if ('validMailDSN' === $prefix) {
|
||||
try {
|
||||
$env = $getEnv($name);
|
||||
|
||||
return !empty($env) && 'null://null' !== $env;
|
||||
} catch (EnvNotFoundException) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function getProvidedTypes(): array
|
||||
{
|
||||
return [
|
||||
'validMailDSN' => 'bool',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -233,6 +233,10 @@ class KiCadHelper
|
|||
}
|
||||
$result["fields"]["Part-DB Unit"] = $this->createField($unit);
|
||||
}
|
||||
if ($part->getPartCustomState() !== null) {
|
||||
$customState = $part->getPartCustomState()->getName();
|
||||
$result["fields"]["Part-DB Custom state"] = $this->createField($customState);
|
||||
}
|
||||
if ($part->getMass()) {
|
||||
$result["fields"]["Mass"] = $this->createField($part->getMass() . ' g');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,66 +24,31 @@ namespace App\Services;
|
|||
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentContainingDBElement;
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Contracts\NamedElementInterface;
|
||||
use App\Entity\InfoProviderSystem\BulkInfoProviderImportJob;
|
||||
use App\Entity\InfoProviderSystem\BulkInfoProviderImportJobPart;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Entity\Parameters\AbstractParameter;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Entity\Parts\PartAssociation;
|
||||
use App\Entity\Parts\PartLot;
|
||||
use App\Entity\Parts\StorageLocation;
|
||||
use App\Entity\Parts\Supplier;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
use App\Entity\PriceInformations\Orderdetail;
|
||||
use App\Entity\PriceInformations\Pricedetail;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\ProjectSystem\ProjectBOMEntry;
|
||||
use App\Entity\UserSystem\Group;
|
||||
use App\Entity\UserSystem\User;
|
||||
use App\Exceptions\EntityNotSupportedException;
|
||||
use App\Settings\SynonymSettings;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* @see \App\Tests\Services\ElementTypeNameGeneratorTest
|
||||
*/
|
||||
class ElementTypeNameGenerator
|
||||
final readonly class ElementTypeNameGenerator
|
||||
{
|
||||
protected array $mapping;
|
||||
|
||||
public function __construct(protected TranslatorInterface $translator, private readonly EntityURLGenerator $entityURLGenerator)
|
||||
public function __construct(
|
||||
private TranslatorInterface $translator,
|
||||
private EntityURLGenerator $entityURLGenerator,
|
||||
private SynonymSettings $synonymsSettings,
|
||||
)
|
||||
{
|
||||
//Child classes has to become before parent classes
|
||||
$this->mapping = [
|
||||
Attachment::class => $this->translator->trans('attachment.label'),
|
||||
Category::class => $this->translator->trans('category.label'),
|
||||
AttachmentType::class => $this->translator->trans('attachment_type.label'),
|
||||
Project::class => $this->translator->trans('project.label'),
|
||||
ProjectBOMEntry::class => $this->translator->trans('project_bom_entry.label'),
|
||||
Footprint::class => $this->translator->trans('footprint.label'),
|
||||
Manufacturer::class => $this->translator->trans('manufacturer.label'),
|
||||
MeasurementUnit::class => $this->translator->trans('measurement_unit.label'),
|
||||
Part::class => $this->translator->trans('part.label'),
|
||||
PartLot::class => $this->translator->trans('part_lot.label'),
|
||||
StorageLocation::class => $this->translator->trans('storelocation.label'),
|
||||
Supplier::class => $this->translator->trans('supplier.label'),
|
||||
Currency::class => $this->translator->trans('currency.label'),
|
||||
Orderdetail::class => $this->translator->trans('orderdetail.label'),
|
||||
Pricedetail::class => $this->translator->trans('pricedetail.label'),
|
||||
Group::class => $this->translator->trans('group.label'),
|
||||
User::class => $this->translator->trans('user.label'),
|
||||
AbstractParameter::class => $this->translator->trans('parameter.label'),
|
||||
LabelProfile::class => $this->translator->trans('label_profile.label'),
|
||||
PartAssociation::class => $this->translator->trans('part_association.label'),
|
||||
BulkInfoProviderImportJob::class => $this->translator->trans('bulk_info_provider_import_job.label'),
|
||||
BulkInfoProviderImportJobPart::class => $this->translator->trans('bulk_info_provider_import_job_part.label'),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -97,27 +62,69 @@ class ElementTypeNameGenerator
|
|||
* @return string the localized label for the entity type
|
||||
*
|
||||
* @throws EntityNotSupportedException when the passed entity is not supported
|
||||
* @deprecated Use label() instead
|
||||
*/
|
||||
public function getLocalizedTypeLabel(object|string $entity): string
|
||||
{
|
||||
$class = is_string($entity) ? $entity : $entity::class;
|
||||
|
||||
//Check if we have a direct array entry for our entity class, then we can use it
|
||||
if (isset($this->mapping[$class])) {
|
||||
return $this->mapping[$class];
|
||||
}
|
||||
|
||||
//Otherwise iterate over array and check for inheritance (needed when the proxy element from doctrine are passed)
|
||||
foreach ($this->mapping as $class_to_check => $translation) {
|
||||
if (is_a($entity, $class_to_check, true)) {
|
||||
return $translation;
|
||||
}
|
||||
}
|
||||
|
||||
//When nothing was found throw an exception
|
||||
throw new EntityNotSupportedException(sprintf('No localized label for the element with type %s was found!', is_object($entity) ? $entity::class : (string) $entity));
|
||||
return $this->typeLabel($entity);
|
||||
}
|
||||
|
||||
private function resolveSynonymLabel(ElementTypes $type, ?string $locale, bool $plural): ?string
|
||||
{
|
||||
$locale ??= $this->translator->getLocale();
|
||||
|
||||
if ($this->synonymsSettings->isSynonymDefinedForType($type)) {
|
||||
if ($plural) {
|
||||
$syn = $this->synonymsSettings->getPluralSynonymForType($type, $locale);
|
||||
} else {
|
||||
$syn = $this->synonymsSettings->getSingularSynonymForType($type, $locale);
|
||||
}
|
||||
|
||||
if ($syn === null) {
|
||||
//Try to fall back to english
|
||||
if ($plural) {
|
||||
$syn = $this->synonymsSettings->getPluralSynonymForType($type, 'en');
|
||||
} else {
|
||||
$syn = $this->synonymsSettings->getSingularSynonymForType($type, 'en');
|
||||
}
|
||||
}
|
||||
|
||||
return $syn;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a localized label for the type of the entity. If user defined synonyms are defined,
|
||||
* these are used instead of the default labels.
|
||||
* @param object|string $entity
|
||||
* @param string|null $locale
|
||||
* @return string
|
||||
*/
|
||||
public function typeLabel(object|string $entity, ?string $locale = null): string
|
||||
{
|
||||
$type = ElementTypes::fromValue($entity);
|
||||
|
||||
return $this->resolveSynonymLabel($type, $locale, false)
|
||||
?? $this->translator->trans($type->getDefaultLabelKey(), locale: $locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Similar to label(), but returns the plural version of the label.
|
||||
* @param object|string $entity
|
||||
* @param string|null $locale
|
||||
* @return string
|
||||
*/
|
||||
public function typeLabelPlural(object|string $entity, ?string $locale = null): string
|
||||
{
|
||||
$type = ElementTypes::fromValue($entity);
|
||||
|
||||
return $this->resolveSynonymLabel($type, $locale, true)
|
||||
?? $this->translator->trans($type->getDefaultPluralLabelKey(), locale: $locale);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns a string like in the format ElementType: ElementName.
|
||||
* For example this could be something like: "Part: BC547".
|
||||
|
|
@ -132,7 +139,7 @@ class ElementTypeNameGenerator
|
|||
*/
|
||||
public function getTypeNameCombination(NamedElementInterface $entity, bool $use_html = false): string
|
||||
{
|
||||
$type = $this->getLocalizedTypeLabel($entity);
|
||||
$type = $this->typeLabel($entity);
|
||||
if ($use_html) {
|
||||
return '<i>' . $type . ':</i> ' . htmlspecialchars($entity->getName());
|
||||
}
|
||||
|
|
@ -142,7 +149,7 @@ class ElementTypeNameGenerator
|
|||
|
||||
|
||||
/**
|
||||
* Returns a HTML formatted label for the given enitity in the format "Type: Name" (on elements with a name) and
|
||||
* Returns a HTML formatted label for the given entity in the format "Type: Name" (on elements with a name) and
|
||||
* "Type: ID" (on elements without a name). If possible the value is given as a link to the element.
|
||||
* @param AbstractDBElement $entity The entity for which the label should be generated
|
||||
* @param bool $include_associated If set to true, the associated entity (like the part belonging to a part lot) is included in the label to give further information
|
||||
|
|
@ -163,7 +170,7 @@ class ElementTypeNameGenerator
|
|||
} else { //Target does not have a name
|
||||
$tmp = sprintf(
|
||||
'<i>%s</i>: %s',
|
||||
$this->getLocalizedTypeLabel($entity),
|
||||
$this->typeLabel($entity),
|
||||
$entity->getID()
|
||||
);
|
||||
}
|
||||
|
|
@ -207,7 +214,7 @@ class ElementTypeNameGenerator
|
|||
{
|
||||
return sprintf(
|
||||
'<i>%s</i>: %s [%s]',
|
||||
$this->getLocalizedTypeLabel($class),
|
||||
$this->typeLabel($class),
|
||||
$id,
|
||||
$this->translator->trans('log.target_deleted')
|
||||
);
|
||||
|
|
|
|||
229
src/Services/ElementTypes.php
Normal file
229
src/Services/ElementTypes.php
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
<?php
|
||||
/*
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2025 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Attachments\AttachmentType;
|
||||
use App\Entity\InfoProviderSystem\BulkInfoProviderImportJob;
|
||||
use App\Entity\InfoProviderSystem\BulkInfoProviderImportJobPart;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Entity\Parameters\AbstractParameter;
|
||||
use App\Entity\Parts\Category;
|
||||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Entity\Parts\PartAssociation;
|
||||
use App\Entity\Parts\PartCustomState;
|
||||
use App\Entity\Parts\PartLot;
|
||||
use App\Entity\Parts\StorageLocation;
|
||||
use App\Entity\Parts\Supplier;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
use App\Entity\PriceInformations\Orderdetail;
|
||||
use App\Entity\PriceInformations\Pricedetail;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\ProjectSystem\ProjectBOMEntry;
|
||||
use App\Entity\UserSystem\Group;
|
||||
use App\Entity\UserSystem\User;
|
||||
use App\Exceptions\EntityNotSupportedException;
|
||||
use Symfony\Contracts\Translation\TranslatableInterface;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
enum ElementTypes: string implements TranslatableInterface
|
||||
{
|
||||
case ATTACHMENT = "attachment";
|
||||
case CATEGORY = "category";
|
||||
case ATTACHMENT_TYPE = "attachment_type";
|
||||
case PROJECT = "project";
|
||||
case PROJECT_BOM_ENTRY = "project_bom_entry";
|
||||
case FOOTPRINT = "footprint";
|
||||
case MANUFACTURER = "manufacturer";
|
||||
case MEASUREMENT_UNIT = "measurement_unit";
|
||||
case PART = "part";
|
||||
case PART_LOT = "part_lot";
|
||||
case STORAGE_LOCATION = "storage_location";
|
||||
case SUPPLIER = "supplier";
|
||||
case CURRENCY = "currency";
|
||||
case ORDERDETAIL = "orderdetail";
|
||||
case PRICEDETAIL = "pricedetail";
|
||||
case GROUP = "group";
|
||||
case USER = "user";
|
||||
case PARAMETER = "parameter";
|
||||
case LABEL_PROFILE = "label_profile";
|
||||
case PART_ASSOCIATION = "part_association";
|
||||
case BULK_INFO_PROVIDER_IMPORT_JOB = "bulk_info_provider_import_job";
|
||||
case BULK_INFO_PROVIDER_IMPORT_JOB_PART = "bulk_info_provider_import_job_part";
|
||||
case PART_CUSTOM_STATE = "part_custom_state";
|
||||
|
||||
//Child classes has to become before parent classes
|
||||
private const CLASS_MAPPING = [
|
||||
Attachment::class => self::ATTACHMENT,
|
||||
Category::class => self::CATEGORY,
|
||||
AttachmentType::class => self::ATTACHMENT_TYPE,
|
||||
Project::class => self::PROJECT,
|
||||
ProjectBOMEntry::class => self::PROJECT_BOM_ENTRY,
|
||||
Footprint::class => self::FOOTPRINT,
|
||||
Manufacturer::class => self::MANUFACTURER,
|
||||
MeasurementUnit::class => self::MEASUREMENT_UNIT,
|
||||
Part::class => self::PART,
|
||||
PartLot::class => self::PART_LOT,
|
||||
StorageLocation::class => self::STORAGE_LOCATION,
|
||||
Supplier::class => self::SUPPLIER,
|
||||
Currency::class => self::CURRENCY,
|
||||
Orderdetail::class => self::ORDERDETAIL,
|
||||
Pricedetail::class => self::PRICEDETAIL,
|
||||
Group::class => self::GROUP,
|
||||
User::class => self::USER,
|
||||
AbstractParameter::class => self::PARAMETER,
|
||||
LabelProfile::class => self::LABEL_PROFILE,
|
||||
PartAssociation::class => self::PART_ASSOCIATION,
|
||||
BulkInfoProviderImportJob::class => self::BULK_INFO_PROVIDER_IMPORT_JOB,
|
||||
BulkInfoProviderImportJobPart::class => self::BULK_INFO_PROVIDER_IMPORT_JOB_PART,
|
||||
PartCustomState::class => self::PART_CUSTOM_STATE,
|
||||
];
|
||||
|
||||
/**
|
||||
* Gets the default translation key for the label of the element type (singular form).
|
||||
*/
|
||||
public function getDefaultLabelKey(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::ATTACHMENT => 'attachment.label',
|
||||
self::CATEGORY => 'category.label',
|
||||
self::ATTACHMENT_TYPE => 'attachment_type.label',
|
||||
self::PROJECT => 'project.label',
|
||||
self::PROJECT_BOM_ENTRY => 'project_bom_entry.label',
|
||||
self::FOOTPRINT => 'footprint.label',
|
||||
self::MANUFACTURER => 'manufacturer.label',
|
||||
self::MEASUREMENT_UNIT => 'measurement_unit.label',
|
||||
self::PART => 'part.label',
|
||||
self::PART_LOT => 'part_lot.label',
|
||||
self::STORAGE_LOCATION => 'storelocation.label',
|
||||
self::SUPPLIER => 'supplier.label',
|
||||
self::CURRENCY => 'currency.label',
|
||||
self::ORDERDETAIL => 'orderdetail.label',
|
||||
self::PRICEDETAIL => 'pricedetail.label',
|
||||
self::GROUP => 'group.label',
|
||||
self::USER => 'user.label',
|
||||
self::PARAMETER => 'parameter.label',
|
||||
self::LABEL_PROFILE => 'label_profile.label',
|
||||
self::PART_ASSOCIATION => 'part_association.label',
|
||||
self::BULK_INFO_PROVIDER_IMPORT_JOB => 'bulk_info_provider_import_job.label',
|
||||
self::BULK_INFO_PROVIDER_IMPORT_JOB_PART => 'bulk_info_provider_import_job_part.label',
|
||||
self::PART_CUSTOM_STATE => 'part_custom_state.label',
|
||||
};
|
||||
}
|
||||
|
||||
public function getDefaultPluralLabelKey(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::ATTACHMENT => 'attachment.labelp',
|
||||
self::CATEGORY => 'category.labelp',
|
||||
self::ATTACHMENT_TYPE => 'attachment_type.labelp',
|
||||
self::PROJECT => 'project.labelp',
|
||||
self::PROJECT_BOM_ENTRY => 'project_bom_entry.labelp',
|
||||
self::FOOTPRINT => 'footprint.labelp',
|
||||
self::MANUFACTURER => 'manufacturer.labelp',
|
||||
self::MEASUREMENT_UNIT => 'measurement_unit.labelp',
|
||||
self::PART => 'part.labelp',
|
||||
self::PART_LOT => 'part_lot.labelp',
|
||||
self::STORAGE_LOCATION => 'storelocation.labelp',
|
||||
self::SUPPLIER => 'supplier.labelp',
|
||||
self::CURRENCY => 'currency.labelp',
|
||||
self::ORDERDETAIL => 'orderdetail.labelp',
|
||||
self::PRICEDETAIL => 'pricedetail.labelp',
|
||||
self::GROUP => 'group.labelp',
|
||||
self::USER => 'user.labelp',
|
||||
self::PARAMETER => 'parameter.labelp',
|
||||
self::LABEL_PROFILE => 'label_profile.labelp',
|
||||
self::PART_ASSOCIATION => 'part_association.labelp',
|
||||
self::BULK_INFO_PROVIDER_IMPORT_JOB => 'bulk_info_provider_import_job.labelp',
|
||||
self::BULK_INFO_PROVIDER_IMPORT_JOB_PART => 'bulk_info_provider_import_job_part.labelp',
|
||||
self::PART_CUSTOM_STATE => 'part_custom_state.labelp',
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to get a user-friendly representation of the object that can be translated.
|
||||
* For this the singular default label key is used.
|
||||
* @param TranslatorInterface $translator
|
||||
* @param string|null $locale
|
||||
* @return string
|
||||
*/
|
||||
public function trans(TranslatorInterface $translator, ?string $locale = null): string
|
||||
{
|
||||
return $translator->trans($this->getDefaultLabelKey(), locale: $locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the ElementType from a value, which can either be an enum value, an ElementTypes instance, a class name or an object instance.
|
||||
* @param string|object $value
|
||||
* @return self
|
||||
*/
|
||||
public static function fromValue(string|object $value): self
|
||||
{
|
||||
if ($value instanceof self) {
|
||||
return $value;
|
||||
}
|
||||
if (is_object($value)) {
|
||||
return self::fromClass($value);
|
||||
}
|
||||
|
||||
|
||||
//Otherwise try to parse it as enum value first
|
||||
$enumValue = self::tryFrom($value);
|
||||
|
||||
//Otherwise try to get it from class name
|
||||
return $enumValue ?? self::fromClass($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the ElementType from a class name or object instance.
|
||||
* @param string|object $class
|
||||
* @throws EntityNotSupportedException if the class is not supported
|
||||
* @return self
|
||||
*/
|
||||
public static function fromClass(string|object $class): self
|
||||
{
|
||||
if (is_object($class)) {
|
||||
$className = get_class($class);
|
||||
} else {
|
||||
$className = $class;
|
||||
}
|
||||
|
||||
if (array_key_exists($className, self::CLASS_MAPPING)) {
|
||||
return self::CLASS_MAPPING[$className];
|
||||
}
|
||||
|
||||
//Otherwise we need to check for inheritance
|
||||
foreach (self::CLASS_MAPPING as $entityClass => $elementType) {
|
||||
if (is_a($className, $entityClass, true)) {
|
||||
return $elementType;
|
||||
}
|
||||
}
|
||||
|
||||
throw new EntityNotSupportedException(sprintf('No localized label for the element with type %s was found!', $className));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -24,7 +24,7 @@ declare(strict_types=1);
|
|||
namespace App\Services\EntityMergers;
|
||||
|
||||
use App\Services\EntityMergers\Mergers\EntityMergerInterface;
|
||||
use Symfony\Component\DependencyInjection\Attribute\TaggedIterator;
|
||||
use Symfony\Component\DependencyInjection\Attribute\AutowireIterator;
|
||||
|
||||
/**
|
||||
* This service is used to merge two entities together.
|
||||
|
|
@ -32,7 +32,7 @@ use Symfony\Component\DependencyInjection\Attribute\TaggedIterator;
|
|||
*/
|
||||
class EntityMerger
|
||||
{
|
||||
public function __construct(#[TaggedIterator('app.entity_merger')] protected iterable $mergers)
|
||||
public function __construct(#[AutowireIterator('app.entity_merger')] protected iterable $mergers)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -73,4 +73,4 @@ class EntityMerger
|
|||
}
|
||||
return $merger->merge($target, $other, $context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ class PartMerger implements EntityMergerInterface
|
|||
$this->useOtherValueIfNotNull($target, $other, 'footprint');
|
||||
$this->useOtherValueIfNotNull($target, $other, 'category');
|
||||
$this->useOtherValueIfNotNull($target, $other, 'partUnit');
|
||||
$this->useOtherValueIfNotNull($target, $other, 'partCustomState');
|
||||
|
||||
//We assume that the higher value is the correct one for minimum instock
|
||||
$this->useLargerValue($target, $other, 'minamount');
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ use App\Entity\Attachments\AttachmentType;
|
|||
use App\Entity\Attachments\PartAttachment;
|
||||
use App\Entity\Base\AbstractDBElement;
|
||||
use App\Entity\Parameters\PartParameter;
|
||||
use App\Entity\Parts\PartCustomState;
|
||||
use App\Entity\ProjectSystem\Project;
|
||||
use App\Entity\LabelSystem\LabelProfile;
|
||||
use App\Entity\Parts\Category;
|
||||
|
|
@ -107,6 +108,7 @@ class EntityURLGenerator
|
|||
MeasurementUnit::class => 'measurement_unit_edit',
|
||||
Group::class => 'group_edit',
|
||||
LabelProfile::class => 'label_profile_edit',
|
||||
PartCustomState::class => 'part_custom_state_edit',
|
||||
];
|
||||
|
||||
try {
|
||||
|
|
@ -213,6 +215,7 @@ class EntityURLGenerator
|
|||
MeasurementUnit::class => 'measurement_unit_edit',
|
||||
Group::class => 'group_edit',
|
||||
LabelProfile::class => 'label_profile_edit',
|
||||
PartCustomState::class => 'part_custom_state_edit',
|
||||
];
|
||||
|
||||
return $this->urlGenerator->generate($this->mapToController($map, $entity), ['id' => $entity->getID()]);
|
||||
|
|
@ -243,6 +246,7 @@ class EntityURLGenerator
|
|||
MeasurementUnit::class => 'measurement_unit_edit',
|
||||
Group::class => 'group_edit',
|
||||
LabelProfile::class => 'label_profile_edit',
|
||||
PartCustomState::class => 'part_custom_state_edit',
|
||||
];
|
||||
|
||||
return $this->urlGenerator->generate($this->mapToController($map, $entity), ['id' => $entity->getID()]);
|
||||
|
|
@ -274,6 +278,7 @@ class EntityURLGenerator
|
|||
MeasurementUnit::class => 'measurement_unit_new',
|
||||
Group::class => 'group_new',
|
||||
LabelProfile::class => 'label_profile_new',
|
||||
PartCustomState::class => 'part_custom_state_new',
|
||||
];
|
||||
|
||||
return $this->urlGenerator->generate($this->mapToController($map, $entity));
|
||||
|
|
@ -305,6 +310,7 @@ class EntityURLGenerator
|
|||
MeasurementUnit::class => 'measurement_unit_clone',
|
||||
Group::class => 'group_clone',
|
||||
LabelProfile::class => 'label_profile_clone',
|
||||
PartCustomState::class => 'part_custom_state_clone',
|
||||
];
|
||||
|
||||
return $this->urlGenerator->generate($this->mapToController($map, $entity), ['id' => $entity->getID()]);
|
||||
|
|
@ -350,6 +356,7 @@ class EntityURLGenerator
|
|||
MeasurementUnit::class => 'measurement_unit_delete',
|
||||
Group::class => 'group_delete',
|
||||
LabelProfile::class => 'label_profile_delete',
|
||||
PartCustomState::class => 'part_custom_state_delete',
|
||||
];
|
||||
|
||||
return $this->urlGenerator->generate($this->mapToController($map, $entity), ['id' => $entity->getID()]);
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class BOMImporter
|
|||
|
||||
private function parseKiCADPCB(string $data): array
|
||||
{
|
||||
$csv = Reader::createFromString($data);
|
||||
$csv = Reader::fromString($data);
|
||||
$csv->setDelimiter(';');
|
||||
$csv->setHeaderOffset(0);
|
||||
|
||||
|
|
@ -175,7 +175,7 @@ class BOMImporter
|
|||
*/
|
||||
private function validateKiCADPCB(string $data): array
|
||||
{
|
||||
$csv = Reader::createFromString($data);
|
||||
$csv = Reader::fromString($data);
|
||||
$csv->setDelimiter(';');
|
||||
$csv->setHeaderOffset(0);
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ class BOMImporter
|
|||
// Handle potential BOM (Byte Order Mark) at the beginning
|
||||
$data = preg_replace('/^\xEF\xBB\xBF/', '', $data);
|
||||
|
||||
$csv = Reader::createFromString($data);
|
||||
$csv = Reader::fromString($data);
|
||||
$csv->setDelimiter($delimiter);
|
||||
$csv->setHeaderOffset(0);
|
||||
|
||||
|
|
@ -262,7 +262,7 @@ class BOMImporter
|
|||
// Handle potential BOM (Byte Order Mark) at the beginning
|
||||
$data = preg_replace('/^\xEF\xBB\xBF/', '', $data);
|
||||
|
||||
$csv = Reader::createFromString($data);
|
||||
$csv = Reader::fromString($data);
|
||||
$csv->setDelimiter($delimiter);
|
||||
$csv->setHeaderOffset(0);
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ use App\Entity\Parts\Category;
|
|||
use App\Entity\Parts\Footprint;
|
||||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Entity\Parts\PartCustomState;
|
||||
use App\Entity\Parts\StorageLocation;
|
||||
use App\Entity\Parts\Supplier;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
|
@ -148,6 +149,26 @@ class PKDatastructureImporter
|
|||
return is_countable($partunit_data) ? count($partunit_data) : 0;
|
||||
}
|
||||
|
||||
public function importPartCustomStates(array $data): int
|
||||
{
|
||||
if (!isset($data['partcustomstate'])) {
|
||||
throw new \RuntimeException('$data must contain a "partcustomstate" key!');
|
||||
}
|
||||
|
||||
$partCustomStateData = $data['partcustomstate'];
|
||||
foreach ($partCustomStateData as $partCustomState) {
|
||||
$customState = new PartCustomState();
|
||||
$customState->setName($partCustomState['name']);
|
||||
|
||||
$this->setIDOfEntity($customState, $partCustomState['id']);
|
||||
$this->em->persist($customState);
|
||||
}
|
||||
|
||||
$this->em->flush();
|
||||
|
||||
return is_countable($partCustomStateData) ? count($partCustomStateData) : 0;
|
||||
}
|
||||
|
||||
public function importCategories(array $data): int
|
||||
{
|
||||
if (!isset($data['partcategory'])) {
|
||||
|
|
|
|||
|
|
@ -91,6 +91,8 @@ class PKPartImporter
|
|||
$this->setAssociationField($entity, 'partUnit', MeasurementUnit::class, $part['partUnit_id']);
|
||||
}
|
||||
|
||||
$this->setAssociationField($entity, 'partCustomState', MeasurementUnit::class, $part['partCustomState_id']);
|
||||
|
||||
//Create a part lot to store the stock level and location
|
||||
$lot = new PartLot();
|
||||
$lot->setAmount((float) ($part['stockLevel'] ?? 0));
|
||||
|
|
|
|||
|
|
@ -22,24 +22,41 @@ declare(strict_types=1);
|
|||
|
||||
namespace App\Services\InfoProviderSystem\DTOs;
|
||||
|
||||
use App\Services\InfoProviderSystem\Providers\InfoProviderInterface;
|
||||
|
||||
/**
|
||||
* Represents a mapping between a part field and the info providers that should search in that field.
|
||||
*/
|
||||
readonly class BulkSearchFieldMappingDTO
|
||||
{
|
||||
/** @var string[] $providers Array of provider keys to search with (e.g., ['digikey', 'farnell']) */
|
||||
public array $providers;
|
||||
|
||||
/**
|
||||
* @param string $field The field to search in (e.g., 'mpn', 'name', or supplier-specific fields like 'digikey_spn')
|
||||
* @param string[] $providers Array of provider keys to search with (e.g., ['digikey', 'farnell'])
|
||||
* @param string[]|InfoProviderInterface[] $providers Array of provider keys to search with (e.g., ['digikey', 'farnell'])
|
||||
* @param int $priority Priority for this field mapping (1-10, lower numbers = higher priority)
|
||||
*/
|
||||
public function __construct(
|
||||
public string $field,
|
||||
public array $providers,
|
||||
array $providers = [],
|
||||
public int $priority = 1
|
||||
) {
|
||||
if ($priority < 1 || $priority > 10) {
|
||||
throw new \InvalidArgumentException('Priority must be between 1 and 10');
|
||||
}
|
||||
|
||||
//Ensure that providers are provided as keys
|
||||
foreach ($providers as &$provider) {
|
||||
if ($provider instanceof InfoProviderInterface) {
|
||||
$provider = $provider->getProviderKey();
|
||||
}
|
||||
if (!is_string($provider)) {
|
||||
throw new \InvalidArgumentException('Providers must be provided as strings or InfoProviderInterface instances');
|
||||
}
|
||||
}
|
||||
unset($provider);
|
||||
$this->providers = $providers;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ final class SandboxedTwigFactory
|
|||
Supplier::class => ['getShippingCosts', 'getDefaultCurrency'],
|
||||
Part::class => ['isNeedsReview', 'getTags', 'getMass', 'getIpn', 'getProviderReference',
|
||||
'getDescription', 'getComment', 'isFavorite', 'getCategory', 'getFootprint',
|
||||
'getPartLots', 'getPartUnit', 'useFloatAmount', 'getMinAmount', 'getAmountSum', 'isNotEnoughInstock', 'isAmountUnknown', 'getExpiredAmountSum',
|
||||
'getPartLots', 'getPartUnit', 'getPartCustomState', 'useFloatAmount', 'getMinAmount', 'getAmountSum', 'isNotEnoughInstock', 'isAmountUnknown', 'getExpiredAmountSum',
|
||||
'getManufacturerProductUrl', 'getCustomProductURL', 'getManufacturingStatus', 'getManufacturer',
|
||||
'getManufacturerProductNumber', 'getOrderdetails', 'isObsolete',
|
||||
'getParameters', 'getGroupedParameters',
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ use App\Entity\Parts\Footprint;
|
|||
use App\Entity\Parts\Manufacturer;
|
||||
use App\Entity\Parts\MeasurementUnit;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Entity\Parts\PartCustomState;
|
||||
use App\Entity\Parts\StorageLocation;
|
||||
use App\Entity\Parts\Supplier;
|
||||
use App\Entity\PriceInformations\Currency;
|
||||
|
|
@ -37,6 +38,7 @@ use App\Entity\UserSystem\Group;
|
|||
use App\Entity\UserSystem\User;
|
||||
use App\Helpers\Trees\TreeViewNode;
|
||||
use App\Services\Cache\UserCacheKeyGenerator;
|
||||
use App\Services\ElementTypeNameGenerator;
|
||||
use Symfony\Bundle\SecurityBundle\Security;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
use Symfony\Contracts\Cache\ItemInterface;
|
||||
|
|
@ -49,8 +51,14 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||
*/
|
||||
class ToolsTreeBuilder
|
||||
{
|
||||
public function __construct(protected TranslatorInterface $translator, protected UrlGeneratorInterface $urlGenerator, protected TagAwareCacheInterface $cache, protected UserCacheKeyGenerator $keyGenerator, protected Security $security)
|
||||
{
|
||||
public function __construct(
|
||||
protected TranslatorInterface $translator,
|
||||
protected UrlGeneratorInterface $urlGenerator,
|
||||
protected TagAwareCacheInterface $cache,
|
||||
protected UserCacheKeyGenerator $keyGenerator,
|
||||
protected Security $security,
|
||||
private readonly ElementTypeNameGenerator $elementTypeNameGenerator,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -138,7 +146,7 @@ class ToolsTreeBuilder
|
|||
$this->translator->trans('info_providers.search.title'),
|
||||
$this->urlGenerator->generate('info_providers_search')
|
||||
))->setIcon('fa-treeview fa-fw fa-solid fa-cloud-arrow-down');
|
||||
|
||||
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('info_providers.bulk_import.manage_jobs'),
|
||||
$this->urlGenerator->generate('bulk_info_provider_manage')
|
||||
|
|
@ -159,64 +167,70 @@ class ToolsTreeBuilder
|
|||
|
||||
if ($this->security->isGranted('read', new AttachmentType())) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('tree.tools.edit.attachment_types'),
|
||||
$this->elementTypeNameGenerator->typeLabelPlural(AttachmentType::class),
|
||||
$this->urlGenerator->generate('attachment_type_new')
|
||||
))->setIcon('fa-fw fa-treeview fa-solid fa-file-alt');
|
||||
}
|
||||
if ($this->security->isGranted('read', new Category())) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('tree.tools.edit.categories'),
|
||||
$this->elementTypeNameGenerator->typeLabelPlural(Category::class),
|
||||
$this->urlGenerator->generate('category_new')
|
||||
))->setIcon('fa-fw fa-treeview fa-solid fa-tags');
|
||||
}
|
||||
if ($this->security->isGranted('read', new Project())) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('tree.tools.edit.projects'),
|
||||
$this->elementTypeNameGenerator->typeLabelPlural(Project::class),
|
||||
$this->urlGenerator->generate('project_new')
|
||||
))->setIcon('fa-fw fa-treeview fa-solid fa-archive');
|
||||
}
|
||||
if ($this->security->isGranted('read', new Supplier())) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('tree.tools.edit.suppliers'),
|
||||
$this->elementTypeNameGenerator->typeLabelPlural(Supplier::class),
|
||||
$this->urlGenerator->generate('supplier_new')
|
||||
))->setIcon('fa-fw fa-treeview fa-solid fa-truck');
|
||||
}
|
||||
if ($this->security->isGranted('read', new Manufacturer())) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('tree.tools.edit.manufacturer'),
|
||||
$this->elementTypeNameGenerator->typeLabelPlural(Manufacturer::class),
|
||||
$this->urlGenerator->generate('manufacturer_new')
|
||||
))->setIcon('fa-fw fa-treeview fa-solid fa-industry');
|
||||
}
|
||||
if ($this->security->isGranted('read', new StorageLocation())) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('tree.tools.edit.storelocation'),
|
||||
$this->elementTypeNameGenerator->typeLabelPlural(StorageLocation::class),
|
||||
$this->urlGenerator->generate('store_location_new')
|
||||
))->setIcon('fa-fw fa-treeview fa-solid fa-cube');
|
||||
}
|
||||
if ($this->security->isGranted('read', new Footprint())) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('tree.tools.edit.footprint'),
|
||||
$this->elementTypeNameGenerator->typeLabelPlural(Footprint::class),
|
||||
$this->urlGenerator->generate('footprint_new')
|
||||
))->setIcon('fa-fw fa-treeview fa-solid fa-microchip');
|
||||
}
|
||||
if ($this->security->isGranted('read', new Currency())) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('tree.tools.edit.currency'),
|
||||
$this->elementTypeNameGenerator->typeLabelPlural(Currency::class),
|
||||
$this->urlGenerator->generate('currency_new')
|
||||
))->setIcon('fa-fw fa-treeview fa-solid fa-coins');
|
||||
}
|
||||
if ($this->security->isGranted('read', new MeasurementUnit())) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('tree.tools.edit.measurement_unit'),
|
||||
$this->elementTypeNameGenerator->typeLabelPlural(MeasurementUnit::class),
|
||||
$this->urlGenerator->generate('measurement_unit_new')
|
||||
))->setIcon('fa-fw fa-treeview fa-solid fa-balance-scale');
|
||||
}
|
||||
if ($this->security->isGranted('read', new LabelProfile())) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('tree.tools.edit.label_profile'),
|
||||
$this->elementTypeNameGenerator->typeLabelPlural(LabelProfile::class),
|
||||
$this->urlGenerator->generate('label_profile_new')
|
||||
))->setIcon('fa-fw fa-treeview fa-solid fa-qrcode');
|
||||
}
|
||||
if ($this->security->isGranted('read', new PartCustomState())) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->elementTypeNameGenerator->typeLabelPlural(PartCustomState::class),
|
||||
$this->urlGenerator->generate('part_custom_state_new')
|
||||
))->setIcon('fa-fw fa-treeview fa-solid fa-tools');
|
||||
}
|
||||
if ($this->security->isGranted('create', new Part())) {
|
||||
$nodes[] = (new TreeViewNode(
|
||||
$this->translator->trans('tree.tools.edit.part'),
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ use App\Entity\ProjectSystem\Project;
|
|||
use App\Helpers\Trees\TreeViewNode;
|
||||
use App\Helpers\Trees\TreeViewNodeIterator;
|
||||
use App\Repository\NamedDBElementRepository;
|
||||
use App\Repository\StructuralDBElementRepository;
|
||||
use App\Services\Cache\ElementCacheTagGenerator;
|
||||
use App\Services\Cache\UserCacheKeyGenerator;
|
||||
use App\Services\ElementTypeNameGenerator;
|
||||
use App\Services\EntityURLGenerator;
|
||||
use App\Settings\BehaviorSettings\SidebarSettings;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
|
@ -67,6 +67,7 @@ class TreeViewGenerator
|
|||
protected TranslatorInterface $translator,
|
||||
private readonly UrlGeneratorInterface $router,
|
||||
private readonly SidebarSettings $sidebarSettings,
|
||||
private readonly ElementTypeNameGenerator $elementTypeNameGenerator
|
||||
) {
|
||||
$this->rootNodeEnabled = $this->sidebarSettings->rootNodeEnabled;
|
||||
$this->rootNodeExpandedByDefault = $this->sidebarSettings->rootNodeExpanded;
|
||||
|
|
@ -212,15 +213,7 @@ class TreeViewGenerator
|
|||
|
||||
protected function entityClassToRootNodeString(string $class): string
|
||||
{
|
||||
return match ($class) {
|
||||
Category::class => $this->translator->trans('category.labelp'),
|
||||
StorageLocation::class => $this->translator->trans('storelocation.labelp'),
|
||||
Footprint::class => $this->translator->trans('footprint.labelp'),
|
||||
Manufacturer::class => $this->translator->trans('manufacturer.labelp'),
|
||||
Supplier::class => $this->translator->trans('supplier.labelp'),
|
||||
Project::class => $this->translator->trans('project.labelp'),
|
||||
default => $this->translator->trans('tree.root_node.text'),
|
||||
};
|
||||
return $this->elementTypeNameGenerator->typeLabelPlural($class);
|
||||
}
|
||||
|
||||
protected function entityClassToRootNodeIcon(string $class): ?string
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ class PermissionPresetsHelper
|
|||
$this->permissionResolver->setAllOperationsOfPermission($perm_holder, 'attachment_types', PermissionData::ALLOW);
|
||||
$this->permissionResolver->setAllOperationsOfPermission($perm_holder, 'currencies', PermissionData::ALLOW);
|
||||
$this->permissionResolver->setAllOperationsOfPermission($perm_holder, 'measurement_units', PermissionData::ALLOW);
|
||||
$this->permissionResolver->setAllOperationsOfPermission($perm_holder, 'part_custom_states', PermissionData::ALLOW);
|
||||
$this->permissionResolver->setAllOperationsOfPermission($perm_holder, 'suppliers', PermissionData::ALLOW);
|
||||
$this->permissionResolver->setAllOperationsOfPermission($perm_holder, 'projects', PermissionData::ALLOW);
|
||||
|
||||
|
|
@ -131,6 +132,7 @@ class PermissionPresetsHelper
|
|||
$this->permissionResolver->setAllOperationsOfPermissionExcept($permHolder, 'attachment_types', PermissionData::ALLOW, ['import']);
|
||||
$this->permissionResolver->setAllOperationsOfPermissionExcept($permHolder, 'currencies', PermissionData::ALLOW, ['import']);
|
||||
$this->permissionResolver->setAllOperationsOfPermissionExcept($permHolder, 'measurement_units', PermissionData::ALLOW, ['import']);
|
||||
$this->permissionResolver->setAllOperationsOfPermissionExcept($permHolder, 'part_custom_states', PermissionData::ALLOW, ['import']);
|
||||
$this->permissionResolver->setAllOperationsOfPermissionExcept($permHolder, 'suppliers', PermissionData::ALLOW, ['import']);
|
||||
$this->permissionResolver->setAllOperationsOfPermissionExcept($permHolder, 'projects', PermissionData::ALLOW, ['import']);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue