diff --git a/migrations/Version20250321141740.php b/migrations/Version20250321141740.php index cdf0e17a..f074adcf 100644 --- a/migrations/Version20250321141740.php +++ b/migrations/Version20250321141740.php @@ -43,10 +43,10 @@ final class Version20250321141740 extends AbstractMultiPlatformMigration public function sqLiteUp(Schema $schema): void { $this->addSql(<<<'SQL' - CREATE TEMPORARY TABLE __temp__parts AS - SELECT - id, - id_preview_attachment, + CREATE TEMPORARY TABLE __temp__parts AS + SELECT + id, + id_preview_attachment, id_category, id_footprint, id_part_unit, @@ -82,7 +82,7 @@ final class Version20250321141740 extends AbstractMultiPlatformMigration eda_info_exclude_from_board, eda_info_exclude_from_sim, eda_info_kicad_symbol, - eda_info_kicad_footprint + eda_info_kicad_footprint FROM parts SQL); @@ -181,8 +181,8 @@ final class Version20250321141740 extends AbstractMultiPlatformMigration eda_info_exclude_from_board, eda_info_exclude_from_sim, eda_info_kicad_symbol, - eda_info_kicad_footprint) - SELECT + eda_info_kicad_footprint) + SELECT id, id_preview_attachment, id_category, @@ -219,7 +219,7 @@ final class Version20250321141740 extends AbstractMultiPlatformMigration eda_info_exclude_from_board, eda_info_exclude_from_sim, eda_info_kicad_symbol, - eda_info_kicad_footprint + eda_info_kicad_footprint FROM __temp__parts SQL); @@ -271,45 +271,45 @@ final class Version20250321141740 extends AbstractMultiPlatformMigration public function sqLiteDown(Schema $schema): void { $this->addSql(<<<'SQL' - CREATE TEMPORARY TABLE __temp__parts AS - SELECT - id, - id_preview_attachment, - id_category, - id_footprint, - id_part_unit, - id_manufacturer, - order_orderdetails_id, + CREATE TEMPORARY TABLE __temp__parts AS + SELECT + id, + id_preview_attachment, + id_category, + id_footprint, + id_part_unit, + id_manufacturer, + order_orderdetails_id, built_project_id, built_assembly_id, - datetime_added, - name, - last_modified, - needs_review, - tags, - mass, - description, - comment, - visible, - favorite, - minamount, - manufacturer_product_url, - manufacturer_product_number, - manufacturing_status, - order_quantity, - manual_order, - ipn, - provider_reference_provider_key, - provider_reference_provider_id, - provider_reference_provider_url, - provider_reference_last_updated, - eda_info_reference_prefix, - eda_info_value, - eda_info_invisible, - eda_info_exclude_from_bom, - eda_info_exclude_from_board, - eda_info_exclude_from_sim, - eda_info_kicad_symbol, + datetime_added, + name, + last_modified, + needs_review, + tags, + mass, + description, + comment, + visible, + favorite, + minamount, + manufacturer_product_url, + manufacturer_product_number, + manufacturing_status, + order_quantity, + manual_order, + ipn, + provider_reference_provider_key, + provider_reference_provider_id, + provider_reference_provider_url, + provider_reference_last_updated, + eda_info_reference_prefix, + eda_info_value, + eda_info_invisible, + eda_info_exclude_from_bom, + eda_info_exclude_from_board, + eda_info_exclude_from_sim, + eda_info_kicad_symbol, eda_info_kicad_footprint FROM "parts" SQL); @@ -318,132 +318,132 @@ final class Version20250321141740 extends AbstractMultiPlatformMigration SQL); $this->addSql(<<<'SQL' CREATE TABLE "parts" ( - id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, - id_preview_attachment INTEGER DEFAULT NULL, - id_category INTEGER NOT NULL, - id_footprint INTEGER DEFAULT NULL, - id_part_unit INTEGER DEFAULT NULL, - id_manufacturer INTEGER DEFAULT NULL, - order_orderdetails_id INTEGER DEFAULT NULL, - built_project_id INTEGER DEFAULT NULL, + id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, + id_preview_attachment INTEGER DEFAULT NULL, + id_category INTEGER NOT NULL, + id_footprint INTEGER DEFAULT NULL, + id_part_unit INTEGER DEFAULT NULL, + id_manufacturer INTEGER DEFAULT NULL, + order_orderdetails_id INTEGER DEFAULT NULL, + built_project_id INTEGER DEFAULT NULL, built_assembly_id INTEGER DEFAULT NULL, - datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, - name VARCHAR(255) NOT NULL, - last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, - needs_review BOOLEAN NOT NULL, - tags CLOB NOT NULL, - mass DOUBLE PRECISION DEFAULT NULL, - description CLOB NOT NULL, - comment CLOB NOT NULL, - visible BOOLEAN NOT NULL, - favorite BOOLEAN NOT NULL, - minamount DOUBLE PRECISION NOT NULL, - manufacturer_product_url CLOB NOT NULL, - manufacturer_product_number VARCHAR(255) NOT NULL, - manufacturing_status VARCHAR(255) DEFAULT NULL, - order_quantity INTEGER NOT NULL, - manual_order BOOLEAN NOT NULL, - ipn VARCHAR(100) DEFAULT NULL, - provider_reference_provider_key VARCHAR(255) DEFAULT NULL, - provider_reference_provider_id VARCHAR(255) DEFAULT NULL, - provider_reference_provider_url VARCHAR(255) DEFAULT NULL, - provider_reference_last_updated DATETIME DEFAULT NULL, - eda_info_reference_prefix VARCHAR(255) DEFAULT NULL, - eda_info_value VARCHAR(255) DEFAULT NULL, - eda_info_invisible BOOLEAN DEFAULT NULL, - eda_info_exclude_from_bom BOOLEAN DEFAULT NULL, - eda_info_exclude_from_board BOOLEAN DEFAULT NULL, - eda_info_exclude_from_sim BOOLEAN DEFAULT NULL, - eda_info_kicad_symbol VARCHAR(255) DEFAULT NULL, - eda_info_kicad_footprint VARCHAR(255) DEFAULT NULL, - CONSTRAINT FK_6940A7FEEA7100A1 FOREIGN KEY (id_preview_attachment) REFERENCES "attachments" (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE, - CONSTRAINT FK_6940A7FE5697F554 FOREIGN KEY (id_category) REFERENCES "categories" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, - CONSTRAINT FK_6940A7FE7E371A10 FOREIGN KEY (id_footprint) REFERENCES "footprints" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, - CONSTRAINT FK_6940A7FE2626CEF9 FOREIGN KEY (id_part_unit) REFERENCES "measurement_units" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, - CONSTRAINT FK_6940A7FE1ECB93AE FOREIGN KEY (id_manufacturer) REFERENCES "manufacturers" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, - CONSTRAINT FK_6940A7FE81081E9B FOREIGN KEY (order_orderdetails_id) REFERENCES "orderdetails" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, + datetime_added DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, + name VARCHAR(255) NOT NULL, + last_modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL, + needs_review BOOLEAN NOT NULL, + tags CLOB NOT NULL, + mass DOUBLE PRECISION DEFAULT NULL, + description CLOB NOT NULL, + comment CLOB NOT NULL, + visible BOOLEAN NOT NULL, + favorite BOOLEAN NOT NULL, + minamount DOUBLE PRECISION NOT NULL, + manufacturer_product_url CLOB NOT NULL, + manufacturer_product_number VARCHAR(255) NOT NULL, + manufacturing_status VARCHAR(255) DEFAULT NULL, + order_quantity INTEGER NOT NULL, + manual_order BOOLEAN NOT NULL, + ipn VARCHAR(100) DEFAULT NULL, + provider_reference_provider_key VARCHAR(255) DEFAULT NULL, + provider_reference_provider_id VARCHAR(255) DEFAULT NULL, + provider_reference_provider_url VARCHAR(255) DEFAULT NULL, + provider_reference_last_updated DATETIME DEFAULT NULL, + eda_info_reference_prefix VARCHAR(255) DEFAULT NULL, + eda_info_value VARCHAR(255) DEFAULT NULL, + eda_info_invisible BOOLEAN DEFAULT NULL, + eda_info_exclude_from_bom BOOLEAN DEFAULT NULL, + eda_info_exclude_from_board BOOLEAN DEFAULT NULL, + eda_info_exclude_from_sim BOOLEAN DEFAULT NULL, + eda_info_kicad_symbol VARCHAR(255) DEFAULT NULL, + eda_info_kicad_footprint VARCHAR(255) DEFAULT NULL, + CONSTRAINT FK_6940A7FEEA7100A1 FOREIGN KEY (id_preview_attachment) REFERENCES "attachments" (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE, + CONSTRAINT FK_6940A7FE5697F554 FOREIGN KEY (id_category) REFERENCES "categories" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, + CONSTRAINT FK_6940A7FE7E371A10 FOREIGN KEY (id_footprint) REFERENCES "footprints" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, + CONSTRAINT FK_6940A7FE2626CEF9 FOREIGN KEY (id_part_unit) REFERENCES "measurement_units" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, + CONSTRAINT FK_6940A7FE1ECB93AE FOREIGN KEY (id_manufacturer) REFERENCES "manufacturers" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, + CONSTRAINT FK_6940A7FE81081E9B FOREIGN KEY (order_orderdetails_id) REFERENCES "orderdetails" (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_6940A7FEE8AE70D9 FOREIGN KEY (built_project_id) REFERENCES projects (id) NOT DEFERRABLE INITIALLY IMMEDIATE, CONSTRAINT FK_6940A7FECC660B3C FOREIGN KEY (built_assembly_id) REFERENCES assemblies (id) NOT DEFERRABLE INITIALLY IMMEDIATE ) SQL); $this->addSql(<<<'SQL' INSERT INTO "parts" ( - id, + id, id_preview_attachment, - id_category, - id_footprint, - id_part_unit, - id_manufacturer, - order_orderdetails_id, - built_project_id, - built_assembly_id, - datetime_added, - name, - last_modified, - needs_review, - tags, - mass, - description, - comment, - visible, - favorite, - minamount, - manufacturer_product_url, - manufacturer_product_number, - manufacturing_status, - order_quantity, - manual_order, - ipn, - provider_reference_provider_key, - provider_reference_provider_id, - provider_reference_provider_url, - provider_reference_last_updated, - eda_info_reference_prefix, - eda_info_value, - eda_info_invisible, - eda_info_exclude_from_bom, - eda_info_exclude_from_board, - eda_info_exclude_from_sim, - eda_info_kicad_symbol, - eda_info_kicad_footprint - ) SELECT - id, - id_preview_attachment, - id_category, - id_footprint, - id_part_unit, - id_manufacturer, - order_orderdetails_id, + id_category, + id_footprint, + id_part_unit, + id_manufacturer, + order_orderdetails_id, built_project_id, built_assembly_id, - datetime_added, - name, - last_modified, - needs_review, - tags, - mass, - description, - comment, - visible, - favorite, - minamount, - manufacturer_product_url, - manufacturer_product_number, - manufacturing_status, - order_quantity, - manual_order, - ipn, - provider_reference_provider_key, - provider_reference_provider_id, - provider_reference_provider_url, - provider_reference_last_updated, - eda_info_reference_prefix, - eda_info_value, - eda_info_invisible, - eda_info_exclude_from_bom, - eda_info_exclude_from_board, - eda_info_exclude_from_sim, - eda_info_kicad_symbol, + datetime_added, + name, + last_modified, + needs_review, + tags, + mass, + description, + comment, + visible, + favorite, + minamount, + manufacturer_product_url, + manufacturer_product_number, + manufacturing_status, + order_quantity, + manual_order, + ipn, + provider_reference_provider_key, + provider_reference_provider_id, + provider_reference_provider_url, + provider_reference_last_updated, + eda_info_reference_prefix, + eda_info_value, + eda_info_invisible, + eda_info_exclude_from_bom, + eda_info_exclude_from_board, + eda_info_exclude_from_sim, + eda_info_kicad_symbol, + eda_info_kicad_footprint + ) SELECT + id, + id_preview_attachment, + id_category, + id_footprint, + id_part_unit, + id_manufacturer, + order_orderdetails_id, + built_project_id, + built_assembly_id, + datetime_added, + name, + last_modified, + needs_review, + tags, + mass, + description, + comment, + visible, + favorite, + minamount, + manufacturer_product_url, + manufacturer_product_number, + manufacturing_status, + order_quantity, + manual_order, + ipn, + provider_reference_provider_key, + provider_reference_provider_id, + provider_reference_provider_url, + provider_reference_last_updated, + eda_info_reference_prefix, + eda_info_value, + eda_info_invisible, + eda_info_exclude_from_bom, + eda_info_exclude_from_board, + eda_info_exclude_from_sim, + eda_info_kicad_symbol, eda_info_kicad_footprint FROM __temp__parts SQL); diff --git a/src/Entity/Parts/PartCustomState.php b/src/Entity/Parts/PartCustomState.php index e8429199..ab0941f3 100644 --- a/src/Entity/Parts/PartCustomState.php +++ b/src/Entity/Parts/PartCustomState.php @@ -107,7 +107,7 @@ class PartCustomState extends AbstractPartsContainingDBElement /** @var Collection */ #[Assert\Valid] - #[ORM\OneToMany(mappedBy: 'element', targetEntity: PartCustomStateAttachment::class, cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OneToMany(mappedBy: 'element', targetEntity: PartCustomStateParameter::class, cascade: ['persist', 'remove'], orphanRemoval: true)] #[ORM\OrderBy(['name' => 'ASC'])] #[Groups(['part_custom_state:read', 'part_custom_state:write'])] protected Collection $parameters; diff --git a/src/Settings/BehaviorSettings/PartTableColumns.php b/src/Settings/BehaviorSettings/PartTableColumns.php index eea6ad86..c025c952 100644 --- a/src/Settings/BehaviorSettings/PartTableColumns.php +++ b/src/Settings/BehaviorSettings/PartTableColumns.php @@ -46,6 +46,7 @@ enum PartTableColumns : string implements TranslatableInterface case FAVORITE = "favorite"; case MANUFACTURING_STATUS = "manufacturing_status"; case MPN = "manufacturer_product_number"; + case CUSTOM_PART_STATE = 'partCustomState'; case MASS = "mass"; case TAGS = "tags"; case ATTACHMENTS = "attachments"; @@ -63,4 +64,4 @@ enum PartTableColumns : string implements TranslatableInterface return $translator->trans($key, locale: $locale); } -} \ No newline at end of file +} diff --git a/src/Settings/BehaviorSettings/TableSettings.php b/src/Settings/BehaviorSettings/TableSettings.php index cfe7e71b..960db65b 100644 --- a/src/Settings/BehaviorSettings/TableSettings.php +++ b/src/Settings/BehaviorSettings/TableSettings.php @@ -67,7 +67,7 @@ class TableSettings #[Assert\All([new Assert\Type(PartTableColumns::class)])] public array $partsDefaultColumns = [PartTableColumns::NAME, PartTableColumns::DESCRIPTION, PartTableColumns::CATEGORY, PartTableColumns::FOOTPRINT, PartTableColumns::MANUFACTURER, - PartTableColumns::LOCATION, PartTableColumns::AMOUNT]; + PartTableColumns::LOCATION, PartTableColumns::AMOUNT, PartTableColumns::CUSTOM_PART_STATE]; /** @var AssemblyTableColumns[] */ #[SettingsParameter(ArrayType::class, diff --git a/tests/Controller/AdminPages/PartCustomStateControllerTest.php b/tests/Controller/AdminPages/PartCustomStateControllerTest.php index b9230889..3e87dfe2 100644 --- a/tests/Controller/AdminPages/PartCustomStateControllerTest.php +++ b/tests/Controller/AdminPages/PartCustomStateControllerTest.php @@ -23,12 +23,11 @@ declare(strict_types=1); namespace App\Tests\Controller\AdminPages; use App\Entity\Parts\PartCustomState; +use PHPUnit\Framework\Attributes\Group; -/** - * @group slow - * @group DB - */ -class PartCustomStateControllerTest extends AbstractAdminControllerTest +#[Group('slow')] +#[Group('DB')] +class PartCustomStateControllerTest extends AbstractAdminController { protected static string $base_path = '/en/part_custom_state'; protected static string $entity_class = PartCustomState::class; diff --git a/translations/messages.cs.xlf b/translations/messages.cs.xlf index a2b9831a..cf6d7588 100644 --- a/translations/messages.cs.xlf +++ b/translations/messages.cs.xlf @@ -10374,7 +10374,7 @@ Element 3 Cílový inventář - + project.builds.number_of_builds Množství sestavy diff --git a/translations/messages.el.xlf b/translations/messages.el.xlf index faaa9dac..0a0be4ba 100644 --- a/translations/messages.el.xlf +++ b/translations/messages.el.xlf @@ -1601,12 +1601,6 @@ Προσαρμοσμένη κατάσταση εξαρτήματος - - - part.table.partCustomState - Προσαρμοσμένη κατάσταση μέρους - - part.table.name.value.for_part