diff --git a/src/Entity/Parts/Category.php b/src/Entity/Parts/Category.php index 21111065..8bcf32d2 100644 --- a/src/Entity/Parts/Category.php +++ b/src/Entity/Parts/Category.php @@ -57,56 +57,56 @@ class Category extends AbstractPartsContainingDBElement /** * @var string * @ORM\Column(type="text") - * @Groups({"full"}) + * @Groups({"full", "import"}) */ protected string $partname_hint = ''; /** * @var string * @ORM\Column(type="text") - * @Groups({"full"}) + * @Groups({"full", "import"}) */ protected string $partname_regex = ''; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full"}) + * @Groups({"full", "import"}) */ protected bool $disable_footprints = false; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full"}) + * @Groups({"full", "import"}) */ protected bool $disable_manufacturers = false; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full"}) + * @Groups({"full", "import"}) */ protected bool $disable_autodatasheets = false; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full"}) + * @Groups({"full", "import"}) */ protected bool $disable_properties = false; /** * @var string * @ORM\Column(type="text") - * @Groups({"full"}) + * @Groups({"full", "import"}) */ protected string $default_description = ''; /** * @var string * @ORM\Column(type="text") - * @Groups({"full"}) + * @Groups({"full", "import"}) */ protected string $default_comment = ''; /** diff --git a/src/Entity/Parts/MeasurementUnit.php b/src/Entity/Parts/MeasurementUnit.php index 1bbff9bf..5ff9cef4 100644 --- a/src/Entity/Parts/MeasurementUnit.php +++ b/src/Entity/Parts/MeasurementUnit.php @@ -49,7 +49,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement * or m (for meters). * @ORM\Column(type="string", name="unit", nullable=true) * @Assert\Length(max=10) - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected ?string $unit = null; @@ -57,7 +57,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement * @var bool Determines if the amount value associated with this unit should be treated as integer. * Set to false, to measure continuous sizes likes masses or lengths. * @ORM\Column(type="boolean", name="is_integer") - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected bool $is_integer = false; @@ -66,7 +66,7 @@ class MeasurementUnit extends AbstractPartsContainingDBElement * Useful for sizes like meters. For this the unit must be set * @ORM\Column(type="boolean", name="use_si_prefix") * @Assert\Expression("this.isUseSIPrefix() == false or this.getUnit() != null", message="validator.measurement_unit.use_si_prefix_needs_unit") - * @Groups({"full"}) + * @Groups({"full", "import"}) */ protected bool $use_si_prefix = false; diff --git a/src/Entity/Parts/PartLot.php b/src/Entity/Parts/PartLot.php index 9d007f92..40db1fc2 100644 --- a/src/Entity/Parts/PartLot.php +++ b/src/Entity/Parts/PartLot.php @@ -53,14 +53,14 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named /** * @var string A short description about this lot, shown in table * @ORM\Column(type="text") - * @Groups({"simple", "extended", "full"}) + * @Groups({"simple", "extended", "full", "import"}) */ protected string $description = ''; /** * @var string a comment stored with this lot * @ORM\Column(type="text") - * @Groups({"full"}) + * @Groups({"full", "import"}) */ protected string $comment = ''; @@ -68,7 +68,7 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named * @var ?DateTime Set a time until when the lot must be used. * Set to null, if the lot can be used indefinitely. * @ORM\Column(type="datetime", name="expiration_date", nullable=true) - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected ?DateTime $expiration_date = null; @@ -77,14 +77,14 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named * @ORM\ManyToOne(targetEntity="Storelocation") * @ORM\JoinColumn(name="id_store_location", referencedColumnName="id", nullable=true) * @Selectable() - * @Groups({"simple", "extended", "full"}) + * @Groups({"simple", "extended", "full", "import"}) */ protected ?Storelocation $storage_location = null; /** * @var bool If this is set to true, the instock amount is marked as not known * @ORM\Column(type="boolean") - * @Groups({"simple", "extended", "full"}) + * @Groups({"simple", "extended", "full", "import"}) */ protected bool $instock_unknown = false; @@ -92,14 +92,14 @@ class PartLot extends AbstractDBElement implements TimeStampableInterface, Named * @var float For continuous sizes (length, volume, etc.) the instock is saved here. * @ORM\Column(type="float") * @Assert\PositiveOrZero() - * @Groups({"simple", "extended", "full"}) + * @Groups({"simple", "extended", "full", "import"}) */ protected float $amount = 0.0; /** * @var bool determines if this lot was manually marked for refilling * @ORM\Column(type="boolean") - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected bool $needs_refill = false; diff --git a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php index 3b658b93..482004b0 100644 --- a/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php +++ b/src/Entity/Parts/PartTraits/AdvancedPropertyTrait.php @@ -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", "ipn"}) + * @Groups({"extended", "full", "import"}) */ protected ?string $ipn = null; diff --git a/src/Entity/Parts/Storelocation.php b/src/Entity/Parts/Storelocation.php index e14b3ef0..52f84f2d 100644 --- a/src/Entity/Parts/Storelocation.php +++ b/src/Entity/Parts/Storelocation.php @@ -71,22 +71,24 @@ class Storelocation extends AbstractPartsContainingDBElement /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full"}) + * @Groups({"full", "import"}) */ protected bool $is_full = false; /** * @var bool * @ORM\Column(type="boolean") - * @Groups({"full"}) + * @Groups({"full", "import"}) */ protected bool $only_single_part = false; /** * @var bool * @ORM\Column(type="boolean") + * @Groups({"full", "import"}) */ protected bool $limit_to_existing_parts = false; + /** * @var Collection * @ORM\OneToMany(targetEntity="App\Entity\Attachments\StorelocationAttachment", mappedBy="element", cascade={"persist", "remove"}, orphanRemoval=true) diff --git a/src/Entity/Parts/Supplier.php b/src/Entity/Parts/Supplier.php index 8183cf91..ae1e4ca1 100644 --- a/src/Entity/Parts/Supplier.php +++ b/src/Entity/Parts/Supplier.php @@ -31,6 +31,7 @@ use App\Validator\Constraints\Selectable; use Brick\Math\BigDecimal; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; /** @@ -74,6 +75,7 @@ class Supplier extends AbstractCompany /** * @var BigDecimal|null the shipping costs that have to be paid, when ordering via this supplier * @ORM\Column(name="shipping_costs", nullable=true, type="big_decimal", precision=11, scale=5) + * @Groups({"extended", "full", "import"}) * @BigDecimalPositiveOrZero() */ protected ?BigDecimal $shipping_costs = null; diff --git a/src/Entity/PriceInformations/Currency.php b/src/Entity/PriceInformations/Currency.php index c86cb3e9..f2c44504 100644 --- a/src/Entity/PriceInformations/Currency.php +++ b/src/Entity/PriceInformations/Currency.php @@ -61,7 +61,7 @@ class Currency extends AbstractStructuralDBElement * @var string the 3-letter ISO code of the currency * @ORM\Column(type="string") * @Assert\Currency() - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected string $iso_code = ""; diff --git a/src/Entity/PriceInformations/Orderdetail.php b/src/Entity/PriceInformations/Orderdetail.php index f0fabc05..2d84c70c 100644 --- a/src/Entity/PriceInformations/Orderdetail.php +++ b/src/Entity/PriceInformations/Orderdetail.php @@ -55,20 +55,21 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N * @ORM\OneToMany(targetEntity="Pricedetail", mappedBy="orderdetail", cascade={"persist", "remove"}, orphanRemoval=true) * @Assert\Valid() * @ORM\OrderBy({"min_discount_quantity" = "ASC"}) - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected $pricedetails; /** * @var string * @ORM\Column(type="string") - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected string $supplierpartnr = ''; /** * @var bool * @ORM\Column(type="boolean") + * @Groups({"extended", "full", "import"}) */ protected bool $obsolete = false; @@ -76,7 +77,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N * @var string * @ORM\Column(type="string") * @Assert\Url() - * @Groups({"full"}) + * @Groups({"full", "import"}) */ protected string $supplier_product_url = ''; @@ -93,7 +94,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N * @ORM\ManyToOne(targetEntity="App\Entity\Parts\Supplier", inversedBy="orderdetails") * @ORM\JoinColumn(name="id_supplier", referencedColumnName="id") * @Assert\NotNull(message="validator.orderdetail.supplier_must_not_be_null") - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected ?Supplier $supplier = null; diff --git a/src/Entity/PriceInformations/Pricedetail.php b/src/Entity/PriceInformations/Pricedetail.php index 07ef01cd..b1ac5155 100644 --- a/src/Entity/PriceInformations/Pricedetail.php +++ b/src/Entity/PriceInformations/Pricedetail.php @@ -66,7 +66,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface * @ORM\ManyToOne(targetEntity="Currency", inversedBy="pricedetails") * @ORM\JoinColumn(name="id_currency", referencedColumnName="id", nullable=true) * @Selectable() - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected ?Currency $currency = null; @@ -74,7 +74,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface * @var float * @ORM\Column(type="float") * @Assert\Positive() - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected float $price_related_quantity = 1.0; @@ -82,7 +82,7 @@ class Pricedetail extends AbstractDBElement implements TimeStampableInterface * @var float * @ORM\Column(type="float") * @Assert\Positive() - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected float $min_discount_quantity = 1.0; diff --git a/src/Serializer/PartNormalizer.php b/src/Serializer/PartNormalizer.php index 1be29c9e..1d0725e4 100644 --- a/src/Serializer/PartNormalizer.php +++ b/src/Serializer/PartNormalizer.php @@ -34,6 +34,7 @@ class PartNormalizer implements NormalizerInterface, DenormalizerInterface, Cach 'notes' => 'comment', 'quantity' => 'instock', 'amount' => 'instock', + 'mpn' => 'manufacturer_product_number', ]; private ObjectNormalizer $normalizer;