From 27b43041f96197844652b9b093ffa6fd98a2c12b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 2 Apr 2023 01:00:40 +0200 Subject: [PATCH] Allow to import orderdetails and partLots of parts --- src/Entity/Parts/PartTraits/InstockTrait.php | 2 +- src/Entity/Parts/PartTraits/OrderTrait.php | 2 +- src/Entity/PriceInformations/Orderdetail.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Entity/Parts/PartTraits/InstockTrait.php b/src/Entity/Parts/PartTraits/InstockTrait.php index 6035fd40..212e58b7 100644 --- a/src/Entity/Parts/PartTraits/InstockTrait.php +++ b/src/Entity/Parts/PartTraits/InstockTrait.php @@ -39,7 +39,7 @@ trait InstockTrait * @ORM\OneToMany(targetEntity="PartLot", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true) * @Assert\Valid() * @ORM\OrderBy({"amount" = "DESC"}) - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected $partLots; diff --git a/src/Entity/Parts/PartTraits/OrderTrait.php b/src/Entity/Parts/PartTraits/OrderTrait.php index 97dc2713..79721443 100644 --- a/src/Entity/Parts/PartTraits/OrderTrait.php +++ b/src/Entity/Parts/PartTraits/OrderTrait.php @@ -40,7 +40,7 @@ trait OrderTrait * @ORM\OneToMany(targetEntity="App\Entity\PriceInformations\Orderdetail", mappedBy="part", cascade={"persist", "remove"}, orphanRemoval=true) * @Assert\Valid() * @ORM\OrderBy({"supplierpartnr" = "ASC"}) - * @Groups({"extended", "full"}) + * @Groups({"extended", "full", "import"}) */ protected $orderdetails; diff --git a/src/Entity/PriceInformations/Orderdetail.php b/src/Entity/PriceInformations/Orderdetail.php index 2d84c70c..82b59b1f 100644 --- a/src/Entity/PriceInformations/Orderdetail.php +++ b/src/Entity/PriceInformations/Orderdetail.php @@ -344,7 +344,7 @@ class Orderdetail extends AbstractDBElement implements TimeStampableInterface, N public function setSupplierProductUrl(string $new_url): self { //Only change the internal URL if it is not the auto generated one - if ($new_url === $this->supplier->getAutoProductUrl($this->getSupplierPartNr())) { + if ($this->supplier && $new_url === $this->supplier->getAutoProductUrl($this->getSupplierPartNr())) { return $this; }