diff --git a/config/permissions.yaml b/config/permissions.yaml index 8709fdb7..2423177d 100644 --- a/config/permissions.yaml +++ b/config/permissions.yaml @@ -24,7 +24,7 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co label: "perm.read" # If a part can be read by a user, he can also see all the datastructures (except devices) alsoSet: ['storelocations.read', 'footprints.read', 'categories.read', 'suppliers.read', 'manufacturers.read', - 'currencies.read', 'attachment_types.read', 'measurement_units.read'] + 'currencies.read', 'attachment_types.read', 'measurement_units.read', 'part_custom_states.read'] apiTokenRole: ROLE_API_READ_ONLY edit: label: "perm.edit" @@ -137,6 +137,10 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co <<: *PART_CONTAINING label: "perm.measurement_units" + part_custom_states: + <<: *PART_CONTAINING + label: "perm.part_custom_states" + tools: label: "perm.part.tools" operations: diff --git a/docs/configuration.md b/docs/configuration.md index 41fbcd6b..ea02b227 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -142,7 +142,7 @@ bundled with Part-DB. Set `DATABASE_MYSQL_SSL_VERIFY_CERT` if you want to accept * `TABLE_PARTS_DEFAULT_COLUMNS`: The columns in parts tables, which are visible by default (when loading table for first time). Also specify the default order of the columns. This is a comma separated list of column names. Available columns - are: `name`, `id`, `ipn`, `description`, `category`, `footprint`, `manufacturer`, `storage_location`, `amount`, `minamount`, `partUnit`, `addedDate`, `lastModified`, `needs_review`, `favorite`, `manufacturing_status`, `manufacturer_product_number`, `mass`, `tags`, `attachments`, `edit`. + are: `name`, `id`, `ipn`, `description`, `category`, `footprint`, `manufacturer`, `storage_location`, `amount`, `minamount`, `partUnit`, `partCustomState`, `addedDate`, `lastModified`, `needs_review`, `favorite`, `manufacturing_status`, `manufacturer_product_number`, `mass`, `tags`, `attachments`, `edit`. * `TABLE_ASSEMBLIES_DEFAULT_COLUMNS`: The columns in assemblies tables, which are visible by default (when loading table for first time). Also specify the default order of the columns. This is a comma separated list of column names. Available columns are: `name`, `id`, `ipn`, `description`, `referencedAssemblies`, `edit`, `addedDate`, `lastModified`. diff --git a/migrations/Version20250321075747.php b/migrations/Version20250321075747.php new file mode 100644 index 00000000..45b35397 --- /dev/null +++ b/migrations/Version20250321075747.php @@ -0,0 +1,23 @@ +addSql('CREATE TABLE `part_custom_states` (id INT AUTO_INCREMENT NOT NULL, parent_id INT DEFAULT NULL, name VARCHAR(255) NOT NULL, comment LONGTEXT NOT NULL, not_selectable TINYINT(1) NOT NULL, alternative_names LONGTEXT DEFAULT NULL, last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, INDEX IDX_F552745D727ACA70 (parent_id), INDEX part_custom_state_name (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci`'); + $this->addSql('ALTER TABLE `part_custom_states` ADD CONSTRAINT FK_F552745D727ACA70 FOREIGN KEY (parent_id) REFERENCES `part_custom_states` (id)'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE `part_custom_states` DROP FOREIGN KEY FK_F552745D727ACA70'); + $this->addSql('DROP TABLE `part_custom_states`'); + } +} diff --git a/migrations/Version20250321141740.php b/migrations/Version20250321141740.php new file mode 100644 index 00000000..cd1aefdc --- /dev/null +++ b/migrations/Version20250321141740.php @@ -0,0 +1,25 @@ +addSql('ALTER TABLE parts ADD id_part_custom_state INT DEFAULT NULL AFTER id_part_unit'); + $this->addSql('ALTER TABLE parts ADD CONSTRAINT FK_6940A7FEA3ED1215 FOREIGN KEY (id_part_custom_state) REFERENCES `part_custom_states` (id)'); + $this->addSql('CREATE INDEX IDX_6940A7FEA3ED1215 ON parts (id_part_custom_state)'); + } + + public function down(Schema $schema): void + { + $this->addSql('ALTER TABLE `parts` DROP FOREIGN KEY FK_6940A7FEA3ED1215'); + $this->addSql('DROP INDEX IDX_6940A7FEA3ED1215 ON `parts`'); + $this->addSql('ALTER TABLE `parts` DROP id_part_custom_state'); + } +} diff --git a/src/Command/Migrations/ImportPartKeeprCommand.php b/src/Command/Migrations/ImportPartKeeprCommand.php index aee71afe..429f018d 100644 --- a/src/Command/Migrations/ImportPartKeeprCommand.php +++ b/src/Command/Migrations/ImportPartKeeprCommand.php @@ -121,6 +121,11 @@ class ImportPartKeeprCommand extends Command $count = $this->datastructureImporter->importPartUnits($data); $io->success('Imported '.$count.' measurement units.'); + //Import the custom states + $io->info('Importing custom states...'); + $count = $this->datastructureImporter->importPartCustomStates($data); + $io->success('Imported '.$count.' custom states.'); + //Import manufacturers $io->info('Importing manufacturers...'); $count = $this->datastructureImporter->importManufacturers($data); diff --git a/src/Controller/AdminPages/BaseAdminController.php b/src/Controller/AdminPages/BaseAdminController.php index 039751ea..ddf19088 100644 --- a/src/Controller/AdminPages/BaseAdminController.php +++ b/src/Controller/AdminPages/BaseAdminController.php @@ -233,13 +233,6 @@ abstract class BaseAdminController extends AbstractController $repo = $this->entityManager->getRepository($this->entity_class); - $showParameters = true; - if ($this instanceof AssemblyAdminController) { - //currently not needed for assemblies - - $showParameters = false; - } - return $this->render($this->twig_template, [ 'entity' => $entity, 'form' => $form, @@ -249,7 +242,7 @@ abstract class BaseAdminController extends AbstractController 'timeTravel' => $timeTravel_timestamp, 'repo' => $repo, 'partsContainingElement' => $repo instanceof PartsContainingRepositoryInterface, - 'showParameters' => $showParameters, + 'showParameters' => !($this instanceof PartCustomStateController), ]); } @@ -403,20 +396,13 @@ abstract class BaseAdminController extends AbstractController } } - $showParameters = true; - if ($this instanceof AssemblyAdminController) { - //currently not needed for assemblies - - $showParameters = false; - } - return $this->render($this->twig_template, [ 'entity' => $new_entity, 'form' => $form, 'import_form' => $import_form, 'mass_creation_form' => $mass_creation_form, 'route_base' => $this->route_base, - 'showParameters' => $showParameters, + 'showParameters' => !($this instanceof PartCustomStateController), ]); } diff --git a/src/DataTables/Filters/PartFilter.php b/src/DataTables/Filters/PartFilter.php index e44cf69d..cf185dfd 100644 --- a/src/DataTables/Filters/PartFilter.php +++ b/src/DataTables/Filters/PartFilter.php @@ -41,6 +41,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\PartLot; use App\Entity\Parts\StorageLocation; use App\Entity\Parts\Supplier; @@ -86,6 +87,7 @@ class PartFilter implements FilterInterface public readonly EntityConstraint $lotOwner; public readonly EntityConstraint $measurementUnit; + public readonly EntityConstraint $partCustomState; public readonly TextConstraint $manufacturer_product_url; public readonly TextConstraint $manufacturer_product_number; public readonly IntConstraint $attachmentsCount; @@ -128,6 +130,7 @@ class PartFilter implements FilterInterface $this->favorite = new BooleanConstraint('part.favorite'); $this->needsReview = new BooleanConstraint('part.needs_review'); $this->measurementUnit = new EntityConstraint($nodesListBuilder, MeasurementUnit::class, 'part.partUnit'); + $this->partCustomState = new EntityConstraint($nodesListBuilder, PartCustomState::class, 'part.partCustomState'); $this->mass = new NumberConstraint('part.mass'); $this->dbId = new IntConstraint('part.id'); $this->ipn = new TextConstraint('part.ipn'); diff --git a/src/DataTables/PartsDataTable.php b/src/DataTables/PartsDataTable.php index 7c205d1f..fd798620 100644 --- a/src/DataTables/PartsDataTable.php +++ b/src/DataTables/PartsDataTable.php @@ -175,6 +175,19 @@ final class PartsDataTable implements DataTableTypeInterface return $tmp; } ]) + ->add('partCustomState', TextColumn::class, [ + 'label' => $this->translator->trans('part.table.partCustomState'), + 'orderField' => 'NATSORT(_partCustomState.name)', + 'render' => function($value, Part $context): string { + $partCustomState = $context->getPartCustomState(); + + if ($partCustomState === null) { + return ''; + } + + return htmlspecialchars($partCustomState->getName()); + } + ]) ->add('addedDate', LocaleDateTimeColumn::class, [ 'label' => $this->translator->trans('part.table.addedDate'), ]) @@ -338,6 +351,7 @@ final class PartsDataTable implements DataTableTypeInterface ->addSelect('footprint') ->addSelect('manufacturer') ->addSelect('partUnit') + ->addSelect('partCustomState') ->addSelect('master_picture_attachment') ->addSelect('footprint_attachment') ->addSelect('partLots') @@ -356,6 +370,7 @@ final class PartsDataTable implements DataTableTypeInterface ->leftJoin('orderdetails.supplier', 'suppliers') ->leftJoin('part.attachments', 'attachments') ->leftJoin('part.partUnit', 'partUnit') + ->leftJoin('part.partCustomState', 'partCustomState') ->leftJoin('part.parameters', 'parameters') ->where('part.id IN (:ids)') ->setParameter('ids', $ids) @@ -373,6 +388,7 @@ final class PartsDataTable implements DataTableTypeInterface ->addGroupBy('suppliers') ->addGroupBy('attachments') ->addGroupBy('partUnit') + ->addGroupBy('partCustomState') ->addGroupBy('parameters'); //Get the results in the same order as the IDs were passed @@ -444,6 +460,10 @@ final class PartsDataTable implements DataTableTypeInterface $builder->leftJoin('part.partUnit', '_partUnit'); $builder->addGroupBy('_partUnit'); } + if (str_contains($dql, '_partCustomState')) { + $builder->leftJoin('part.partCustomState', '_partCustomState'); + $builder->addGroupBy('_partCustomState'); + } if (str_contains($dql, '_parameters')) { $builder->leftJoin('part.parameters', '_parameters'); //Do not group by many-to-* relations, as it would restrict the COUNT having clauses to be maximum 1 diff --git a/src/Entity/Attachments/Attachment.php b/src/Entity/Attachments/Attachment.php index 808c6062..70ffbaa0 100644 --- a/src/Entity/Attachments/Attachment.php +++ b/src/Entity/Attachments/Attachment.php @@ -97,7 +97,7 @@ use function in_array; #[DiscriminatorMap(typeProperty: '_type', mapping: self::API_DISCRIMINATOR_MAP)] abstract class Attachment extends AbstractNamedDBElement { - private const ORM_DISCRIMINATOR_MAP = ['Part' => PartAttachment::class, 'Device' => ProjectAttachment::class, 'Assembly' => AssemblyAttachment::class, + private const ORM_DISCRIMINATOR_MAP = ['Part' => PartAttachment::class, 'PartCustomState' => PartCustomStateAttachment::class, 'Device' => ProjectAttachment::class, 'Assembly' => AssemblyAttachment::class, 'AttachmentType' => AttachmentTypeAttachment::class, 'Category' => CategoryAttachment::class, 'Footprint' => FootprintAttachment::class, 'Manufacturer' => ManufacturerAttachment::class, 'Currency' => CurrencyAttachment::class, 'Group' => GroupAttachment::class, 'MeasurementUnit' => MeasurementUnitAttachment::class, @@ -107,7 +107,7 @@ abstract class Attachment extends AbstractNamedDBElement /* * The discriminator map used for API platform. The key should be the same as the api platform short type (the @type JSONLD field). */ - private const API_DISCRIMINATOR_MAP = ["Part" => PartAttachment::class, "Project" => ProjectAttachment::class, "Assembly" => AssemblyAttachment::class, + private const API_DISCRIMINATOR_MAP = ["Part" => PartAttachment::class, "PartCustomState" => PartCustomStateAttachment::class, "Project" => ProjectAttachment::class, "Assembly" => AssemblyAttachment::class, "AttachmentType" => AttachmentTypeAttachment::class, "Category" => CategoryAttachment::class, "Footprint" => FootprintAttachment::class, "Manufacturer" => ManufacturerAttachment::class, "Currency" => CurrencyAttachment::class, "Group" => GroupAttachment::class, "MeasurementUnit" => MeasurementUnitAttachment::class, @@ -551,8 +551,8 @@ abstract class Attachment extends AbstractNamedDBElement */ #[Groups(['attachment:write'])] #[SerializedName('url')] - #[ApiProperty(description: 'Set the path of the attachment here. - Provide either an external URL, a path to a builtin file (like %FOOTPRINTS%/Active/ICs/IC_DFS.png) or an empty + #[ApiProperty(description: 'Set the path of the attachment here. + Provide either an external URL, a path to a builtin file (like %FOOTPRINTS%/Active/ICs/IC_DFS.png) or an empty string if the attachment has an internal file associated and you\'d like to reset the external source. If you set a new (nonempty) file path any associated internal file will be removed!')] public function setURL(?string $url): self diff --git a/src/Entity/Attachments/PartCustomStateAttachment.php b/src/Entity/Attachments/PartCustomStateAttachment.php new file mode 100644 index 00000000..3a561b13 --- /dev/null +++ b/src/Entity/Attachments/PartCustomStateAttachment.php @@ -0,0 +1,45 @@ +. + */ + +declare(strict_types=1); + +namespace App\Entity\Attachments; + +use App\Entity\Parts\PartCustomState; +use App\Serializer\APIPlatform\OverrideClassDenormalizer; +use Doctrine\ORM\Mapping as ORM; +use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; +use Symfony\Component\Serializer\Attribute\Context; + +/** + * An attachment attached to a part custom state element. + * @extends Attachment + */ +#[UniqueEntity(['name', 'attachment_type', 'element'])] +#[ORM\Entity] +class PartCustomStateAttachment extends Attachment +{ + final public const ALLOWED_ELEMENT_CLASS = PartCustomState::class; + + #[ORM\ManyToOne(targetEntity: PartCustomState::class, inversedBy: 'attachments')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] + #[Context(denormalizationContext: [OverrideClassDenormalizer::CONTEXT_KEY => self::ALLOWED_ELEMENT_CLASS])] + protected ?AttachmentContainingDBElement $element = null; +} diff --git a/src/Entity/Base/AbstractDBElement.php b/src/Entity/Base/AbstractDBElement.php index ad9c534b..27d60c86 100644 --- a/src/Entity/Base/AbstractDBElement.php +++ b/src/Entity/Base/AbstractDBElement.php @@ -36,6 +36,7 @@ use App\Entity\Attachments\LabelAttachment; use App\Entity\Attachments\ManufacturerAttachment; use App\Entity\Attachments\MeasurementUnitAttachment; use App\Entity\Attachments\PartAttachment; +use App\Entity\Attachments\PartCustomStateAttachment; use App\Entity\Attachments\ProjectAttachment; use App\Entity\Attachments\StorageLocationAttachment; use App\Entity\Attachments\SupplierAttachment; @@ -43,6 +44,7 @@ use App\Entity\Attachments\UserAttachment; use App\Entity\Parameters\AbstractParameter; use App\Entity\Parts\Category; use App\Entity\PriceInformations\Pricedetail; +use App\Entity\Parts\PartCustomState; use App\Entity\ProjectSystem\Project; use App\Entity\ProjectSystem\ProjectBOMEntry; use App\Entity\Parts\Footprint; @@ -71,7 +73,41 @@ use Symfony\Component\Serializer\Annotation\Groups; * Every database table which are managed with this class (or a subclass of it) * must have the table row "id"!! The ID is the unique key to identify the elements. */ -#[DiscriminatorMap(typeProperty: 'type', mapping: ['attachment_type' => AttachmentType::class, 'attachment' => Attachment::class, 'attachment_type_attachment' => AttachmentTypeAttachment::class, 'category_attachment' => CategoryAttachment::class, 'currency_attachment' => CurrencyAttachment::class, 'footprint_attachment' => FootprintAttachment::class, 'group_attachment' => GroupAttachment::class, 'label_attachment' => LabelAttachment::class, 'manufacturer_attachment' => ManufacturerAttachment::class, 'measurement_unit_attachment' => MeasurementUnitAttachment::class, 'part_attachment' => PartAttachment::class, 'project_attachment' => ProjectAttachment::class, 'assembly_attachment' => AssemblyAttachment::class, 'storelocation_attachment' => StorageLocationAttachment::class, 'supplier_attachment' => SupplierAttachment::class, 'user_attachment' => UserAttachment::class, 'category' => Category::class, 'project' => Project::class, 'project_bom_entry' => ProjectBOMEntry::class, 'assembly' => Assembly::class, 'assembly_bom_entry' => AssemblyBOMEntry::class, 'footprint' => Footprint::class, 'group' => Group::class, 'manufacturer' => Manufacturer::class, 'orderdetail' => Orderdetail::class, 'part' => Part::class, 'pricedetail' => Pricedetail::class, 'storelocation' => StorageLocation::class, 'part_lot' => PartLot::class, 'currency' => Currency::class, 'measurement_unit' => MeasurementUnit::class, 'parameter' => AbstractParameter::class, 'supplier' => Supplier::class, 'user' => User::class])] +#[DiscriminatorMap(typeProperty: 'type', mapping: [ + 'attachment_type' => AttachmentType::class, + 'attachment' => Attachment::class, + 'attachment_type_attachment' => AttachmentTypeAttachment::class, + 'category_attachment' => CategoryAttachment::class, + 'currency_attachment' => CurrencyAttachment::class, + 'footprint_attachment' => FootprintAttachment::class, + 'group_attachment' => GroupAttachment::class, + 'label_attachment' => LabelAttachment::class, + 'manufacturer_attachment' => ManufacturerAttachment::class, + 'measurement_unit_attachment' => MeasurementUnitAttachment::class, + 'part_attachment' => PartAttachment::class, + 'part_custom_state_attachment' => PartCustomStateAttachment::class, + 'project_attachment' => ProjectAttachment::class, + 'storelocation_attachment' => StorageLocationAttachment::class, + 'supplier_attachment' => SupplierAttachment::class, + 'user_attachment' => UserAttachment::class, + 'category' => Category::class, + 'project' => Project::class, + 'project_bom_entry' => ProjectBOMEntry::class, + 'footprint' => Footprint::class, + 'group' => Group::class, + 'manufacturer' => Manufacturer::class, + 'orderdetail' => Orderdetail::class, + 'part' => Part::class, + 'part_custom_state' => PartCustomState::class, + 'pricedetail' => Pricedetail::class, + 'storelocation' => StorageLocation::class, + 'part_lot' => PartLot::class, + 'currency' => Currency::class, + 'measurement_unit' => MeasurementUnit::class, + 'parameter' => AbstractParameter::class, + 'supplier' => Supplier::class, + 'user' => User::class] +)] #[ORM\MappedSuperclass(repositoryClass: DBElementRepository::class)] abstract class AbstractDBElement implements JsonSerializable { diff --git a/src/Entity/LogSystem/CollectionElementDeleted.php b/src/Entity/LogSystem/CollectionElementDeleted.php index be19bb0c..15e0001e 100644 --- a/src/Entity/LogSystem/CollectionElementDeleted.php +++ b/src/Entity/LogSystem/CollectionElementDeleted.php @@ -48,6 +48,7 @@ use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\AttachmentTypeAttachment; use App\Entity\Attachments\CategoryAttachment; use App\Entity\Attachments\CurrencyAttachment; +use App\Entity\Attachments\PartCustomStateAttachment; use App\Entity\Attachments\ProjectAttachment; use App\Entity\Attachments\FootprintAttachment; use App\Entity\Attachments\GroupAttachment; @@ -60,6 +61,8 @@ use App\Entity\Attachments\UserAttachment; use App\Entity\Base\AbstractDBElement; use App\Entity\Contracts\LogWithEventUndoInterface; use App\Entity\Contracts\NamedElementInterface; +use App\Entity\Parameters\PartCustomStateParameter; +use App\Entity\Parts\PartCustomState; use App\Entity\Parameters\AssemblyParameter; use App\Entity\ProjectSystem\Project; use App\Entity\Parameters\AbstractParameter; @@ -162,6 +165,7 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU Part::class => PartParameter::class, StorageLocation::class => StorageLocationParameter::class, Supplier::class => SupplierParameter::class, + PartCustomState::class => PartCustomStateParameter::class, default => throw new \RuntimeException('Unknown target class for parameter: '.$this->getTargetClass()), }; } @@ -178,6 +182,7 @@ class CollectionElementDeleted extends AbstractLogEntry implements LogWithEventU Manufacturer::class => ManufacturerAttachment::class, MeasurementUnit::class => MeasurementUnitAttachment::class, Part::class => PartAttachment::class, + PartCustomState::class => PartCustomStateAttachment::class, StorageLocation::class => StorageLocationAttachment::class, Supplier::class => SupplierAttachment::class, User::class => UserAttachment::class, diff --git a/src/Entity/LogSystem/LogTargetType.php b/src/Entity/LogSystem/LogTargetType.php index f926cc75..72efe6c7 100644 --- a/src/Entity/LogSystem/LogTargetType.php +++ b/src/Entity/LogSystem/LogTargetType.php @@ -34,6 +34,7 @@ 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; @@ -75,6 +76,7 @@ enum LogTargetType: int case BULK_INFO_PROVIDER_IMPORT_JOB_PART = 22; case ASSEMBLY = 23; case ASSEMBLY_BOM_ENTRY = 24; + case PART_CUSTOM_STATE = 25; /** * Returns the class name of the target type or null if the target type is NONE. @@ -108,6 +110,7 @@ enum LogTargetType: int self::PART_ASSOCIATION => PartAssociation::class, self::BULK_INFO_PROVIDER_IMPORT_JOB => BulkInfoProviderImportJob::class, self::BULK_INFO_PROVIDER_IMPORT_JOB_PART => BulkInfoProviderImportJobPart::class, + self::PART_CUSTOM_STATE => PartCustomState::class }; } diff --git a/src/Entity/Parameters/AbstractParameter.php b/src/Entity/Parameters/AbstractParameter.php index b6ef0412..8170d3e3 100644 --- a/src/Entity/Parameters/AbstractParameter.php +++ b/src/Entity/Parameters/AbstractParameter.php @@ -73,7 +73,8 @@ use function sprintf; #[ORM\DiscriminatorMap([0 => CategoryParameter::class, 1 => CurrencyParameter::class, 2 => ProjectParameter::class, 3 => FootprintParameter::class, 4 => GroupParameter::class, 5 => ManufacturerParameter::class, 6 => MeasurementUnitParameter::class, 7 => PartParameter::class, 8 => StorageLocationParameter::class, - 9 => SupplierParameter::class, 10 => AttachmentTypeParameter::class, 11 => AssemblyParameter::class])] + 9 => SupplierParameter::class, 10 => AttachmentTypeParameter::class, 11 => AssemblyParameter::class, + 12 => PartCustomStateParameter::class])] #[ORM\Table('parameters')] #[ORM\Index(columns: ['name'], name: 'parameter_name_idx')] #[ORM\Index(columns: ['param_group'], name: 'parameter_group_idx')] @@ -105,7 +106,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu "AttachmentType" => AttachmentTypeParameter::class, "Category" => CategoryParameter::class, "Currency" => CurrencyParameter::class, "Project" => ProjectParameter::class, "Assembly" => AssemblyParameter::class, "Footprint" => FootprintParameter::class, "Group" => GroupParameter::class, "Manufacturer" => ManufacturerParameter::class, "MeasurementUnit" => MeasurementUnitParameter::class, - "StorageLocation" => StorageLocationParameter::class, "Supplier" => SupplierParameter::class]; + "StorageLocation" => StorageLocationParameter::class, "Supplier" => SupplierParameter::class, "PartCustomState" => PartCustomStateParameter::class]; /** * @var string The class of the element that can be passed to this attachment. Must be overridden in subclasses. @@ -460,7 +461,7 @@ abstract class AbstractParameter extends AbstractNamedDBElement implements Uniqu return $str; } - + /** * Returns the class of the element that is allowed to be associated with this attachment. * @return string diff --git a/src/Entity/Parameters/PartCustomStateParameter.php b/src/Entity/Parameters/PartCustomStateParameter.php new file mode 100644 index 00000000..ceedf7b4 --- /dev/null +++ b/src/Entity/Parameters/PartCustomStateParameter.php @@ -0,0 +1,65 @@ +. + */ + +declare(strict_types=1); + +/** + * 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 . + */ + +namespace App\Entity\Parameters; + +use App\Entity\Base\AbstractDBElement; +use App\Entity\Parts\PartCustomState; +use App\Repository\ParameterRepository; +use App\Serializer\APIPlatform\OverrideClassDenormalizer; +use Doctrine\ORM\Mapping as ORM; +use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; +use Symfony\Component\Serializer\Attribute\Context; + +#[UniqueEntity(fields: ['name', 'group', 'element'])] +#[ORM\Entity(repositoryClass: ParameterRepository::class)] +class PartCustomStateParameter extends AbstractParameter +{ + final public const ALLOWED_ELEMENT_CLASS = PartCustomState::class; + + /** + * @var PartCustomState the element this para is associated with + */ + #[ORM\ManyToOne(targetEntity: PartCustomState::class, inversedBy: 'parameters')] + #[ORM\JoinColumn(name: 'element_id', nullable: false, onDelete: 'CASCADE')] + #[Context(denormalizationContext: [OverrideClassDenormalizer::CONTEXT_KEY => self::ALLOWED_ELEMENT_CLASS])] + protected ?AbstractDBElement $element = null; +} diff --git a/src/Entity/Parts/Part.php b/src/Entity/Parts/Part.php index 1a5ab17d..b0824fc8 100644 --- a/src/Entity/Parts/Part.php +++ b/src/Entity/Parts/Part.php @@ -106,7 +106,7 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface; denormalizationContext: ['groups' => ['part:write', 'api:basic:write', 'eda_info:write', 'attachment:write', 'parameter:write'], 'openapi_definition_name' => 'Write'], )] #[ApiFilter(PropertyFilter::class)] -#[ApiFilter(EntityFilter::class, properties: ["category", "footprint", "manufacturer", "partUnit"])] +#[ApiFilter(EntityFilter::class, properties: ["category", "footprint", "manufacturer", "partUnit", "partCustomState"])] #[ApiFilter(PartStoragelocationFilter::class, properties: ["storage_location"])] #[ApiFilter(LikeFilter::class, properties: ["name", "comment", "description", "ipn", "manufacturer_product_number"])] #[ApiFilter(TagFilter::class, properties: ["tags"])] diff --git a/src/Entity/Parts/PartCustomState.php b/src/Entity/Parts/PartCustomState.php new file mode 100644 index 00000000..dac7fe58 --- /dev/null +++ b/src/Entity/Parts/PartCustomState.php @@ -0,0 +1,121 @@ +. + */ + +declare(strict_types=1); + +namespace App\Entity\Parts; + +use ApiPlatform\Metadata\ApiProperty; +use App\Entity\Attachments\PartCustomStateAttachment; +use ApiPlatform\Doctrine\Common\Filter\DateFilterInterface; +use ApiPlatform\Doctrine\Orm\Filter\DateFilter; +use ApiPlatform\Doctrine\Orm\Filter\OrderFilter; +use ApiPlatform\Metadata\ApiFilter; +use ApiPlatform\Metadata\ApiResource; +use ApiPlatform\Metadata\Delete; +use ApiPlatform\Metadata\Get; +use ApiPlatform\Metadata\GetCollection; +use ApiPlatform\Metadata\Patch; +use ApiPlatform\Metadata\Post; +use ApiPlatform\Serializer\Filter\PropertyFilter; +use App\ApiPlatform\Filter\LikeFilter; +use App\Entity\Base\AbstractPartsContainingDBElement; +use App\Entity\Base\AbstractStructuralDBElement; +use App\Entity\Parameters\PartCustomStateParameter; +use App\Repository\Parts\PartCustomStateRepository; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\Common\Collections\Collection; +use Doctrine\Common\Collections\Criteria; +use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Validator\Constraints as Assert; + +/** + * This entity represents a custom part state. + * If an organisation uses Part-DB and has its custom part states, this is useful. + * + * @extends AbstractPartsContainingDBElement + */ +#[ORM\Entity(repositoryClass: PartCustomStateRepository::class)] +#[ORM\Table('`part_custom_states`')] +#[ORM\Index(columns: ['name'], name: 'part_custom_state_name')] +#[ApiResource( + operations: [ + new Get(security: 'is_granted("read", object)'), + new GetCollection(security: 'is_granted("@part_custom_states.read")'), + new Post(securityPostDenormalize: 'is_granted("create", object)'), + new Patch(security: 'is_granted("edit", object)'), + new Delete(security: 'is_granted("delete", object)'), + ], + normalizationContext: ['groups' => ['part_custom_state:read', 'api:basic:read'], 'openapi_definition_name' => 'Read'], + denormalizationContext: ['groups' => ['part_custom_state:write', 'api:basic:write'], 'openapi_definition_name' => 'Write'], +)] +#[ApiFilter(PropertyFilter::class)] +#[ApiFilter(LikeFilter::class, properties: ["name"])] +#[ApiFilter(DateFilter::class, strategy: DateFilterInterface::EXCLUDE_NULL)] +#[ApiFilter(OrderFilter::class, properties: ['name', 'id', 'addedDate', 'lastModified'])] +class PartCustomState extends AbstractPartsContainingDBElement +{ + /** + * @var string The comment info for this element as markdown + */ + #[Groups(['part_custom_state:read', 'part_custom_state:write', 'full', 'import'])] + protected string $comment = ''; + + #[ORM\OneToMany(mappedBy: 'parent', targetEntity: self::class, cascade: ['persist'])] + #[ORM\OrderBy(['name' => Criteria::ASC])] + protected Collection $children; + + #[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')] + #[ORM\JoinColumn(name: 'parent_id')] + #[Groups(['part_custom_state:read', 'part_custom_state:write'])] + #[ApiProperty(readableLink: false, writableLink: false)] + protected ?AbstractStructuralDBElement $parent = null; + + /** + * @var Collection + */ + #[Assert\Valid] + #[ORM\OneToMany(targetEntity: PartCustomStateAttachment::class, mappedBy: 'element', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['name' => Criteria::ASC])] + #[Groups(['part_custom_state:read', 'part_custom_state:write'])] + protected Collection $attachments; + + /** @var Collection + */ + #[Assert\Valid] + #[ORM\OneToMany(mappedBy: 'element', targetEntity: PartCustomStateAttachment::class, cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['name' => 'ASC'])] + #[Groups(['part_custom_state:read', 'part_custom_state:write'])] + protected Collection $parameters; + + #[Groups(['part_custom_state:read'])] + protected ?\DateTimeImmutable $addedDate = null; + #[Groups(['part_custom_state:read'])] + protected ?\DateTimeImmutable $lastModified = null; + + public function __construct() + { + parent::__construct(); + $this->children = new ArrayCollection(); + $this->attachments = new ArrayCollection(); + $this->parameters = new ArrayCollection(); + } +} diff --git a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php index 5605ef59..b4138f93 100644 --- a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php +++ b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace App\Entity\Parts\PartTraits; use App\Entity\Parts\InfoProviderReference; +use App\Entity\Parts\PartCustomState; use Doctrine\DBAL\Types\Types; use App\Entity\Parts\Part; use Doctrine\ORM\Mapping as ORM; @@ -75,6 +76,14 @@ trait AdvancedPropertyTrait #[Groups(['full', 'part:read'])] protected InfoProviderReference $providerReference; + /** + * @var ?PartCustomState the custom state for the part + */ + #[Groups(['extended', 'full', 'import', 'part:read', 'part:write'])] + #[ORM\ManyToOne(targetEntity: PartCustomState::class)] + #[ORM\JoinColumn(name: 'id_part_custom_state')] + protected ?PartCustomState $partCustomState = null; + /** * Checks if this part is marked, for that it needs further review. */ @@ -182,7 +191,24 @@ trait AdvancedPropertyTrait return $this; } + /** + * Gets the custom part state for the part + * Returns null if no specific part state is set. + */ + public function getPartCustomState(): ?PartCustomState + { + return $this->partCustomState; + } + /** + * Sets the custom part state. + * + * @return $this + */ + public function setPartCustomState(?PartCustomState $partCustomState): self + { + $this->partCustomState = $partCustomState; - + return $this; + } } diff --git a/src/Form/AdminPages/PartCustomStateAdminForm.php b/src/Form/AdminPages/PartCustomStateAdminForm.php new file mode 100644 index 00000000..b8bb2815 --- /dev/null +++ b/src/Form/AdminPages/PartCustomStateAdminForm.php @@ -0,0 +1,27 @@ +. + */ + +declare(strict_types=1); + +namespace App\Form\AdminPages; + +class PartCustomStateAdminForm extends BaseEntityAdminForm +{ +} diff --git a/src/Form/Filters/PartFilterType.php b/src/Form/Filters/PartFilterType.php index 871f9b07..e101c635 100644 --- a/src/Form/Filters/PartFilterType.php +++ b/src/Form/Filters/PartFilterType.php @@ -32,6 +32,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 App\Entity\ProjectSystem\Project; @@ -139,6 +140,11 @@ class PartFilterType extends AbstractType 'entity_class' => MeasurementUnit::class ]); + $builder->add('partCustomState', StructuralEntityConstraintType::class, [ + 'label' => 'part.edit.partCustomState', + 'entity_class' => PartCustomState::class + ]); + $builder->add('lastModified', DateTimeConstraintType::class, [ 'label' => 'lastModified' ]); diff --git a/src/Form/Part/PartBaseType.php b/src/Form/Part/PartBaseType.php index c493f12b..1c904eaa 100644 --- a/src/Form/Part/PartBaseType.php +++ b/src/Form/Part/PartBaseType.php @@ -30,6 +30,7 @@ use App\Entity\Parts\Manufacturer; use App\Entity\Parts\ManufacturingStatus; use App\Entity\Parts\MeasurementUnit; use App\Entity\Parts\Part; +use App\Entity\Parts\PartCustomState; use App\Entity\PriceInformations\Orderdetail; use App\Form\AttachmentFormType; use App\Form\ParameterType; @@ -175,6 +176,12 @@ class PartBaseType extends AbstractType 'disable_not_selectable' => true, 'label' => 'part.edit.partUnit', ]) + ->add('partCustomState', StructuralEntityType::class, [ + 'class' => PartCustomState::class, + 'required' => false, + 'disable_not_selectable' => true, + 'label' => 'part.edit.partCustomState', + ]) ->add('ipn', TextType::class, [ 'required' => false, 'empty_data' => null, diff --git a/src/Repository/Parts/PartCustomStateRepository.php b/src/Repository/Parts/PartCustomStateRepository.php new file mode 100644 index 00000000..d66221a2 --- /dev/null +++ b/src/Repository/Parts/PartCustomStateRepository.php @@ -0,0 +1,48 @@ +. + */ +namespace App\Repository\Parts; + +use App\Entity\Parts\PartCustomState; +use App\Repository\AbstractPartsContainingRepository; +use InvalidArgumentException; + +class PartCustomStateRepository extends AbstractPartsContainingRepository +{ + public function getParts(object $element, string $nameOrderDirection = "ASC"): array + { + if (!$element instanceof PartCustomState) { + throw new InvalidArgumentException('$element must be an PartCustomState!'); + } + + return $this->getPartsByField($element, $nameOrderDirection, 'partUnit'); + } + + public function getPartsCount(object $element): int + { + if (!$element instanceof PartCustomState) { + throw new InvalidArgumentException('$element must be an PartCustomState!'); + } + + return $this->getPartsCountByField($element, 'partUnit'); + } +} diff --git a/src/Security/Voter/AttachmentVoter.php b/src/Security/Voter/AttachmentVoter.php index 766aaeac..c233a236 100644 --- a/src/Security/Voter/AttachmentVoter.php +++ b/src/Security/Voter/AttachmentVoter.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace App\Security\Voter; use App\Entity\Attachments\AssemblyAttachment; +use App\Entity\Attachments\PartCustomStateAttachment; use App\Services\UserSystem\VoterHelper; use Symfony\Bundle\SecurityBundle\Security; use App\Entity\Attachments\AttachmentContainingDBElement; @@ -102,6 +103,8 @@ final class AttachmentVoter extends Voter $param = 'measurement_units'; } elseif (is_a($subject, PartAttachment::class, true)) { $param = 'parts'; + } elseif (is_a($subject, PartCustomStateAttachment::class, true)) { + $param = 'part_custom_states'; } elseif (is_a($subject, StorageLocationAttachment::class, true)) { $param = 'storelocations'; } elseif (is_a($subject, SupplierAttachment::class, true)) { diff --git a/src/Security/Voter/ParameterVoter.php b/src/Security/Voter/ParameterVoter.php index f59bdeaf..5dc30ea2 100644 --- a/src/Security/Voter/ParameterVoter.php +++ b/src/Security/Voter/ParameterVoter.php @@ -22,6 +22,7 @@ declare(strict_types=1); */ namespace App\Security\Voter; +use App\Entity\Parameters\PartCustomStateParameter; use App\Services\UserSystem\VoterHelper; use Symfony\Bundle\SecurityBundle\Security; use App\Entity\Base\AbstractDBElement; @@ -97,6 +98,8 @@ final class ParameterVoter extends Voter $param = 'measurement_units'; } elseif (is_a($subject, PartParameter::class, true)) { $param = 'parts'; + } elseif (is_a($subject, PartCustomStateParameter::class, true)) { + $param = 'part_custom_states'; } elseif (is_a($subject, StorageLocationParameter::class, true)) { $param = 'storelocations'; } elseif (is_a($subject, SupplierParameter::class, true)) { diff --git a/src/Security/Voter/StructureVoter.php b/src/Security/Voter/StructureVoter.php index 8079757c..cb05ffdd 100644 --- a/src/Security/Voter/StructureVoter.php +++ b/src/Security/Voter/StructureVoter.php @@ -24,6 +24,7 @@ namespace App\Security\Voter; use App\Entity\AssemblySystem\Assembly; use App\Entity\Attachments\AttachmentType; +use App\Entity\Parts\PartCustomState; use App\Entity\ProjectSystem\Project; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; @@ -55,6 +56,7 @@ final class StructureVoter extends Voter Supplier::class => 'suppliers', Currency::class => 'currencies', MeasurementUnit::class => 'measurement_units', + PartCustomState::class => 'part_custom_states', ]; public function __construct(private readonly VoterHelper $helper) diff --git a/src/Services/Attachments/PartPreviewGenerator.php b/src/Services/Attachments/PartPreviewGenerator.php index ba6e5db0..ef13265f 100644 --- a/src/Services/Attachments/PartPreviewGenerator.php +++ b/src/Services/Attachments/PartPreviewGenerator.php @@ -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; @@ -103,6 +104,13 @@ class PartPreviewGenerator } } + if ($part->getPartCustomState() instanceof PartCustomState) { + $attachment = $part->getPartCustomState()->getMasterPictureAttachment(); + if ($this->isAttachmentValidPicture($attachment)) { + $list[] = $attachment; + } + } + if ($part->getManufacturer() instanceof Manufacturer) { $attachment = $part->getManufacturer()->getMasterPictureAttachment(); if ($this->isAttachmentValidPicture($attachment)) { diff --git a/src/Services/EDA/KiCadHelper.php b/src/Services/EDA/KiCadHelper.php index 75c2cc34..4b7c5e5a 100644 --- a/src/Services/EDA/KiCadHelper.php +++ b/src/Services/EDA/KiCadHelper.php @@ -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'); } diff --git a/src/Services/ElementTypeNameGenerator.php b/src/Services/ElementTypeNameGenerator.php index 32124bca..9ef2a063 100644 --- a/src/Services/ElementTypeNameGenerator.php +++ b/src/Services/ElementTypeNameGenerator.php @@ -37,6 +37,7 @@ 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; @@ -87,6 +88,7 @@ class ElementTypeNameGenerator 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'), + PartCustomState::class => $this->translator->trans('part_custom_state.label'), ]; } diff --git a/src/Services/EntityMergers/Mergers/PartMerger.php b/src/Services/EntityMergers/Mergers/PartMerger.php index 01b53e25..d1f5c137 100644 --- a/src/Services/EntityMergers/Mergers/PartMerger.php +++ b/src/Services/EntityMergers/Mergers/PartMerger.php @@ -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'); diff --git a/src/Services/EntityURLGenerator.php b/src/Services/EntityURLGenerator.php index 8e1704b4..bdf26fa9 100644 --- a/src/Services/EntityURLGenerator.php +++ b/src/Services/EntityURLGenerator.php @@ -28,6 +28,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; @@ -109,6 +110,7 @@ class EntityURLGenerator MeasurementUnit::class => 'measurement_unit_edit', Group::class => 'group_edit', LabelProfile::class => 'label_profile_edit', + PartCustomState::class => 'part_custom_state_edit', ]; try { @@ -216,6 +218,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()]); @@ -247,6 +250,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()]); @@ -279,6 +283,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)); @@ -311,6 +316,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()]); @@ -358,6 +364,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()]); diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKDatastructureImporter.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKDatastructureImporter.php index 1f842c23..9e674f05 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/PKDatastructureImporter.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKDatastructureImporter.php @@ -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'])) { diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php index 80c2dbf7..ab06a134 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php @@ -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)); diff --git a/src/Services/LabelSystem/SandboxedTwigFactory.php b/src/Services/LabelSystem/SandboxedTwigFactory.php index d6ea6968..d5e09fa5 100644 --- a/src/Services/LabelSystem/SandboxedTwigFactory.php +++ b/src/Services/LabelSystem/SandboxedTwigFactory.php @@ -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', diff --git a/src/Services/Trees/ToolsTreeBuilder.php b/src/Services/Trees/ToolsTreeBuilder.php index 78b99696..083e22f2 100644 --- a/src/Services/Trees/ToolsTreeBuilder.php +++ b/src/Services/Trees/ToolsTreeBuilder.php @@ -30,6 +30,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; @@ -231,6 +232,12 @@ class ToolsTreeBuilder $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->translator->trans('tree.tools.edit.part_custom_state'), + $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'), diff --git a/src/Services/UserSystem/PermissionPresetsHelper.php b/src/Services/UserSystem/PermissionPresetsHelper.php index 554da8b3..a6301388 100644 --- a/src/Services/UserSystem/PermissionPresetsHelper.php +++ b/src/Services/UserSystem/PermissionPresetsHelper.php @@ -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); diff --git a/src/Twig/EntityExtension.php b/src/Twig/EntityExtension.php index 086b21c5..b757d75e 100644 --- a/src/Twig/EntityExtension.php +++ b/src/Twig/EntityExtension.php @@ -25,6 +25,7 @@ namespace App\Twig; use App\Entity\AssemblySystem\Assembly; use App\Entity\Attachments\Attachment; use App\Entity\Base\AbstractDBElement; +use App\Entity\Parts\PartCustomState; use App\Entity\ProjectSystem\Project; use App\Entity\LabelSystem\LabelProfile; use App\Entity\Parts\Category; @@ -117,6 +118,7 @@ final class EntityExtension extends AbstractExtension Currency::class => 'currency', MeasurementUnit::class => 'measurement_unit', LabelProfile::class => 'label_profile', + PartCustomState::class => 'part_custom_state', ]; foreach ($map as $class => $type) { diff --git a/templates/admin/part_custom_state_admin.html.twig b/templates/admin/part_custom_state_admin.html.twig new file mode 100644 index 00000000..004ceb65 --- /dev/null +++ b/templates/admin/part_custom_state_admin.html.twig @@ -0,0 +1,14 @@ +{% extends "admin/base_admin.html.twig" %} + +{% block card_title %} + {% trans %}part_custom_state.caption{% endtrans %} +{% endblock %} + +{% block edit_title %} + {% trans %}part_custom_state.edit{% endtrans %}: {{ entity.name }} +{% endblock %} + +{% block new_title %} + {% trans %}part_custom_state.new{% endtrans %} +{% endblock %} + diff --git a/templates/parts/edit/_advanced.html.twig b/templates/parts/edit/_advanced.html.twig index de31786c..991a36eb 100644 --- a/templates/parts/edit/_advanced.html.twig +++ b/templates/parts/edit/_advanced.html.twig @@ -12,4 +12,5 @@ }) }}> {{ form_row(form.ipn) }} -{{ form_row(form.partUnit) }} \ No newline at end of file +{{ form_row(form.partUnit) }} +{{ form_row(form.partCustomState) }} diff --git a/templates/parts/lists/_filter.html.twig b/templates/parts/lists/_filter.html.twig index ba9168d1..2fb5bff2 100644 --- a/templates/parts/lists/_filter.html.twig +++ b/templates/parts/lists/_filter.html.twig @@ -61,6 +61,7 @@ {{ form_row(filterForm.favorite) }} {{ form_row(filterForm.needsReview) }} {{ form_row(filterForm.measurementUnit) }} + {{ form_row(filterForm.partCustomState) }} {{ form_row(filterForm.mass) }} {{ form_row(filterForm.dbId) }} {{ form_row(filterForm.ipn) }} diff --git a/tests/Controller/AdminPages/PartCustomStateControllerTest.php b/tests/Controller/AdminPages/PartCustomStateControllerTest.php new file mode 100644 index 00000000..b9230889 --- /dev/null +++ b/tests/Controller/AdminPages/PartCustomStateControllerTest.php @@ -0,0 +1,35 @@ +. + */ + +declare(strict_types=1); + +namespace App\Tests\Controller\AdminPages; + +use App\Entity\Parts\PartCustomState; + +/** + * @group slow + * @group DB + */ +class PartCustomStateControllerTest extends AbstractAdminControllerTest +{ + protected static string $base_path = '/en/part_custom_state'; + protected static string $entity_class = PartCustomState::class; +} diff --git a/tests/Entity/Attachments/AttachmentTest.php b/tests/Entity/Attachments/AttachmentTest.php index 699648eb..21a0e89f 100644 --- a/tests/Entity/Attachments/AttachmentTest.php +++ b/tests/Entity/Attachments/AttachmentTest.php @@ -31,6 +31,7 @@ use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\AttachmentTypeAttachment; use App\Entity\Attachments\CategoryAttachment; use App\Entity\Attachments\CurrencyAttachment; +use App\Entity\Attachments\PartCustomStateAttachment; use App\Entity\Attachments\ProjectAttachment; use App\Entity\Attachments\FootprintAttachment; use App\Entity\Attachments\GroupAttachment; @@ -40,6 +41,7 @@ use App\Entity\Attachments\PartAttachment; use App\Entity\Attachments\StorageLocationAttachment; use App\Entity\Attachments\SupplierAttachment; use App\Entity\Attachments\UserAttachment; +use App\Entity\Parts\PartCustomState; use App\Entity\ProjectSystem\Project; use App\Entity\Parts\Category; use App\Entity\Parts\Footprint; @@ -89,6 +91,7 @@ class AttachmentTest extends TestCase yield [ManufacturerAttachment::class, Manufacturer::class]; yield [MeasurementUnitAttachment::class, MeasurementUnit::class]; yield [PartAttachment::class, Part::class]; + yield [PartCustomStateAttachment::class, PartCustomState::class]; yield [StorageLocationAttachment::class, StorageLocation::class]; yield [SupplierAttachment::class, Supplier::class]; yield [UserAttachment::class, User::class]; diff --git a/tests/Services/EntityMergers/Mergers/PartMergerTest.php b/tests/Services/EntityMergers/Mergers/PartMergerTest.php index 56c7712e..7db4ddd6 100644 --- a/tests/Services/EntityMergers/Mergers/PartMergerTest.php +++ b/tests/Services/EntityMergers/Mergers/PartMergerTest.php @@ -29,6 +29,7 @@ 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\PriceInformations\Orderdetail; use App\Services\EntityMergers\Mergers\PartMerger; @@ -54,6 +55,7 @@ class PartMergerTest extends KernelTestCase $manufacturer1 = new Manufacturer(); $manufacturer2 = new Manufacturer(); $unit = new MeasurementUnit(); + $customState = new PartCustomState(); $part1 = (new Part()) ->setCategory($category) @@ -62,7 +64,8 @@ class PartMergerTest extends KernelTestCase $part2 = (new Part()) ->setFootprint($footprint) ->setManufacturer($manufacturer2) - ->setPartUnit($unit); + ->setPartUnit($unit) + ->setPartCustomState($customState); $merged = $this->merger->merge($part1, $part2); $this->assertSame($merged, $part1); @@ -70,6 +73,7 @@ class PartMergerTest extends KernelTestCase $this->assertSame($footprint, $merged->getFootprint()); $this->assertSame($manufacturer1, $merged->getManufacturer()); $this->assertSame($unit, $merged->getPartUnit()); + $this->assertSame($customState, $merged->getPartCustomState()); } public function testMergeOfTags(): void diff --git a/tests/assets/partkeepr_import_test.xml b/tests/assets/partkeepr_import_test.xml index 4fa497e2..28e6f099 100644 --- a/tests/assets/partkeepr_import_test.xml +++ b/tests/assets/partkeepr_import_test.xml @@ -7437,11 +7437,13 @@ + + diff --git a/translations/messages.cs.xlf b/translations/messages.cs.xlf index 7b15f8e0..89edfb80 100644 --- a/translations/messages.cs.xlf +++ b/translations/messages.cs.xlf @@ -548,6 +548,12 @@ Měrné jednotky + + + part_custom_state.caption + Vlastní stav komponenty + + Part-DB1\templates\AdminPages\StorelocationAdmin.html.twig:5 @@ -4891,6 +4897,12 @@ Pokud jste to provedli nesprávně nebo pokud počítač již není důvěryhodn Měrné jednotky + + + part.table.partCustomState + Vlastní stav součásti + + Part-DB1\src\DataTables\PartsDataTable.php:236 @@ -5755,6 +5767,12 @@ Pokud jste to provedli nesprávně nebo pokud počítač již není důvěryhodn Měrná jednotka + + + part.edit.partCustomState + Vlastní stav součásti + + Part-DB1\src\Form\Part\PartBaseType.php:212 @@ -6042,6 +6060,12 @@ Pokud jste to provedli nesprávně nebo pokud počítač již není důvěryhodn Měrná jednotka + + + part_custom_state.label + Vlastní stav součásti + + Part-DB1\src\Services\ElementTypeNameGenerator.php:90 @@ -6285,6 +6309,12 @@ Pokud jste to provedli nesprávně nebo pokud počítač již není důvěryhodn Měrné jednotky + + + tree.tools.edit.part_custom_state + Vlastní stav součásti + + Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:203 @@ -8561,6 +8591,12 @@ Element 3 Měrná jednotka + + + perm.part_custom_states + Vlastní stav součásti + + obsolete @@ -10926,6 +10962,12 @@ Element 3 Měrná jednotka + + + log.element_edited.changed_fields.partCustomState + Vlastní stav součásti + + log.element_edited.changed_fields.expiration_date @@ -11509,6 +11551,18 @@ Element 3 Upravit měrnou jednotku + + + part_custom_state.new + Nový vlastní stav komponenty + + + + + part_custom_state.edit + Upravit vlastní stav komponenty + + user.aboutMe.label diff --git a/translations/messages.da.xlf b/translations/messages.da.xlf index d86eab14..8f28ef08 100644 --- a/translations/messages.da.xlf +++ b/translations/messages.da.xlf @@ -548,6 +548,12 @@ Måleenhed + + + part_custom_state.caption + Brugerdefineret komponentstatus + + Part-DB1\templates\AdminPages\StorelocationAdmin.html.twig:5 @@ -4898,6 +4904,12 @@ Bemærk også, at uden to-faktor-godkendelse er din konto ikke længere så godt Måleenhed + + + part.table.partCustomState + Brugerdefineret komponentstatus + + Part-DB1\src\DataTables\PartsDataTable.php:236 @@ -5762,6 +5774,12 @@ Bemærk også, at uden to-faktor-godkendelse er din konto ikke længere så godt Måleenhed + + + part.edit.partCustomState + Brugerdefineret deltilstand + + Part-DB1\src\Form\Part\PartBaseType.php:212 @@ -6049,6 +6067,12 @@ Bemærk også, at uden to-faktor-godkendelse er din konto ikke længere så godt Måleenhed + + + part_custom_state.label + Brugerdefineret deltilstand + + Part-DB1\src\Services\ElementTypeNameGenerator.php:90 @@ -6292,6 +6316,12 @@ Bemærk også, at uden to-faktor-godkendelse er din konto ikke længere så godt Måleenhed + + + tree.tools.edit.part_custom_state + Brugerdefineret komponenttilstand + + Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:203 @@ -8568,6 +8598,12 @@ Element 3 Måleenhed + + + perm.part_custom_states + Brugerdefineret komponentstatus + + obsolete @@ -10952,6 +10988,12 @@ Element 3 Måleenhed + + + log.element_edited.changed_fields.partCustomState + Brugerdefineret komponentstatus + + log.element_edited.changed_fields.expiration_date @@ -11541,6 +11583,18 @@ Oversættelsen Ret måleenhed + + + part_custom_state.new + Ny brugerdefineret komponentstatus + + + + + part_custom_state.edit + Rediger brugerdefineret komponentstatus + + user.aboutMe.label diff --git a/translations/messages.de.xlf b/translations/messages.de.xlf index 1e47a276..67c5edd2 100644 --- a/translations/messages.de.xlf +++ b/translations/messages.de.xlf @@ -548,6 +548,12 @@ Maßeinheit + + + part_custom_state.caption + Benutzerdefinierter Bauteilstatus + + Part-DB1\templates\AdminPages\StorelocationAdmin.html.twig:5 @@ -4908,6 +4914,12 @@ Wenn Sie dies fehlerhafterweise gemacht haben oder ein Computer nicht mehr vertr Maßeinheit + + + part.table.partCustomState + Benutzerdefinierter Bauteilstatus + + Part-DB1\src\DataTables\PartsDataTable.php:236 @@ -5772,6 +5784,12 @@ Wenn Sie dies fehlerhafterweise gemacht haben oder ein Computer nicht mehr vertr Maßeinheit + + + part.edit.partCustomState + Benutzerdefinierter Bauteilstatus + + Part-DB1\src\Form\Part\PartBaseType.php:212 @@ -6059,6 +6077,12 @@ Wenn Sie dies fehlerhafterweise gemacht haben oder ein Computer nicht mehr vertr Maßeinheit + + + part_custom_state.label + Benutzerdefinierter Bauteilstatus + + Part-DB1\src\Services\ElementTypeNameGenerator.php:90 @@ -6302,6 +6326,12 @@ Wenn Sie dies fehlerhafterweise gemacht haben oder ein Computer nicht mehr vertr Maßeinheiten + + + tree.tools.edit.part_custom_state + Benutzerdefinierter Bauteilstatus + + Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:203 @@ -8581,6 +8611,12 @@ Element 1 -> Element 1.2 Maßeinheiten + + + perm.part_custom_states + Benutzerdefinierter Bauteilstatus + + obsolete @@ -11018,6 +11054,12 @@ Element 1 -> Element 1.2 Maßeinheit + + + log.element_edited.changed_fields.partCustomState + Benutzerdefinierter Bauteilstatus + + log.element_edited.changed_fields.expiration_date @@ -11607,6 +11649,18 @@ Element 1 -> Element 1.2 Bearbeite Maßeinheit + + + part_custom_state.new + Neuer benutzerdefinierter Bauteilstatus + + + + + part_custom_state.edit + Bearbeite benutzerdefinierten Bauteilstatus + + user.aboutMe.label diff --git a/translations/messages.el.xlf b/translations/messages.el.xlf index f2126c5e..98630c48 100644 --- a/translations/messages.el.xlf +++ b/translations/messages.el.xlf @@ -318,6 +318,12 @@ Μονάδα μέτρησης + + + part_custom_state.caption + Προσαρμοσμένη κατάσταση εξαρτήματος + + Part-DB1\templates\AdminPages\StorelocationAdmin.html.twig:5 @@ -1535,6 +1541,54 @@ Επεξεργασία + + + perm.part_custom_states + Προσαρμοσμένη κατάσταση εξαρτήματος + + + + + tree.tools.edit.part_custom_state + Προσαρμοσμένη κατάσταση εξαρτήματος + + + + + part_custom_state.new + Νέα προσαρμοσμένη κατάσταση εξαρτήματος + + + + + part_custom_state.edit + Επεξεργασία προσαρμοσμένης κατάστασης εξαρτήματος + + + + + part_custom_state.label + Προσαρμοσμένη κατάσταση μέρους + + + + + log.element_edited.changed_fields.partCustomState + Προσαρμοσμένη κατάσταση εξαρτήματος + + + + + part.edit.partCustomState + Προσαρμοσμένη κατάσταση εξαρτήματος + + + + + part.table.partCustomState + Προσαρμοσμένη κατάσταση μέρους + + part.table.name.value.for_part diff --git a/translations/messages.en.xlf b/translations/messages.en.xlf index c606e2fd..3ae166bf 100644 --- a/translations/messages.en.xlf +++ b/translations/messages.en.xlf @@ -548,6 +548,12 @@ Measurement Unit + + + part_custom_state.caption + Custom part state + + Part-DB1\templates\AdminPages\StorelocationAdmin.html.twig:5 @@ -4909,6 +4915,12 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Measurement Unit + + + part.table.partCustomState + Custom part state + + Part-DB1\src\DataTables\PartsDataTable.php:236 @@ -5773,6 +5785,12 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Measuring unit + + + part.edit.partCustomState + Custom part state + + Part-DB1\src\Form\Part\PartBaseType.php:212 @@ -6060,6 +6078,12 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Measurement unit + + + part_custom_state.label + Custom part state + + Part-DB1\src\Services\ElementTypeNameGenerator.php:90 @@ -6303,6 +6327,12 @@ If you have done this incorrectly or if a computer is no longer trusted, you can Measurement Unit + + + tree.tools.edit.part_custom_state + Custom part state + + Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:203 @@ -8582,6 +8612,12 @@ Element 1 -> Element 1.2 Measurement unit + + + perm.part_custom_states + Custom part state + + obsolete @@ -11019,6 +11055,12 @@ Element 1 -> Element 1.2 Measuring Unit + + + log.element_edited.changed_fields.partCustomState + Custom part state + + log.element_edited.changed_fields.expiration_date @@ -11608,6 +11650,18 @@ Element 1 -> Element 1.2 Edit Measurement Unit + + + part_custom_state.new + New custom part state + + + + + part_custom_state.edit + Edit custom part state + + user.aboutMe.label diff --git a/translations/messages.es.xlf b/translations/messages.es.xlf index 441fb6fc..8b48e442 100644 --- a/translations/messages.es.xlf +++ b/translations/messages.es.xlf @@ -548,6 +548,12 @@ Unidad de medida + + + part_custom_state.caption + Estado personalizado del componente + + Part-DB1\templates\AdminPages\StorelocationAdmin.html.twig:5 @@ -4908,6 +4914,12 @@ Subelementos serán desplazados hacia arriba. Unidad de Medida + + + part.table.partCustomState + Estado personalizado del componente + + Part-DB1\src\DataTables\PartsDataTable.php:236 @@ -5772,6 +5784,12 @@ Subelementos serán desplazados hacia arriba. Unidad de medida + + + part.edit.partCustomState + Estado personalizado de la pieza + + Part-DB1\src\Form\Part\PartBaseType.php:212 @@ -6059,6 +6077,12 @@ Subelementos serán desplazados hacia arriba. Unidad de medida + + + part_custom_state.label + Estado personalizado de la pieza + + Part-DB1\src\Services\ElementTypeNameGenerator.php:90 @@ -6302,6 +6326,12 @@ Subelementos serán desplazados hacia arriba. Unidad de medida + + + tree.tools.edit.part_custom_state + Estado personalizado del componente + + Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:203 @@ -8578,6 +8608,12 @@ Elemento 3 Unidad de medida + + + perm.part_custom_states + Estado personalizado del componente + + obsolete @@ -10962,6 +10998,12 @@ Elemento 3 Unidad de medida + + + log.element_edited.changed_fields.partCustomState + Estado personalizado del componente + + log.element_edited.changed_fields.expiration_date @@ -11545,6 +11587,18 @@ Elemento 3 Editar Unidad de Medida + + + part_custom_state.new + Nuevo estado personalizado del componente + + + + + part_custom_state.edit + Editar estado personalizado del componente + + user.aboutMe.label diff --git a/translations/messages.fr.xlf b/translations/messages.fr.xlf index 0ed61ac5..ee1d6ffe 100644 --- a/translations/messages.fr.xlf +++ b/translations/messages.fr.xlf @@ -517,6 +517,12 @@ Unité de mesure + + + part_custom_state.caption + État personnalisé du composant + + Part-DB1\templates\AdminPages\StorelocationAdmin.html.twig:5 @@ -4871,6 +4877,12 @@ Si vous avez fait cela de manière incorrecte ou si un ordinateur n'est plus fia Unité de mesure + + + part.table.partCustomState + État personnalisé de la pièce + + Part-DB1\src\DataTables\PartsDataTable.php:236 @@ -5735,6 +5747,12 @@ Si vous avez fait cela de manière incorrecte ou si un ordinateur n'est plus fia Unité de mesure + + + part.edit.partCustomState + État personnalisé de la pièce + + Part-DB1\src\Form\Part\PartBaseType.php:212 @@ -6012,6 +6030,12 @@ Si vous avez fait cela de manière incorrecte ou si un ordinateur n'est plus fia Unité de mesure + + + part_custom_state.label + État personnalisé de la pièce + + Part-DB1\src\Services\ElementTypeNameGenerator.php:90 @@ -6244,6 +6268,12 @@ Si vous avez fait cela de manière incorrecte ou si un ordinateur n'est plus fia Unité de mesure + + + tree.tools.edit.part_custom_state + État personnalisé de la pièce + + Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:203 @@ -8507,6 +8537,12 @@ exemple de ville Unités de mesure + + + perm.part_custom_states + État personnalisé du composant + + obsolete @@ -10128,5 +10164,23 @@ exemple de ville Un préfixe suggéré lors de la saisie de l'IPN d'une pièce. + + + part_custom_state.new + Nouveau statut personnalisé du composant + + + + + part_custom_state.edit + Modifier le statut personnalisé du composant + + + + + log.element_edited.changed_fields.partCustomState + État personnalisé de la pièce + + diff --git a/translations/messages.it.xlf b/translations/messages.it.xlf index 4b749523..ac134405 100644 --- a/translations/messages.it.xlf +++ b/translations/messages.it.xlf @@ -548,6 +548,12 @@ Unità di misura + + + part_custom_state.caption + Stato personalizzato del componente + + Part-DB1\templates\AdminPages\StorelocationAdmin.html.twig:5 @@ -4910,6 +4916,12 @@ Se è stato fatto in modo errato o se un computer non è più attendibile, puoi Unità di misura + + + part.table.partCustomState + Stato personalizzato del componente + + Part-DB1\src\DataTables\PartsDataTable.php:236 @@ -5774,6 +5786,12 @@ Se è stato fatto in modo errato o se un computer non è più attendibile, puoi Unità di misura + + + part.edit.partCustomState + Stato personalizzato della parte + + Part-DB1\src\Form\Part\PartBaseType.php:212 @@ -6061,6 +6079,12 @@ Se è stato fatto in modo errato o se un computer non è più attendibile, puoi Unità di misura + + + part_custom_state.label + Stato personalizzato della parte + + Part-DB1\src\Services\ElementTypeNameGenerator.php:90 @@ -6304,6 +6328,12 @@ Se è stato fatto in modo errato o se un computer non è più attendibile, puoi Unità di misura + + + tree.tools.edit.part_custom_state + Stato personalizzato del componente + + Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:203 @@ -8580,6 +8610,12 @@ Element 3 Unità di misura + + + perm.part_custom_states + Stato personalizzato del componente + + obsolete @@ -10964,6 +11000,12 @@ Element 3 Unità di misura + + + log.element_edited.changed_fields.partCustomState + Stato personalizzato della parte + + log.element_edited.changed_fields.expiration_date @@ -11547,6 +11589,18 @@ Element 3 Modificare l'unità di misura + + + part_custom_state.new + Nuovo stato personalizzato del componente + + + + + part_custom_state.edit + Modifica stato personalizzato del componente + + user.aboutMe.label diff --git a/translations/messages.ja.xlf b/translations/messages.ja.xlf index abc01949..e892af9c 100644 --- a/translations/messages.ja.xlf +++ b/translations/messages.ja.xlf @@ -517,6 +517,12 @@ 単位 + + + part_custom_state.caption + 部品のカスタム状態 + + Part-DB1\templates\AdminPages\StorelocationAdmin.html.twig:5 @@ -4871,6 +4877,12 @@ 単位 + + + part.table.partCustomState + 部品のカスタム状態 + + Part-DB1\src\DataTables\PartsDataTable.php:236 @@ -5735,6 +5747,12 @@ 単位 + + + part.edit.partCustomState + 部品のカスタム状態 + + Part-DB1\src\Form\Part\PartBaseType.php:212 @@ -6012,6 +6030,12 @@ 単位 + + + part_custom_state.label + 部品のカスタム状態 + + Part-DB1\src\Services\ElementTypeNameGenerator.php:90 @@ -6244,6 +6268,12 @@ 単位 + + + tree.tools.edit.part_custom_state + 部品のカスタム状態 + + Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:203 @@ -8508,6 +8538,12 @@ Exampletown 単位 + + + perm.part_custom_states + 部品のカスタム状態 + + obsolete @@ -9841,5 +9877,23 @@ Exampletown 部品のIPN入力時に提案される接頭辞。 + + + part_custom_state.new + 部品の新しいカスタム状態 + + + + + part_custom_state.edit + 部品のカスタム状態を編集 + + + + + log.element_edited.changed_fields.partCustomState + 部品のカスタム状態 + + diff --git a/translations/messages.nl.xlf b/translations/messages.nl.xlf index 14242c3a..b24e14b9 100644 --- a/translations/messages.nl.xlf +++ b/translations/messages.nl.xlf @@ -548,6 +548,12 @@ Meeteenheden + + + part_custom_state.caption + Aangepaste status van het onderdeel + + Part-DB1\templates\AdminPages\StorelocationAdmin.html.twig:5 @@ -724,6 +730,54 @@ Weet u zeker dat u wilt doorgaan? + + + perm.part_custom_states + Aangepaste status van onderdeel + + + + + tree.tools.edit.part_custom_state + Aangepaste status van het onderdeel + + + + + part_custom_state.new + Nieuwe aangepaste status van het onderdeel + + + + + part_custom_state.edit + Aangepaste status van het onderdeel bewerken + + + + + part_custom_state.label + Aangepaste staat van onderdeel + + + + + log.element_edited.changed_fields.partCustomState + Aangepaste staat van het onderdeel + + + + + part.edit.partCustomState + Aangepaste staat van het onderdeel + + + + + part.table.partCustomState + Aangepaste status van onderdeel + + part.table.name.value.for_part diff --git a/translations/messages.pl.xlf b/translations/messages.pl.xlf index f56858e3..a09e3ac3 100644 --- a/translations/messages.pl.xlf +++ b/translations/messages.pl.xlf @@ -548,6 +548,12 @@ Jednostka miary + + + part_custom_state.caption + Stan niestandardowy komponentu + + Part-DB1\templates\AdminPages\StorelocationAdmin.html.twig:5 @@ -4913,6 +4919,12 @@ Jeśli zrobiłeś to niepoprawnie lub komputer nie jest już godny zaufania, mo Jednostka pomiarowa + + + part.table.partCustomState + Niestandardowy stan części + + Part-DB1\src\DataTables\PartsDataTable.php:236 @@ -5777,6 +5789,12 @@ Jeśli zrobiłeś to niepoprawnie lub komputer nie jest już godny zaufania, mo Jednostka pomiarowa + + + part.edit.partCustomState + Własny stan części + + Part-DB1\src\Form\Part\PartBaseType.php:212 @@ -6064,6 +6082,12 @@ Jeśli zrobiłeś to niepoprawnie lub komputer nie jest już godny zaufania, mo Jednostka pomiarowa + + + part_custom_state.label + Własny stan części + + Part-DB1\src\Services\ElementTypeNameGenerator.php:90 @@ -6307,6 +6331,12 @@ Jeśli zrobiłeś to niepoprawnie lub komputer nie jest już godny zaufania, mo Jednostka miary + + + tree.tools.edit.part_custom_state + Niestandardowy stan części + + Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:203 @@ -8583,6 +8613,12 @@ Element 3 Jednostka miary + + + perm.part_custom_states + Stan niestandardowy komponentu + + obsolete @@ -10967,6 +11003,12 @@ Element 3 Jednostka pomiarowa + + + log.element_edited.changed_fields.partCustomState + Niestandardowy stan części + + log.element_edited.changed_fields.expiration_date @@ -11550,6 +11592,18 @@ Element 3 Edytuj jednostkę miary + + + part_custom_state.new + Nowy niestandardowy stan części + + + + + part_custom_state.edit + Edytuj niestandardowy stan części + + user.aboutMe.label diff --git a/translations/messages.ru.xlf b/translations/messages.ru.xlf index 45d743ba..8d6a0ba1 100644 --- a/translations/messages.ru.xlf +++ b/translations/messages.ru.xlf @@ -548,6 +548,12 @@ Единица измерения + + + part_custom_state.caption + Пользовательское состояние компонента + + Part-DB1\templates\AdminPages\StorelocationAdmin.html.twig:5 @@ -4919,6 +4925,12 @@ Единица измерения + + + part.table.partCustomState + Пользовательское состояние детали + + Part-DB1\src\DataTables\PartsDataTable.php:236 @@ -5783,6 +5795,12 @@ Единица измерения + + + part.edit.partCustomState + Пользовательское состояние части + + Part-DB1\src\Form\Part\PartBaseType.php:212 @@ -6070,6 +6088,12 @@ Единица измерения + + + part_custom_state.label + Пользовательское состояние детали + + Part-DB1\src\Services\ElementTypeNameGenerator.php:90 @@ -6313,6 +6337,12 @@ Единица измерения + + + tree.tools.edit.part_custom_state + Пользовательское состояние компонента + + Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:203 @@ -8587,6 +8617,12 @@ Единица измерения + + + perm.part_custom_states + Пользовательское состояние компонента + + obsolete @@ -10971,6 +11007,12 @@ Единица измерения + + + log.element_edited.changed_fields.partCustomState + Пользовательское состояние детали + + log.element_edited.changed_fields.expiration_date @@ -11554,6 +11596,18 @@ Изменить единицу измерения + + + part_custom_state.new + Новое пользовательское состояние компонента + + + + + part_custom_state.edit + Редактировать пользовательское состояние компонента + + user.aboutMe.label diff --git a/translations/messages.zh.xlf b/translations/messages.zh.xlf index edb4ec59..f257f9a2 100644 --- a/translations/messages.zh.xlf +++ b/translations/messages.zh.xlf @@ -548,6 +548,12 @@ 计量单位 + + + part_custom_state.caption + 部件的自定义状态 + + Part-DB1\templates\AdminPages\StorelocationAdmin.html.twig:5 @@ -4917,6 +4923,12 @@ 计量单位 + + + part.table.partCustomState + 部件的自定义状态 + + Part-DB1\src\DataTables\PartsDataTable.php:236 @@ -5781,6 +5793,12 @@ 计量单位 + + + part.edit.partCustomState + 部件的自定义状态 + + Part-DB1\src\Form\Part\PartBaseType.php:212 @@ -6068,6 +6086,12 @@ 计量单位 + + + part_custom_state.label + 部件自定义状态 + + Part-DB1\src\Services\ElementTypeNameGenerator.php:90 @@ -6311,6 +6335,12 @@ 计量单位 + + + tree.tools.edit.part_custom_state + 部件自定义状态 + + Part-DB1\src\Services\Trees\ToolsTreeBuilder.php:203 @@ -8586,6 +8616,12 @@ Element 3 计量单位 + + + perm.part_custom_states + 部件的自定义状态 + + obsolete @@ -10970,6 +11006,12 @@ Element 3 计量单位 + + + log.element_edited.changed_fields.partCustomState + 部件的自定义状态 + + log.element_edited.changed_fields.expiration_date @@ -11553,6 +11595,18 @@ Element 3 编辑度量单位 + + + part_custom_state.new + 部件的新自定义状态 + + + + + part_custom_state.edit + 编辑部件的自定义状态 + + user.aboutMe.label