@@ -83,7 +83,9 @@ private function processValidationResult($validationResult, $resultBlock)
83
83
84
84
if ($ import ->getProcessedRowsCount ()) {
85
85
if ($ validationResult ) {
86
- $ this ->addMessageForValidResult ($ resultBlock );
86
+ $ totalError = $ errorAggregator ->getErrorsCount ();
87
+ $ totalRows = $ import ->getProcessedRowsCount ();
88
+ $ this ->addMessageForValidResult ($ resultBlock , $ totalError , $ totalRows );
87
89
} else {
88
90
$ resultBlock ->addError (
89
91
__ ('Data validation failed. Please fix the following errors and upload the file again. ' )
@@ -154,12 +156,14 @@ private function addMessageToSkipErrors(Result $resultBlock)
154
156
* 2. Add message for case when imported data was checked and result is valid, but import is not allowed.
155
157
*
156
158
* @param Result $resultBlock
159
+ * @param Import $totalError
160
+ * @param Import $totalRows
157
161
* @return void
158
162
* @throws \Magento\Framework\Exception\LocalizedException
159
163
*/
160
- private function addMessageForValidResult (Result $ resultBlock )
164
+ private function addMessageForValidResult (Result $ resultBlock, $ totalError , $ totalRows )
161
165
{
162
- if ($ this ->getImport ()->isImportAllowed ()) {
166
+ if ($ this ->getImport ()->isImportAllowed () && $ totalRows > $ totalError ) {
163
167
$ resultBlock ->addSuccess (__ ('File is valid! To start import process press "Import" button ' ), true );
164
168
} else {
165
169
$ resultBlock ->addError (__ ('The file is valid, but we can \'t import it for some reason. ' ));
0 commit comments