Skip to content

Commit c4a868c

Browse files
committed
Merge branch 'ACP2E-3527' of https://github.com/adobe-commerce-tier-4/magento2ce into PR-Tier4-VK-2025-01-09
2 parents 69ea15a + fb7f56f commit c4a868c

File tree

5 files changed

+42
-19
lines changed

5 files changed

+42
-19
lines changed

app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2013 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\ImportExport\Block\Adminhtml\Import\Edit;
77

@@ -264,6 +264,16 @@ protected function _prepareForm()
264264
'value' => '',
265265
]
266266
);
267+
$fieldset->addField(
268+
'_import_history_id',
269+
'hidden',
270+
[
271+
'name' => '_import_history_id',
272+
'label' => __('Import History id'),
273+
'title' => __('Import History id'),
274+
'value' => '',
275+
]
276+
);
267277
$fieldsets['upload'] = $fieldset;
268278
$form->setUseContainer(true);
269279
$this->setForm($form);

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright 2014 Adobe
3+
* Copyright 2011 Adobe
44
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
@@ -55,6 +55,11 @@ public function execute()
5555
$ids = $import->getValidatedIds();
5656
if (count($ids) > 0) {
5757
$resultBlock->addAction('value', Import::FIELD_IMPORT_IDS, $ids);
58+
$resultBlock->addAction(
59+
'value',
60+
'_import_history_id',
61+
$this->historyModel->getId()
62+
);
5863
}
5964
} catch (\Magento\Framework\Exception\LocalizedException $e) {
6065
$resultBlock->addError($e->getMessage());

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

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,42 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2015 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\ImportExport\Model;
77

88
/**
99
* Import history model
1010
*
1111
* @api
12+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1213
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1314
* @SuppressWarnings(PHPMD.LongVariable)
1415
* @since 100.0.2
1516
*/
1617
class History extends \Magento\Framework\Model\AbstractModel
1718
{
18-
const HISTORY_ID = 'history_id';
19+
public const HISTORY_ID = 'history_id';
1920

20-
const STARTED_AT = 'started_at';
21+
public const STARTED_AT = 'started_at';
2122

22-
const USER_ID = 'user_id';
23+
public const USER_ID = 'user_id';
2324

24-
const IMPORTED_FILE = 'imported_file';
25+
public const IMPORTED_FILE = 'imported_file';
2526

26-
const ERROR_FILE = 'error_file';
27+
public const ERROR_FILE = 'error_file';
2728

28-
const EXECUTION_TIME = 'execution_time';
29+
public const EXECUTION_TIME = 'execution_time';
2930

30-
const SUMMARY = 'summary';
31+
public const SUMMARY = 'summary';
3132

32-
const IMPORT_IN_PROCESS = 'In Progress';
33+
public const IMPORT_IN_PROCESS = 'In Progress';
3334

34-
const IMPORT_VALIDATION = 'Validation';
35+
public const IMPORT_VALIDATION = 'Validation';
3536

36-
const IMPORT_FAILED = 'Failed';
37+
public const IMPORT_FAILED = 'Failed';
3738

38-
const IMPORT_SCHEDULED_USER = 0;
39+
public const IMPORT_SCHEDULED_USER = 0;
3940

4041
/**
4142
* @var \Magento\ImportExport\Helper\Report
@@ -122,7 +123,7 @@ public function addErrorReportFile($filename)
122123
public function updateReport(Import $import, $updateSummary = false)
123124
{
124125
if ($import->isReportEntityType()) {
125-
$this->load($this->getLastItemId());
126+
$this->load($import->getData('_import_history_id') ?? $this->getLastItemId());
126127
$executionResult = self::IMPORT_IN_PROCESS;
127128
if ($updateSummary) {
128129
$executionResult = $this->reportHelper->getExecutionTime($this->getStartedAt());

app/code/Magento/ImportExport/Test/Unit/Controller/Adminhtml/Import/ValidateTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2013 Adobe
4+
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

@@ -307,6 +307,12 @@ public function testFileVerifiedWithImport()
307307
['show', 'import_validation_container'],
308308
['value', Import::FIELD_IMPORT_IDS, [1, 2, 3]]
309309
);
310+
$resultBlock->expects($this->once())
311+
->method('addAction')
312+
->willReturn(
313+
['show', 'import_validation_container'],
314+
['value', '_import_history_id', 1]
315+
);
310316
$this->importMock->expects($this->exactly(3))
311317
->method('getProcessedRowsCount')
312318
->willReturn(2);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Import,Import
2929
"File to Import","File to Import"
3030
"Select File to Import","Select File to Import"
3131
"Images File Directory","Images File Directory"
32+
"Import History id","Import History id"
3233
"For Type ""Local Server"" use relative path to &lt;Magento root directory&gt;/var/import/images, e.g. <i>product_images</i>, <i>import_images/batch1</i>.<br><br>For example, in case <i>product_images</i>, files should be placed into <i>&lt;Magento root directory&gt;/var/import/images/product_images</i> folder.","For Type ""Local Server"" use relative path to &lt;Magento root directory&gt;/var/import/images, e.g. <i>product_images</i>, <i>import_images/batch1</i>.<br><br>For example, in case <i>product_images</i>, files should be placed into <i>&lt;Magento root directory&gt;/var/import/images/product_images</i> folder."
3334
"Download Sample File","Download Sample File"
3435
"Please correct the data sent value.","Please correct the data sent value."

0 commit comments

Comments
 (0)