Skip to content

Commit 2d83bee

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento-commerce/magento2ce into ACP2E-1073
2 parents b512463 + 2854866 commit 2d83bee

File tree

38 files changed

+592
-126040
lines changed

38 files changed

+592
-126040
lines changed

app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ public function __construct(
164164
*/
165165
abstract public function execute($ids);
166166

167+
// phpcs:disable
167168
/**
168169
* Synchronize data between index storage and original storage
169170
*
@@ -196,6 +197,7 @@ protected function _syncData(array $processIds = [])
196197
return $this;
197198
}
198199

200+
// phpcs:enable
199201
/**
200202
* Prepare website current dates table
201203
*
@@ -456,6 +458,7 @@ private function deleteOutdatedData(array $entityIds, string $temporaryTable, st
456458
*/
457459
private function deleteIndexData(array $entityIds)
458460
{
461+
$entityIds = array_unique(array_map('intval', $entityIds));
459462
foreach ($this->dimensionCollectionFactory->create() as $dimensions) {
460463
$select = $this->getConnection()->select()->from(
461464
['index_price' => $this->tableMaintainer->getMainTableByDimensions($dimensions)],
@@ -466,6 +469,7 @@ private function deleteIndexData(array $entityIds)
466469
}
467470
}
468471

472+
// phpcs:disable
469473
/**
470474
* Copy relations product index from primary index to temporary index table by parent entity
471475
*
@@ -516,6 +520,7 @@ protected function _copyRelationIndexData($parentIds, $excludeIds = null)
516520
return $this;
517521
}
518522

523+
// phpcs:enable
519524
/**
520525
* Retrieve index table by dimension that will be used for write operations.
521526
*

app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,16 @@
192192
<label translate="true">Websites</label>
193193
</settings>
194194
</column>
195+
<column name="updated_at"
196+
class="Magento\Ui\Component\Listing\Columns\Date"
197+
component="Magento_Ui/js/grid/columns/date"
198+
sortOrder="110">
199+
<settings>
200+
<filter>dateRange</filter>
201+
<dataType>date</dataType>
202+
<label translate="true">Last Updated At</label>
203+
</settings>
204+
</column>
195205
<actionsColumn name="actions" class="Magento\Catalog\Ui\Component\Listing\Columns\ProductActions" sortOrder="200">
196206
<settings>
197207
<indexField>entity_id</indexField>

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ define([
412412
product = {
413413
'id': row.productId,
414414
'product_link': row.productUrl,
415-
'name': $('<i></i>').text(row.name).html(),
415+
'name': row.name,
416416
'sku': row.sku,
417417
'status': row.status,
418418
'price': row.price,

app/code/Magento/Dhl/Model/Carrier.php

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin
5757
*
5858
* @var string[]
5959
*/
60-
protected $_customizableContainerTypes = [self::DHL_CONTENT_TYPE_NON_DOC];
60+
protected $_customizableContainerTypes = [self::DHL_CONTENT_TYPE_NON_DOC, self::DHL_CONTENT_TYPE_DOC];
6161

6262
/**
6363
* Code of the carrier
@@ -1533,7 +1533,7 @@ protected function _doRequest()
15331533
' xmlns:req="http://www.dhl.com"' .
15341534
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' .
15351535
' xsi:schemaLocation="http://www.dhl.com ship-val-global-req.xsd"' .
1536-
' schemaVersion="6.2" />';
1536+
' schemaVersion="10.0" />';
15371537
$xml = $this->_xmlElFactory->create(['data' => $xmlStr]);
15381538

15391539
$nodeRequest = $xml->addChild('Request', '', '');
@@ -1562,13 +1562,11 @@ protected function _doRequest()
15621562
$xml->addChild('RegionCode', $originRegion, '');
15631563
}
15641564
$xml->addChild('RequestedPickupTime', 'N', '');
1565-
$xml->addChild('NewShipper', 'N', '');
15661565
$xml->addChild('LanguageCode', 'EN', '');
1567-
$xml->addChild('PiecesEnabled', 'Y', '');
15681566

15691567
/** Billing */
15701568
$nodeBilling = $xml->addChild('Billing', '', '');
1571-
$nodeBilling->addChild('ShipperAccountNumber', (string)$this->getConfigData('account'));
1569+
$nodeBilling->addChild('ShipperAccountNumber', (string)substr($this->getConfigData('account'), 0, 9));
15721570
/**
15731571
* Method of Payment:
15741572
* S (Shipper)
@@ -1580,13 +1578,12 @@ protected function _doRequest()
15801578
/**
15811579
* Shipment bill to account – required if Shipping PaymentType is other than 'S'
15821580
*/
1583-
$nodeBilling->addChild('BillingAccountNumber', (string)$this->getConfigData('account'));
1581+
$nodeBilling->addChild('BillingAccountNumber', (string)substr($this->getConfigData('account'), 0, 9));
15841582
if ($this->isDutiable(
15851583
$rawRequest->getShipperAddressCountryCode(),
15861584
$rawRequest->getRecipientAddressCountryCode()
15871585
)) {
1588-
$nodeBilling->addChild('DutyPaymentType', 'S');
1589-
$nodeBilling->addChild('DutyAccountNumber', (string)$this->getConfigData('account'));
1586+
$nodeBilling->addChild('DutyAccountNumber', (string)substr($this->getConfigData('account'), 0, 9));
15901587
}
15911588

15921589
/** Receiver */
@@ -1601,11 +1598,16 @@ protected function _doRequest()
16011598
$address = $rawRequest->getRecipientAddressStreet1() . ' ' . $rawRequest->getRecipientAddressStreet2();
16021599
$address = $this->string->split($address, 45, false, true);
16031600
if (is_array($address)) {
1601+
$addressLineNumber = 1;
16041602
foreach ($address as $addressLine) {
1605-
$nodeConsignee->addChild('AddressLine', $addressLine);
1603+
if ($addressLineNumber > 3) {
1604+
break;
1605+
}
1606+
$nodeConsignee->addChild('AddressLine'.$addressLineNumber, $addressLine);
1607+
$addressLineNumber++;
16061608
}
16071609
} else {
1608-
$nodeConsignee->addChild('AddressLine', $address);
1610+
$nodeConsignee->addChild('AddressLine1', $address);
16091611
}
16101612

16111613
$nodeConsignee->addChild('City', $rawRequest->getRecipientAddressCity());
@@ -1633,7 +1635,7 @@ protected function _doRequest()
16331635
* value should lie in between 1 to 9999.This field is mandatory.
16341636
*/
16351637
$nodeCommodity = $xml->addChild('Commodity', '', '');
1636-
$nodeCommodity->addChild('CommodityCode', '1');
1638+
$nodeCommodity->addChild('CommodityCode', substr('01', 0, 18));
16371639

16381640
/** Dutiable */
16391641
if ($this->isDutiable(
@@ -1647,6 +1649,7 @@ protected function _doRequest()
16471649
);
16481650
$baseCurrencyCode = $this->_storeManager->getWebsite($rawRequest->getWebsiteId())->getBaseCurrencyCode();
16491651
$nodeDutiable->addChild('DeclaredCurrency', $baseCurrencyCode);
1652+
$nodeDutiable->addChild('TermsOfTrade', 'DAP');
16501653
}
16511654

16521655
/**
@@ -1663,18 +1666,23 @@ protected function _doRequest()
16631666

16641667
/** Shipper */
16651668
$nodeShipper = $xml->addChild('Shipper', '', '');
1666-
$nodeShipper->addChild('ShipperID', (string)$this->getConfigData('account'));
1669+
$nodeShipper->addChild('ShipperID', (string)substr($this->getConfigData('account'), 0, 9));
16671670
$nodeShipper->addChild('CompanyName', $rawRequest->getShipperContactCompanyName());
1668-
$nodeShipper->addChild('RegisteredAccount', (string)$this->getConfigData('account'));
1671+
$nodeShipper->addChild('RegisteredAccount', (string)substr($this->getConfigData('account'), 0, 9));
16691672

16701673
$address = $rawRequest->getShipperAddressStreet1() . ' ' . $rawRequest->getShipperAddressStreet2();
16711674
$address = $this->string->split($address, 45, false, true);
16721675
if (is_array($address)) {
1676+
$addressLineNumber = 1;
16731677
foreach ($address as $addressLine) {
1674-
$nodeShipper->addChild('AddressLine', $addressLine);
1678+
if ($addressLineNumber > 3) {
1679+
break;
1680+
}
1681+
$nodeShipper->addChild('AddressLine'.$addressLineNumber, $addressLine);
1682+
$addressLineNumber++;
16751683
}
16761684
} else {
1677-
$nodeShipper->addChild('AddressLine', $address);
1685+
$nodeShipper->addChild('AddressLine1', $address);
16781686
}
16791687

16801688
$nodeShipper->addChild('City', $rawRequest->getShipperAddressCity());
@@ -1742,7 +1750,6 @@ protected function _doRequest()
17421750
protected function _shipmentDetails($xml, $rawRequest, $originRegion = '')
17431751
{
17441752
$nodeShipmentDetails = $xml->addChild('ShipmentDetails', '', '');
1745-
$nodeShipmentDetails->addChild('NumberOfPieces', count($rawRequest->getPackages()));
17461753

17471754
$nodePieces = $nodeShipmentDetails->addChild('Pieces', '', '');
17481755

@@ -1776,7 +1783,6 @@ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '')
17761783
$nodePiece->addChild('PieceContents', $this->string->substr(implode(',', $content), 0, 34));
17771784
}
17781785

1779-
$nodeShipmentDetails->addChild('Weight', sprintf('%.3f', $rawRequest->getPackageWeight()));
17801786
$nodeShipmentDetails->addChild('WeightUnit', substr($this->_getWeightUnit(), 0, 1));
17811787
$nodeShipmentDetails->addChild('GlobalProductCode', $rawRequest->getShippingMethod());
17821788
$nodeShipmentDetails->addChild('LocalProductCode', $rawRequest->getShippingMethod());
@@ -1785,12 +1791,7 @@ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '')
17851791
$this->_coreDate->date('Y-m-d', strtotime('now + 1day'))
17861792
);
17871793
$nodeShipmentDetails->addChild('Contents', 'DHL Parcel');
1788-
/**
1789-
* The DoorTo Element defines the type of delivery service that applies to the shipment.
1790-
* The valid values are DD (Door to Door), DA (Door to Airport) , AA and DC (Door to
1791-
* Door non-compliant)
1792-
*/
1793-
$nodeShipmentDetails->addChild('DoorTo', 'DD');
1794+
17941795
$nodeShipmentDetails->addChild('DimensionUnit', substr($this->_getDimensionUnit(), 0, 1));
17951796
$contentType = isset($package['params']['container']) ? $package['params']['container'] : '';
17961797
$packageType = $contentType === self::DHL_CONTENT_TYPE_NON_DOC ? 'CP' : 'EE';

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

