From f98e20aa841e2e2287f0820026c1bb21c69b3df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Mon, 3 Jul 2023 23:33:45 +0200 Subject: [PATCH] Fixed errors importing partkeepr databases --- .../ImportExportSystem/PartKeeprImporter/PKPartImporter.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php b/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php index a1b9aeed..b82b9014 100644 --- a/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php +++ b/src/Services/ImportExportSystem/PartKeeprImporter/PKPartImporter.php @@ -75,7 +75,7 @@ class PKPartImporter $entity->setComment('This part represents a former metapart in PartKeepr. It is not supported in Part-DB yet. And you can most likely delete it.'); $entity->setTags('partkeepr-imported,partkeepr-metapart'); } else { - $entity->setMinAmount($part['minStockLevel'] ?? 0); + $entity->setMinAmount((float) ($part['minStockLevel'] ?? 0)); if (!empty($part['internalPartNumber'])) { $entity->setIpn($part['internalPartNumber']); } @@ -92,7 +92,7 @@ class PKPartImporter //Create a part lot to store the stock level and location $lot = new PartLot(); - $lot->setAmount($part['stockLevel'] ?? 0); + $lot->setAmount((float) ($part['stockLevel'] ?? 0)); $this->setAssociationField($lot, 'storage_location', Storelocation::class, $part['storageLocation_id']); $entity->addPartLot($lot); @@ -278,7 +278,7 @@ class PKPartImporter $orderdetail->addPricedetail($pricedetail); //Partkeepr stores the price per item, we need to convert it to the price per packaging unit $price_per_item = BigDecimal::of($partdistributor['price']); - $packaging_unit = $partdistributor['packagingUnit'] ?? 1; + $packaging_unit = (float) ($partdistributor['packagingUnit'] ?? 1); $pricedetail->setPrice($price_per_item->multipliedBy($packaging_unit)); $pricedetail->setPriceRelatedQuantity($packaging_unit); //We have to set the minimum discount quantity to the packaging unit (PartKeepr does not know this concept)