Skip to content

Commit ea20de5

Browse files
committed
Allow import to skip errors buy making them non-critical
1 parent 915dfef commit ea20de5

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

app/code/Magento/ImportExport/Controller/Adminhtml/Import/Validate.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private function getImport()
132132
private function addMessageToSkipErrors(Result $resultBlock)
133133
{
134134
$import = $this->getImport();
135-
if (!$import->getErrorAggregator()->hasFatalExceptions()) {
135+
if (!$import->getErrorAggregator()->hasToBeTerminated()) {
136136
$resultBlock->addSuccess(
137137
__('Please fix errors and re-upload file or simply press "Import" button to skip rows with errors'),
138138
true

app/code/Magento/ImportExport/Model/Import.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,11 @@ public function importSource()
409409

410410
$this->addLogComment(__('Begin import of "%1" with "%2" behavior', $this->getEntity(), $this->getBehavior()));
411411

412+
$this->getErrorAggregator()->initValidationStrategy(
413+
$this->getData(self::FIELD_NAME_VALIDATION_STRATEGY),
414+
$this->getData(self::FIELD_NAME_ALLOWED_ERROR_COUNT)
415+
);
416+
412417
$result = $this->processImport();
413418

414419
if ($result) {

app/code/Magento/ImportExport/Model/Import/AbstractEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ public function addRowError(
517517
$errorRowNum,
518518
$colName = null,
519519
$errorMessage = null,
520-
$errorLevel = ProcessingError::ERROR_LEVEL_CRITICAL,
520+
$errorLevel = ProcessingError::ERROR_LEVEL_NOT_CRITICAL,
521521
$errorDescription = null
522522
) {
523523
$errorCode = (string)$errorCode;

app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ public function addRowError(
469469
$errorRowNum,
470470
$colName = null,
471471
$errorMessage = null,
472-
$errorLevel = ProcessingError::ERROR_LEVEL_CRITICAL,
472+
$errorLevel = ProcessingError::ERROR_LEVEL_NOT_CRITICAL,
473473
$errorDescription = null
474474
) {
475475
$errorCode = (string)$errorCode;

0 commit comments

Comments
 (0)