Lines changed: 21 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Magento\Framework\HTTP\Adapter\FileTransferFactory;
1919
use Magento\Framework\Indexer\IndexerRegistry;
2020
use Magento\Framework\Math\Random;
21+
use Magento\Framework\Message\ManagerInterface;
2122
use Magento\Framework\Stdlib\DateTime\DateTime;
2223
use Magento\ImportExport\Helper\Data as DataHelper;
2324
use Magento\ImportExport\Model\Export\Adapter\CsvFactory;
@@ -29,11 +30,10 @@
2930
use Magento\ImportExport\Model\Import\Entity\Factory;
3031
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingError;
3132
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface;
32-
use Magento\Framework\Message\ManagerInterface;
3333
use Magento\ImportExport\Model\ResourceModel\Import\Data;
3434
use Magento\ImportExport\Model\Source\Import\AbstractBehavior;
3535
use Magento\ImportExport\Model\Source\Import\Behavior\Factory as BehaviorFactory;
36-
use Magento\MediaStorage\Model\File\Uploader;
36+
use Magento\ImportExport\Model\Source\Upload;
3737
use Magento\MediaStorage\Model\File\UploaderFactory;
3838
use Psr\Log\LoggerInterface;
3939

@@ -122,6 +122,7 @@ class Import extends AbstractModel
122122
protected $_entityAdapter;
123123

