From 8fea09459339dd689b29a4ad7e2c49c1646618c4 Mon Sep 17 00:00:00 2001 From: Marko <52066939+HeX87@users.noreply.github.com> Date: Fri, 24 Nov 2023 15:08:31 +0100 Subject: [PATCH] add fixed export --- src/Helper/HiltesImport.php | 7 ++----- src/Helper/Jtl.php | 15 ++++++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Helper/HiltesImport.php b/src/Helper/HiltesImport.php index 3f79e23..c656be0 100644 --- a/src/Helper/HiltesImport.php +++ b/src/Helper/HiltesImport.php @@ -60,7 +60,6 @@ class HiltesImport throw new RuntimeException("Error: File not found - " . $file['realPath']); } } - $this->logger->info("Imported $count stocks"); } else { $this->logger->info('No Files'); @@ -130,10 +129,8 @@ class HiltesImport $this->logger->error($e->getMessage()); } -// unlink($srcFile); -// unlink($srcFile . '.Ende'); - - unlink($this->rootPath . '/hiltes/h2c/WS.FERTIG'); + unlink($srcFile); + unlink($srcFile . '.Ende'); $this->logger->info($count . ' Datensätze importiert'); diff --git a/src/Helper/Jtl.php b/src/Helper/Jtl.php index 7f7318a..a97d40e 100644 --- a/src/Helper/Jtl.php +++ b/src/Helper/Jtl.php @@ -78,12 +78,17 @@ class Jtl $warehouse = $s->getWarehouse(); $warehouseName = $warehouse->getName(); - $data[$s->getProductId() . $warehouseName] = [ - 'gtin' => $products[$s->getProductId()]->getGtin(), - 'stock' => $s->getInstock(), - 'warehouse' => $this->arrLager[$warehouseName] ?? 'Lager ' . $warehouseName - ]; + if (isset($products[$s->getProductId()])) { + $data[$s->getProductId() . $warehouseName] = [ + 'gtin' => $products[$s->getProductId()]->getGtin(), + 'stock' => $s->getInstock(), + 'warehouse' => $this->arrLager[$warehouseName] ?? 'Lager ' . $warehouseName, + 'lager' => '01' + ]; + } else { + $this->logger->info('No product for stock ' . $s->getProductId()); + } } } else { //Wenn Product nicht gefunden werden kann, dann setzte Bestand auf Null