diff --git a/composer.json b/composer.json
index a096921..68b7bb4 100644
--- a/composer.json
+++ b/composer.json
@@ -2,16 +2,17 @@
"name": "honl/magento2-import",
"description": "",
"require": {
- "php": "~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0",
+ "php": "~7.1.0 || ~7.2.0 || ~7.3.0 || ~7.4.0 || ~8.2",
"guzzlehttp/guzzle": "^7",
"prewk/xml-string-streamer": "^1.2",
"prewk/xml-string-streamer-guzzle": "^1.2",
"kevinrob/guzzle-cache-middleware": "^4",
"ecomdev/magento-psr6-bridge": "^0.2.1",
- "symfony/stopwatch": "~4.0",
+ "symfony/stopwatch": "^v6.2",
"bakame/psr7-csv-factory": "^1.0@dev",
"league/csv": "^9.1",
- "monolog/monolog": "^2.8"
+ "monolog/monolog": "^2.8",
+ "ext-mbstring": "*"
},
"type": "magento2-module",
"autoload": {
diff --git a/src/Console/Command/CronScheduleCommand.php b/src/Console/Command/CronScheduleCommand.php
index ac9e334..f3cc64d 100644
--- a/src/Console/Command/CronScheduleCommand.php
+++ b/src/Console/Command/CronScheduleCommand.php
@@ -88,7 +88,7 @@ public function configure()
*
* @throws \Magento\Framework\Exception\AlreadyExistsException
*
- * @return void
+ * @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
@@ -100,7 +100,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (! $job) {
$output->writeln("".((string) new Phrase("Job not found"))."");
- return;
+ return 0;
}
@@ -109,7 +109,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln(
(string) new Phrase("Job is already %1", ["".$existingJob->getStatus().""])
);
- return;
+ return 0;
}
try {
@@ -121,7 +121,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
[$ahead]
)
."");
- return;
+ return 0;
}
$jobSchedule = $this->generateSchedule($job, $ahead);
@@ -130,6 +130,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$jobSchedule->getResource()->save($jobSchedule);
$output->writeln("".((string) new Phrase("Job scheduled"))."");
+ return 0;
}
/**
diff --git a/src/Console/Command/HoImportRunCommand.php b/src/Console/Command/HoImportRunCommand.php
index 75aa237..4fcadfa 100644
--- a/src/Console/Command/HoImportRunCommand.php
+++ b/src/Console/Command/HoImportRunCommand.php
@@ -95,7 +95,7 @@ public function configure()
* @param InputInterface $input
* @param OutputInterface $output
*
- * @return void
+ * @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
@@ -104,11 +104,12 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (!isset($profiles[$profile])) {
$profileList = implode(", ", array_keys($profiles));
$output->writeln((string) new Phrase("Profile not in profilelist: %1", [$profileList]));
- return;
+ return 0;
}
$profileInstance = $profiles[$profile];
$profileInstance->run();
+ return 0;
}
diff --git a/src/RowModifier/ExternalCategoryManagement.php b/src/RowModifier/ExternalCategoryManagement.php
index 6a039a3..e3452bd 100644
--- a/src/RowModifier/ExternalCategoryManagement.php
+++ b/src/RowModifier/ExternalCategoryManagement.php
@@ -231,6 +231,6 @@ private function extractCategoriesFromString($categories)
{
return array_filter(array_map(function ($category) {
return trim($category, " \t\n\r\0\x0B/");
- }, explode(',', trim($categories, " \t\n\r\0\x0B/"))));
+ }, explode(',', trim($categories ?? '', " \t\n\r\0\x0B/"))));
}
}
diff --git a/src/Streamer/FileCsv.php b/src/Streamer/FileCsv.php
index 74360ed..e25cac9 100644
--- a/src/Streamer/FileCsv.php
+++ b/src/Streamer/FileCsv.php
@@ -99,7 +99,7 @@ public function getIterator()
$csvReader->setDelimiter($this->delimiter);
}
foreach ($csvReader->getIterator() as $row) {
- yield (empty($this->headers) ? $row : \array_combine($this->headers, \array_map('utf8_encode', $row)));
+ yield (empty($this->headers) ? $row : \array_combine($this->headers, \array_map(self::class . '::convert_encoding', $row)));
}
}
@@ -112,4 +112,9 @@ private function getRequestFile(): string
? $this->requestFile
: $this->directoryList->getRoot() . '/' . trim($this->requestFile, '/');
}
+
+ public function convert_encoding($row)
+ {
+ return mb_convert_encoding($row, 'UTF-8', 'ISO-8859-1');
+ }
}