Skip to content

Commit 6144265

Browse files
author
Korshenko, Oleksii(okorshenko)
committed
Merge pull request #633 from magento-nord/MAGETWO-52831
[NORD] MAGETWO-52831 fix
2 parents 3207334 + 817c1ef commit 6144265

File tree

12 files changed

+25
-21
lines changed

12 files changed

+25
-21
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ protected function collectRawData()
919919
$additionalAttributes[$fieldName] = $fieldName .
920920
ImportProduct::PAIR_NAME_VALUE_SEPARATOR . $attrValue;
921921
}
922-
$data[$itemId][$storeId][$fieldName] = $attrValue;
922+
$data[$itemId][$storeId][$fieldName] = htmlspecialchars_decode($attrValue);
923923
}
924924
} else {
925925
$this->collectMultiselectValues($item, $code, $storeId);
@@ -934,6 +934,7 @@ protected function collectRawData()
934934
}
935935

936936
if (!empty($additionalAttributes)) {
937+
$additionalAttributes = array_map('htmlspecialchars_decode', $additionalAttributes);
937938
$data[$itemId][$storeId][self::COL_ADDITIONAL_ATTRIBUTES] =
938939
implode(Import::DEFAULT_GLOBAL_MULTI_VALUE_SEPARATOR, $additionalAttributes);
939940
} else {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
259259
ValidatorInterface::ERROR_MEDIA_PATH_NOT_ACCESSIBLE => 'Imported resource (image) does not exist in the local media storage',
260260
ValidatorInterface::ERROR_MEDIA_URL_NOT_ACCESSIBLE => 'Imported resource (image) could not be downloaded from external resource due to timeout or access permissions',
261261
ValidatorInterface::ERROR_INVALID_WEIGHT => 'Product weight is invalid',
262-
ValidatorInterface::ERROR_DUPLICATE_URL_KEY => 'Specified url key already exists',
262+
ValidatorInterface::ERROR_DUPLICATE_URL_KEY => 'Specified URL key already exists',
263263
];
264264

