Skip to content

Commit

Permalink
magento-engcom/import-export-improvements#30: Extend isErrorAlreadyAd…
Browse files Browse the repository at this point in the history
…ded check to also check column name so several columns in the same row may throw the same error and they can be distinguished.
  • Loading branch information
pogster committed Jun 30, 2018
1 parent a8ee555 commit 0832e29
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function addError(
$errorMessage = null,
$errorDescription = null
) {
if ($this->isErrorAlreadyAdded($rowNumber, $errorCode)) {
if ($this->isErrorAlreadyAdded($rowNumber, $errorCode, $columnName)) {
return $this;
}
$this->processErrorStatistics($errorLevel);
Expand Down Expand Up @@ -333,13 +333,14 @@ public function clear()
/**
* @param int $rowNum
* @param string $errorCode
* @param string $columnName
* @return bool
*/
protected function isErrorAlreadyAdded($rowNum, $errorCode)
protected function isErrorAlreadyAdded($rowNum, $errorCode, $columnName = null)
{
$errors = $this->getErrorsByCode([$errorCode]);
foreach ($errors as $error) {
if ($rowNum == $error->getRowNumber()) {
if ($rowNum == $error->getRowNumber() && $columnName == $error->getColumnName()) {
return true;
}
}
Expand Down

0 comments on commit 0832e29

Please sign in to comment.