Do not import prices with zero price as pricedetails during partkeepr import

These are useless placeholders by partkeepr
This commit is contained in:
Jan Böhmer 2024-01-10 23:40:06 +01:00
parent be1e17b3be
commit 301ecf6c95

View file

@ -255,7 +255,7 @@ class PKPartImporter
} elseif (!empty($partdistributor['orderNumber']) && !empty($partdistributor['sku'])) {
$spn = $partdistributor['orderNumber'] . ' (' . $partdistributor['sku'] . ')';
} else {
$spn = 'PartKeepr Import';
$spn = '';
}
$orderdetail = $this->em->getRepository(Orderdetail::class)->findOneBy([
@ -273,8 +273,8 @@ class PKPartImporter
$this->em->persist($orderdetail);
}
//Add the price information to the orderdetail
if (!empty($partdistributor['price'])) {
//Add the price information to the orderdetail (only if the price is not zero, as this was a placeholder in PartKeepr)
if (!empty($partdistributor['price']) && !BigDecimal::of($partdistributor['price'])->isZero()) {
$pricedetail = new Pricedetail();
$orderdetail->addPricedetail($pricedetail);
//Partkeepr stores the price per item, we need to convert it to the price per packaging unit