124124
/**
125+
* @Deprecated Property isn't used
125126
* @var DataHelper
126127
*/
127128
protected $_importExportData = null;
@@ -152,6 +153,7 @@ class Import extends AbstractModel
152153
protected $_csvFactory;
153154

154155
/**
156+
* @Deprecated Property isn't used
155157
* @var FileTransferFactory
156158
*/
157159
protected $_httpFactory;
@@ -192,10 +194,16 @@ class Import extends AbstractModel
192194
private $messageManager;
193195

194196
/**
197+
* @Deprecated Property isn't used
195198
* @var Random
196199
*/
197200
private $random;
198201

202+
/**
203+
* @var Upload
204+
*/
205+
private $upload;
206+
199207
/**
200208
* @param LoggerInterface $logger
201209
* @param Filesystem $filesystem
@@ -214,6 +222,7 @@ class Import extends AbstractModel
214222
* @param array $data
215223
* @param ManagerInterface|null $messageManager
216224
* @param Random|null $random
225+
* @param Upload|null $upload
217226
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
218227
*/
219228
public function __construct(
@@ -233,7 +242,8 @@ public function __construct(
233242
DateTime $localeDate,
234243
array $data = [],
235244
ManagerInterface $messageManager = null,
236-
Random $random = null
245+
Random $random = null,
246+
Upload $upload = null
237247
) {
238248
$this->_importExportData = $importExportData;
239249
$this->_coreConfig = $coreConfig;
@@ -252,6 +262,8 @@ public function __construct(
252262
->get(ManagerInterface::class);
253263
$this->random = $random ?: ObjectManager::getInstance()
254264
->get(Random::class);
265+
$this->upload = $upload ?: ObjectManager::getInstance()
266+
->get(Upload::class);
255267
parent::__construct($logger, $filesystem, $data);
256268
}
257269

@@ -303,6 +315,8 @@ protected function _getEntityAdapter()
303315
/**
304316
* Returns source adapter object.
305317
*
318+
* @Deprecated
319+
* @see \Magento\ImportExport\Model\Import\Source\Factory::create()
306320
* @param string $sourceFile Full path to source file
307321
* @return AbstractSource
308322
* @throws FileSystemException
@@ -550,61 +564,12 @@ public function getErrorAggregator()
550564
*/
551565
public function uploadSource()
552566
{
553-
/** @var $adapter \Zend_File_Transfer_Adapter_Http */
554-
$adapter = $this->_httpFactory->create();
555-
if (!$adapter->isValid(self::FIELD_NAME_SOURCE_FILE)) {
556-
$errors = $adapter->getErrors();
557-
if ($errors[0] == \Zend_Validate_File_Upload::INI_SIZE) {
558-
$errorMessage = $this->_importExportData->getMaxUploadSizeMessage();
559-
} else {
560-
$errorMessage = __('The file was not uploaded.');
561-
}
562-
throw new LocalizedException($errorMessage);
563-
}
564-
565567
$entity = $this->getEntity();
566-
/** @var $uploader Uploader */
567-
$uploader = $this->_uploaderFactory->create(['fileId' => self::FIELD_NAME_SOURCE_FILE]);
568-
$uploader->setAllowedExtensions(['csv', 'zip']);
569-
$uploader->skipDbProcessing(true);
570-
$fileName = $this->random->getRandomString(32) . '.' . $uploader->getFileExtension();
571-
try {
572-
$result = $uploader->save($this->getWorkingDir(), $fileName);
573-
} catch (\Exception $e) {
574-
throw new LocalizedException(__('The file cannot be uploaded.'));
575-
}
576-
577-
$extension = '';
578-
$uploadedFile = '';
579-
if ($result !== false) {
580-
// phpcs:ignore Magento2.Functions.DiscouragedFunction
581-
$extension = pathinfo($result['file'], PATHINFO_EXTENSION);
582-
$uploadedFile = $result['path'] . $result['file'];
583-
}
584-
585-
if (!$extension) {
586-
$this->_varDirectory->delete($uploadedFile);
587-
throw new LocalizedException(__('The file you uploaded has no extension.'));
588-
}
589-
$sourceFile = $this->getWorkingDir() . $entity;
590-
591-
$sourceFile .= '.' . $extension;
568+
$result = $this->upload->uploadSource($entity);
569+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
570+
$extension = pathinfo($result['file'], PATHINFO_EXTENSION);
571+
$sourceFile = $this->getWorkingDir() . $entity . '.' . $extension;
592572
$sourceFileRelative = $this->_varDirectory->getRelativePath($sourceFile);
593-
594-
if (strtolower($uploadedFile) != strtolower($sourceFile)) {
595-
if ($this->_varDirectory->isExist($sourceFileRelative)) {
596-
$this->_varDirectory->delete($sourceFileRelative);
597-
}
598-
599-
try {
600-
$this->_varDirectory->renameFile(
601-
$this->_varDirectory->getRelativePath($uploadedFile),
602-
$sourceFileRelative
603-
);
604-
} catch (FileSystemException $e) {
605-
throw new LocalizedException(__('The source file moving process failed.'));
606-
}
607-
}
608573
$this->_removeBom($sourceFile);
609574
$this->createHistoryReport($sourceFileRelative, $entity, $extension, $result);
610575
return $sourceFile;

0 commit comments

Comments
 (0)