From 85ae8623810133d8c2cb200f4ab28af6c66a770a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 12 Mar 2023 20:01:29 +0100 Subject: [PATCH] Allow to set basic data via import --- src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php | 8 ++++---- src/Entity/Parts/PartTraits/BasicPropertyTrait.php | 6 +++--- src/Entity/Parts/PartTraits/InstockTrait.php | 2 +- src/Entity/Parts/PartTraits/ManufacturerTrait.php | 6 +++--- templates/parts/import/parts_import.html.twig | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php index d617b999..3b658b93 100644 --- a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php +++ b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php @@ -35,14 +35,14 @@ trait AdvancedPropertyTrait /** * @var bool Determines if this part entry needs review (for example, because it is work in progress) * @ORM\Column(type="boolean") - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected bool $needs_review = false; /** * @var string a comma separated list of tags, associated with the part * @ORM\Column(type="text") - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected string $tags = ''; @@ -50,7 +50,7 @@ trait AdvancedPropertyTrait * @var float|null how much a single part unit weighs in grams * @ORM\Column(type="float", nullable=true) * @Assert\PositiveOrZero() - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected ?float $mass = null; @@ -58,7 +58,7 @@ trait AdvancedPropertyTrait * @var string The internal part number of the part * @ORM\Column(type="string", length=100, nullable=true, unique=true) * @Assert\Length(max="100") - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "ipn"}) */ protected ?string $ipn = null; diff --git a/src/Entity/Parts/PartTraits/BasicPropertyTrait.php b/src/Entity/Parts/PartTraits/BasicPropertyTrait.php index 53cac805..8ad0c5e0 100644 --- a/src/Entity/Parts/PartTraits/BasicPropertyTrait.php +++ b/src/Entity/Parts/PartTraits/BasicPropertyTrait.php @@ -34,14 +34,14 @@ trait BasicPropertyTrait /** * @var string A text describing what this part does * @ORM\Column(type="text") - * @Groups({"simple", "extended", "full"}) + * @Groups({"simple", "extended", "full", "import"}) */ protected string $description = ''; /** * @var string A comment/note related to this part * @ORM\Column(type="text") - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected string $comment = ''; @@ -54,7 +54,7 @@ trait BasicPropertyTrait /** * @var bool true, if the part is marked as favorite * @ORM\Column(type="boolean") - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected bool $favorite = false; diff --git a/src/Entity/Parts/PartTraits/InstockTrait.php b/src/Entity/Parts/PartTraits/InstockTrait.php index 57fdecef..0abcc3da 100644 --- a/src/Entity/Parts/PartTraits/InstockTrait.php +++ b/src/Entity/Parts/PartTraits/InstockTrait.php @@ -48,7 +48,7 @@ trait InstockTrait * Given in the partUnit. * @ORM\Column(type="float") * @Assert\PositiveOrZero() - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected float $minamount = 0; diff --git a/src/Entity/Parts/PartTraits/ManufacturerTrait.php b/src/Entity/Parts/PartTraits/ManufacturerTrait.php index ee2b7317..3e554f88 100644 --- a/src/Entity/Parts/PartTraits/ManufacturerTrait.php +++ b/src/Entity/Parts/PartTraits/ManufacturerTrait.php @@ -47,14 +47,14 @@ trait ManufacturerTrait * @var string the url to the part on the manufacturer's homepage * @ORM\Column(type="string") * @Assert\Url() - * @Groups({"full"}) + * @Groups({"full", "import"}) */ protected string $manufacturer_product_url = ''; /** * @var string The product number used by the manufacturer. If this is set to "", the name field is used. * @ORM\Column(type="string") - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected string $manufacturer_product_number = ''; @@ -62,7 +62,7 @@ trait ManufacturerTrait * @var string The production status of this part. Can be one of the specified ones. * @ORM\Column(type="string", length=255, nullable=true) * @Assert\Choice({"announced", "active", "nrfnd", "eol", "discontinued", ""}) - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected ?string $manufacturing_status = ''; diff --git a/templates/parts/import/parts_import.html.twig b/templates/parts/import/parts_import.html.twig index c2e85672..8d2c8961 100644 --- a/templates/parts/import/parts_import.html.twig +++ b/templates/parts/import/parts_import.html.twig @@ -28,7 +28,7 @@