265265
/**

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function execute()
5555
$errorAggregator = $import->getErrorAggregator();
5656
if (!$validationResult) {
5757
$resultBlock->addError(
58-
__('Data validation is failed. Please fix errors and re-upload the file..')
58+
__('Data validation failed. Please fix the following errors and upload the file again.')
5959
);
6060
$this->addErrorMessages($resultBlock, $errorAggregator);
6161
} else {

app/code/Magento/ImportExport/Controller/Adminhtml/ImportResult.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ protected function addErrorMessages(
8484
try {
8585
$resultBlock->addNotice(
8686
'<strong>' . __('Following Error(s) has been occurred during importing process:') . '</strong><br>'
87-
. '<div class="import-error-wrapper">' . __('Only first 100 errors are displayed here. ')
87+
. '<div class="import-error-wrapper">' . __('Only the first 100 errors are shown. ')
8888
. '<a href="'
8989
. $this->createDownloadUrlImportHistoryFile($this->createErrorReport($errorAggregator))
9090
. '">' . __('Download full report') . '</a><br>'
@@ -109,7 +109,7 @@ protected function getErrorMessages(ProcessingErrorAggregatorInterface $errorAgg
109109
$messages = [];
110110
$rowMessages = $errorAggregator->getRowsGroupedByErrorCode([], [AbstractEntity::ERROR_CODE_SYSTEM_EXCEPTION]);
111111
foreach ($rowMessages as $errorCode => $rows) {
112-
$messages[] = $errorCode . ' ' . __('in rows:') . ' ' . implode(', ', $rows);
112+
$messages[] = $errorCode . ' ' . __('in row(s):') . ' ' . implode(', ', $rows);
113113
}
114114
return $messages;
115115
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,11 @@ public function getOperationResultMessages(ProcessingErrorAggregatorInterface $v
280280
$messages = [];
281281
if ($this->getProcessedRowsCount()) {
282282
if ($validationResult->getErrorsCount()) {
283-
$messages[] = __('Data validation is failed. Please fix errors and re-upload the file.');
283+
$messages[] = __('Data validation failed. Please fix the following errors and upload the file again.');
284284

285285
// errors info
286286
foreach ($validationResult->getRowsGroupedByErrorCode() as $errorMessage => $rows) {
287-
$error = $errorMessage . ' ' . __('in rows') . ': ' . implode(', ', $rows);
287+
$error = $errorMessage . ' ' . __('in row(s)') . ': ' . implode(', ', $rows);
288288
$messages[] = $error;
289289
}
290290
} else {

app/code/Magento/ImportExport/i18n/en_US.csv

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@ Status,Status
3737
"Maximum error count has been reached or system error is occurred!","Maximum error count has been reached or system error is occurred!"
3838
"Import successfully done","Import successfully done"
3939
"This file is empty. Please try another one.","This file is empty. Please try another one."
40-
"Data validation is failed. Please fix errors and re-upload the file..","Data validation is failed. Please fix errors and re-upload the file.."
40+
"Data validation failed. Please fix the following errors and upload the file again.","Data validation failed. Please fix the following errors and upload the file again."
4141
"File is valid! To start import process press ""Import"" button","File is valid! To start import process press ""Import"" button"
4242
"The file is valid, but we can\'t import it for some reason.","The file is valid, but we can\'t import it for some reason."
4343
"Checked rows: %1, checked entities: %2, invalid rows: %3, total errors: %4","Checked rows: %1, checked entities: %2, invalid rows: %3, total errors: %4"
4444
"The file was not uploaded.","The file was not uploaded."
4545
"Sorry, but the data is invalid or the file is not uploaded.","Sorry, but the data is invalid or the file is not uploaded."
4646
"Show more","Show more"
4747
"Additional data","Additional data"
48-
"Following Error(s) has been occurred during importing process:","Following Error(s) has been occurred during importing process:"
49-
"Only first 100 errors are displayed here. ","Only first 100 errors are displayed here. "
48+
"The following error(s) occurred when importing the data:","The following error(s) occurred when importing the data:"
49+
"Only the first 100 errors are shown. ","Only the first 100 errors are shown. "
5050
"Download full report","Download full report"
51-
"in rows:","in rows:"
51+
"in row(s):","in row(s):"
5252
"Make sure your file isn\'t more than %1M.","Make sure your file isn\'t more than %1M."
5353
"We can\'t provide the upload settings right now.","We can\'t provide the upload settings right now."
5454
"Created: %1, Updated: %2, Deleted: %3","Created: %1, Updated: %2, Deleted: %3"
@@ -72,8 +72,8 @@ Status,Status
7272
"The destination directory is not writable.","The destination directory is not writable."
7373
"Destination file is not writable","Destination file is not writable"
7474
"The header column names are already set.","The header column names are already set."
75-
"Data validation is failed. Please fix errors and re-upload the file.","Data validation is failed. Please fix errors and re-upload the file."
76-
"in rows","in rows"
75+
"Data validation failed. Please fix the following errors and upload the file again.","Data validation failed. Please fix the following errors and upload the file again."
76+
"in row(s)","in row(s)"
7777
"The validation is complete.","The validation is complete."
7878
"This file does not contain any data.","This file does not contain any data."
7979
"Begin import of ""%1"" with ""%2"" behavior","Begin import of ""%1"" with ""%2"" behavior"

dev/tests/integration/testsuite/Magento/Catalog/_files/multiselect_attribute.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@
3838
'option_1' => ['Option 1'],
3939
'option_2' => ['Option 2'],
4040
'option_3' => ['Option 3'],
41+
'option_4' => ['Option 4 "!@#$%^&*'],
4142
],
4243
'order' => [
4344
'option_1' => 1,
4445
'option_2' => 2,
4546
'option_3' => 3,
47+
'option_4' => 4,
4648
],
4749
],
4850
]

dev/tests/integration/testsuite/Magento/Catalog/_files/products_with_multiselect_attribute.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
)->setVisibility(
6060
\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH
6161
)->setMultiselectAttribute(
62-
[$optionIds[1], $optionIds[2]]
62+
[$optionIds[1], $optionIds[2], $optionIds[3]]
6363
)->setStatus(
6464
\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED
6565
)->setStockData(

dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Export/ProductTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ public function testExport()
7777
$exportData = $this->model->export();
7878
$this->assertContains('New Product', $exportData);
7979

80-
$this->assertContains('Option 1 Value 1', $exportData);
80+
$this->assertContains('Option 1 & Value 1"', $exportData);
81+
$this->assertContains('Option 1 & Value 2"', $exportData);
82+
$this->assertContains('Option 1 & Value 3"', $exportData);
83+
$this->assertContains('Option 4 ""!@#$%^&*', $exportData);
8184
$this->assertContains('test_option_code_2', $exportData);
8285
$this->assertContains('max_characters=10', $exportData);
8386
}

dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1073,7 +1073,7 @@ public function testValidateUrlKeys($importFile, $errorsCount)
10731073
$this->assertTrue($errors->getErrorsCount() == $errorsCount);
10741074
if ($errorsCount >= 1) {
10751075
$this->assertEquals(
1076-
"Specified url key already exists",
1076+
"Specified URL key already exists",
10771077
$errors->getErrorByRowNumber(1)[0]->getErrorMessage()
10781078
);
10791079
}

0 commit comments

Comments
 (0)