Skip to content

Commit 77ec759

Browse files
author
Nikita Chubukov
committed
MAGETWO-91640: Scheduled Import of Products fails on error when errors should be skipped
- Changed behaviour for "skip-errors" processing during import shceduling
1 parent 547ad4a commit 77ec759

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,8 +1623,11 @@ protected function _saveProducts()
16231623
continue;
16241624
}
16251625
if ($this->getErrorAggregator()->hasToBeTerminated()) {
1626-
$this->getErrorAggregator()->addRowToSkip($rowNum);
1627-
continue;
1626+
$validationStrategy = $this->_parameters[Import::FIELD_NAME_VALIDATION_STRATEGY];
1627+
if (ProcessingErrorAggregatorInterface::VALIDATION_STRATEGY_SKIP_ERRORS !== $validationStrategy) {
1628+
$this->getErrorAggregator()->addRowToSkip($rowNum);
1629+
continue;
1630+
}
16281631
}
16291632
$rowScope = $this->getRowScope($rowData);
16301633

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ class Import extends \Magento\ImportExport\Model\AbstractModel
181181
* @param Source\Import\Behavior\Factory $behaviorFactory
182182
* @param \Magento\Framework\Indexer\IndexerRegistry $indexerRegistry
183183
* @param History $importHistoryModel
184-
* @param \Magento\Framework\Stdlib\DateTime\DateTime
184+
* @param \Magento\Framework\Stdlib\DateTime\DateTime $localeDate
185185
* @param array $data
186186
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
187187
*/
@@ -443,6 +443,8 @@ public function importSource()
443443
}
444444

445445
/**
446+
* Processing of import.
447+
*
446448
* @return bool
447449
* @throws \Magento\Framework\Exception\LocalizedException
448450
*/
@@ -462,6 +464,8 @@ public function isImportAllowed()
462464
}
463465

464466
/**
467+
* Get error aggregator instance.
468+
*
465469
* @return ProcessingErrorAggregatorInterface
466470
* @throws \Magento\Framework\Exception\LocalizedException
467471
*/
@@ -585,6 +589,11 @@ public function validateSource(\Magento\ImportExport\Model\Import\AbstractSource
585589
$this->addLogComment($messages);
586590

587591
$result = !$errorAggregator->getErrorsCount();
592+
$validationStrategy = $this->getData(self::FIELD_NAME_VALIDATION_STRATEGY);
593+
if ($validationStrategy === ProcessingErrorAggregatorInterface::VALIDATION_STRATEGY_SKIP_ERRORS) {
594+
$result = true;
595+
}
596+
588597
if ($result) {
589598
$this->addLogComment(__('Import data validation is complete.'));
590599
}
@@ -710,9 +719,9 @@ public function isReportEntityType($entity = null)
710719
/**
711720
* Create history report
712721
*
722+
* @param string $sourceFileRelative
713723
* @param string $entity
714724
* @param string $extension
715-
* @param string $sourceFileRelative
716725
* @param array $result
717726
* @return $this
718727
* @throws \Magento\Framework\Exception\LocalizedException

0 commit comments

Comments
 (0)