From ed6b0057b72a6ab81df364bc81ed399c12e8ef67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Wed, 26 Jul 2023 22:55:18 +0200 Subject: [PATCH] Make the manufacturer field optional on part manufacturer data during Partkeepr import This should fix issue #333 --- .../ImportExportSystem/PartKeeprImporter/PKPartImporter.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php index b82b9014..ab00ba5b 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php @@ -145,7 +145,8 @@ class PKPartImporter throw new \RuntimeException(sprintf('Could not find part with ID %s', $partmanufacturer['part_id'])); } $manufacturer = $this->em->find(Manufacturer::class, (int) $partmanufacturer['manufacturer_id']); - if (!$manufacturer instanceof Manufacturer) { + //The manufacturer is optional + if (!$manufacturer instanceof Manufacturer && !empty($partmanufacturer['manufacturer_id'])) { throw new \RuntimeException(sprintf('Could not find manufacturer with ID %s', $partmanufacturer['manufacturer_id'])); } $part->setManufacturer($manufacturer);